class Seek::SampleTemplates::Generator
Generator
class for creating templates. Generally this shouldn't be used directly, but instead should be used through Seek::SampleTemplates.generate(..)
Constants
- BUFFER_SIZE
- DEFAULT_MEMORY_ALLOCATION
- JAR_PATH
- JAR_VERSION
Attributes
json[R]
memory_allocation[R]
path[R]
Public Class Methods
new(path, json, memory_allocation = DEFAULT_MEMORY_ALLOCATION)
click to toggle source
# File lib/seek/sample_templates/generator.rb, line 18 def initialize(path, json, memory_allocation = DEFAULT_MEMORY_ALLOCATION) @path = path @json = json @memory_allocation = memory_allocation end
Public Instance Methods
generate()
click to toggle source
# File lib/seek/sample_templates/generator.rb, line 24 def generate run_with_cocaine end
Private Instance Methods
command()
click to toggle source
# File lib/seek/sample_templates/generator.rb, line 30 def command command = "java -Xmx#{@memory_allocation} -jar #{JAR_PATH}" command += " -f #{Shellwords.escape(path)}" command += " -j #{Shellwords.escape(json)}" command end
run_with_cocaine()
click to toggle source
# File lib/seek/sample_templates/generator.rb, line 37 def run_with_cocaine output = Terrapin::CommandLine.new(command).run output.strip rescue Terrapin::ExitStatusError => exception raise exception.message end