Class: Hoof::ControlServer

Inherits:
EventMachine::Connection
  • Object
show all
Defined in:
lib/hoof/control_server.rb

Instance Method Summary collapse

Instance Method Details

#receive_data(data) ⇒ Object



4
5
6
7
8
9
# File 'lib/hoof/control_server.rb', line 4

def receive_data data
  puts "Comand #{data}"
  result = send data
  send_data result
  close_connection_after_writing
end

#statusObject



11
12
13
14
15
16
# File 'lib/hoof/control_server.rb', line 11

def status
  Hoof.pool.map do |(name, app)|
    status = app.running? ? "[\033[1;32mrunning\033[0m]" : "[\033[1;31mstopped\033[0m]"
    "  #{app.pid if app.running?}\t#{name}\t\t\t#{status}"
  end.join("\n")
end