Class: Dragon::CommandRunner
- Inherits:
-
Object
- Object
- Dragon::CommandRunner
- Defined in:
- lib/dragon/command_runner.rb
Instance Method Summary collapse
-
#initialize(boxes) ⇒ CommandRunner
constructor
A new instance of CommandRunner.
- #run(commands) ⇒ Object
Constructor Details
#initialize(boxes) ⇒ CommandRunner
Returns a new instance of CommandRunner.
4 5 6 |
# File 'lib/dragon/command_runner.rb', line 4 def initialize( boxes ) @boxes = boxes end |
Instance Method Details
#run(commands) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dragon/command_runner.rb', line 8 def run commands commands.each{|c,i| name = c.keys[0] args = c[name] puts "runnning: #{ name } #{ args }" unless args.empty? ran = @boxes.send( name.to_sym, args ) else ran = @boxes.send( name.to_sym ) end puts " output: #{ ran.stdout }" if ran.respond_to? :stdout } rescue Rye::Err => e puts e. end |