Class: MinionServer
- Inherits:
-
Object
- Object
- MinionServer
- Defined in:
- lib/minion_server.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Method Summary collapse
-
#initialize(app) ⇒ MinionServer
constructor
A new instance of MinionServer.
- #shutdown ⇒ Object
- #start(host = "localhost", port = 4000, options = {}) ⇒ Object
Constructor Details
#initialize(app) ⇒ MinionServer
Returns a new instance of MinionServer.
7 8 9 |
# File 'lib/minion_server.rb', line 7 def initialize(app) @app = app end |
Instance Method Details
#shutdown ⇒ Object
34 35 36 37 38 |
# File 'lib/minion_server.rb', line 34 def shutdown #puts "== Stopping #{@app.inspect}\n\n" Process.kill(:INT, @pid_server) # send ctrl+c to webrick Process.waitpid(@pid_server) # waiting his life go to void ... end |
#start(host = "localhost", port = 4000, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/minion_server.rb', line 11 def start(host = "localhost", port = 4000, = {}) #puts "== Starting #{@app.inspect}" @pid_server = fork do = { :app => @app, :server => 'webrick', :environment => :none, :daemonize => false, :Host => host, :Port => port } if [:mute] [:Logger] = Logger.new("/dev/null") [:AccessLog] = [nil, nil] end Rack::Server.start() end wait_for_service(host, port) self end |