Class: HelloGoodbye::ManagerConsole
- Defined in:
- lib/hello_goodbye/consoles/manager_console.rb
Instance Attribute Summary
Attributes inherited from Console
Instance Method Summary collapse
Methods inherited from Console
get, #receive_data, #send_response
Instance Method Details
#receive_command(command) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/hello_goodbye/consoles/manager_console.rb', line 3 def receive_command(command) case command when /^start / id = command.gsub(/^start /, "") if (started_foremen = self.foreman.trigger_foreman(:start, id)) send_response :success => true, :message => "ok", :results => started_foremen else send_response :success => false, :message => "no match for foreman '#{id}'" end return true when /^stop / id = command.gsub(/^stop /, "") if (stopped_foremen = self.foreman.trigger_foreman(:stop,id)) send_response :success => true, :message => "ok", :results => stopped_foremen else send_response :success => false, :message => "no match for foreman '#{id}'" end return true when "foremen" send_response :success => true, :message => "ok", :results => self.foreman.report return true end super end |