Module: Rack::Handler::Jubilee

Defined in:
lib/rack/handler/jubilee.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :Host => '0.0.0.0',
  :Port => 3000,
  :Verbose => false
}

Class Method Summary collapse

Class Method Details

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

Yields:

  • (@server)


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rack/handler/jubilee.rb', line 13

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

  if options[:Verbose]
    app = Rack::CommonLogger.new(app, STDOUT)
  end

  if options[:environment]
    ENV["RACK_ENV"] = options[:environment].to_s
  end

  @server = ::Jubilee::Server.new(app, options)

  puts "Jubilee #{::Jubilee::Const::JUBILEE_VERSION} starting..."
  puts "* Environment: #{ENV['RACK_ENV']}"
  puts "* Listening on http://#{options[:Host]}:#{options[:Port]}"

  yield @server if block_given?

  @server.start
end

.shutdownObject



35
36
37
38
# File 'lib/rack/handler/jubilee.rb', line 35

def self.shutdown
  @server.stop
  exit
end