Module: Sinatra::MoreServer::Unicorn
- Defined in:
- lib/sinatra/more_server/unicorn.rb
Overview
Rack Handler to use Unicorn for Sinatra::Base.run!
Class Method Summary collapse
Class Method Details
.run(app, options = {}) {|server| ... } ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/sinatra/more_server/unicorn.rb', line 10 def self.run(app, ={}) app = Rack::Builder.new do # TODO: env dependend stuff. use Rack::CommonLogger, $stderr use Rack::ShowExceptions run app end.to_app [:Backend] ||= ::Unicorn [:Host] ||= ::Unicorn::Const::DEFAULT_HOST [:Port] ||= ::Unicorn::Const::DEFAULT_PORT [:listeners] = ["#{.delete :Host}:#{.delete :Port}"] server = .delete(:Backend)::HttpServer.new app, yield server if block_given? server.start.join end |