class TinyCI::Executor

Parent class for Builder and Tester classes

@abstract

Public Class Methods

new(config) click to toggle source

Returns a new instance of the executor.

@param config [Hash] Configuration hash, typically taken from relevant key in the {Config} object.

# File lib/tinyci/executor.rb, line 20
def initialize(config)
  @config = config
  @logger = config[:logger]
end

Public Instance Methods

command() click to toggle source
# File lib/tinyci/executor.rb, line 25
def command
  ['/bin/sh', '-c', "'#{interpolate(@config[:command])}'"]
end

Private Instance Methods

erb_scope() click to toggle source
# File lib/tinyci/executor.rb, line 45
def erb_scope
  template_vars.instance_eval { binding }
end
interpolate(command) click to toggle source
# File lib/tinyci/executor.rb, line 31
def interpolate(command)
  erb = ERB.new command

  erb.result(erb_scope)
end
template_vars() click to toggle source
# File lib/tinyci/executor.rb, line 37
def template_vars
  OpenStruct.new(
    commit: @config[:commit],
    export: @config[:export],
    target: @config[:target]
  )
end