Class: Outback::Command

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

Instance Method Summary collapse

Constructor Details

#initialize(script) ⇒ Command

Returns a new instance of Command.



5
6
7
8
# File 'lib/outback/command.rb', line 5

def initialize( script )
  @manager = Manager.new
  parse(script)
end

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