Class: Outback::Command
- Inherits:
-
Object
- Object
- Outback::Command
- Defined in:
- lib/outback/command.rb
Instance Method Summary collapse
-
#initialize(script) ⇒ Command
constructor
A new instance of Command.
- #parse(script) ⇒ Object
- #run(command) ⇒ Object
Constructor Details
Instance Method Details
#parse(script) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/outback/command.rb', line 10 def parse( script ) script.each_line do |l| out, back = l[/^([^\^]+)\s*\^\s*(.+)$/] p "o:", out, "b:", back if out and back p out, back t = Task.new("temp") t.rollout { |t| t.sys out } t.rollback { |t| t.sys back } @manager.tasks << t end end end |
#run(command) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/outback/command.rb', line 24 def run( command ) raise %{Command "#{command}" not understood.} unless [:rollout, :rollback].include? command #@manager.tasks.each #@manager.send(command) end |