Class: VagrantPlugins::DevCommands::Runner::Chain

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/devcommands/runner/chain.rb

Overview

Chain runner

Constant Summary collapse

UTIL =
VagrantPlugins::DevCommands::Util

Instance Method Summary collapse

Constructor Details

#initialize(plugin, argv, env, registry) ⇒ Chain

Returns a new instance of Chain.



10
11
12
13
14
15
# File 'lib/vagrant/devcommands/runner/chain.rb', line 10

def initialize(plugin, argv, env, registry)
  @plugin   = plugin
  @argv     = argv
  @env      = env
  @registry = registry
end

Instance Method Details

#run(chain) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/vagrant/devcommands/runner/chain.rb', line 17

def run(chain)
  retval = 0

  chain.commands.each do |command_def|
    runnable      = runnable_for(command_def)
    runnable_argv = argv_for(command_def)

    runner = Command.new(@plugin, runnable_argv, @env, @registry)
    retval = runner.run(runnable)

    break if retval.nonzero? && chain.break_on_error?
  end

  retval
end