Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
executable file 41 lines (33 sloc) 777 Bytes
#!/usr/bin/env ruby
require "hector/boot"
Hector.start
def stop
EventMachine.stop_event_loop
Hector.logger.info "Hector stopped"
end
def logger_level_name(level)
Logger.constants.find do |name|
Logger.const_get(name) == level
end
end
%w(INT QUIT TERM).each do |signal|
Signal.trap(signal) { stop }
end
Signal.trap("HUP") do
if @original_severity
Hector.logger.level = @original_severity
@original_severity = nil
else
@original_severity = Hector.logger.level
Hector.logger.level = Logger::DEBUG
end
Hector.logger.info "Logging #{logger_level_name(Hector.logger.level).downcase} messages"
end
run_method = if EventMachine.respond_to?(:synchrony)
:synchrony
else
:run
end
EventMachine.send(run_method) do
Hector.start_server
end
Something went wrong with that request. Please try again.