Class: Turbo

Inherits:
Object
  • Object
show all
Defined in:
lib/turbo.rb

Instance Method Summary collapse

Constructor Details

#initialize(conf) ⇒ Turbo

Returns a new instance of Turbo.



18
19
20
21
22
# File 'lib/turbo.rb', line 18

def initialize(conf)
   f = File.join(File.dirname(File.expand_path(__FILE__)), conf ? conf : "config/turbo.conf")
  @conf = JSON.parse(File.read(f))
   @conf['conf_path'] = File.dirname(File.absolute_path(f))
end

Instance Method Details

#run_workflow(workflow = nil) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/turbo.rb', line 24

def run_workflow(workflow=nil)
    wf = JSON.parse(File.read("workflows/#{workflow}/workflow.json"))

    @workflow_path = "workflows/#{workflow}"
    @pre_command = "#{@workflow_path}/#{wf['before']}"
    @post_command = "#{@workflow_path}/#{wf['after']}"
    @debug_file = 'debug.log'

    scenarios = wf['scenarios']
    @run_success = 0
    @run_failed = 0

    execute_before_script
    scenarios.each do |scenario|
        run_scenario("#{@workflow_path}/scenarios/#{scenario}")
    end
    execute_after_script
end