Class: Picnic::Server::Base

Inherits:
Camping::Server::Base
  • Object
show all
Defined in:
lib/picnic/server.rb

Instance Method Summary collapse

Instance Method Details

#startObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/picnic/server.rb', line 5

def start
  handler, conf = case @conf.server
  when "console"
    ARGV.clear
    IRB.start
    exit
  when "mongrel"
    prep_mongrel
  when "webrick"
    prep_webrick
  end
  
  rapp =  apps.first

  if @conf.uri_path
    rapp = Rack::URLMap.new(@conf.uri_path => rapp)
  end
  
  rapp = Rack::Static.new(rapp, @conf[:static]) if @conf[:static]
  rapp = Rack::ContentLength.new(rapp)
  rapp = FixContentLength.new(rapp)
  rapp = Rack::Lint.new(rapp)
  rapp = Camping::Server::XSendfile.new(rapp)
  rapp = Rack::ShowExceptions.new(rapp)
  
  handler.run(rapp, conf) 
end