Class: Tod::Runner

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

Instance Method Summary collapse

Constructor Details

#initialize(travis, executor: Executor.new, environment: ENV) ⇒ Runner

Returns a new instance of Runner.



6
7
8
9
10
# File 'lib/tod/runner.rb', line 6

def initialize(travis, executor: Executor.new, environment: ENV)
  @travis = travis
  @executor = executor
  @environment = environment
end

Instance Method Details

#run(section) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/tod/runner.rb', line 12

def run(section)

  setup_env

  @travis.section(section).each do |command|

    result = @executor.execute(command) { |line| puts line }

    if result.error?
      return result.code
    end

  end

  result_code = 0

end