Class: Rack::Handler::Reel

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/handler/reel.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :Host    => "0.0.0.0",
  :Port    => 3000,
  :quiet   => false
}

Class Method Summary collapse

Class Method Details

.run(app, options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rack/handler/reel.rb', line 12

def self.run(app, options = {})
  options = DEFAULT_OPTIONS.merge(options)

  app = Rack::CommonLogger.new(app, STDOUT) unless options[:quiet]
  ENV['RACK_ENV'] = options[:environment].to_s if options[:environment]

  supervisor = ::Reel::Rack::Server.supervise_as(:reel_rack_server, app, options)

  begin
    sleep
  rescue Interrupt
    Celluloid.logger.info "Interrupt received... shutting down"
    supervisor.terminate
  end
end