Class: Picnic::Server::Base

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

Instance Method Summary collapse

Instance Method Details

#appObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/picnic/server.rb', line 26

def app
  reload!
   
  rapp =  apps.values.first

  rapp = Rack::Static.new(rapp, @conf[:static]) if @conf[:static]

  if @conf.uri_path
    rapp = Rack::URLMap.new(@conf.uri_path => rapp)
  end

  rapp = Rack::ContentLength.new(rapp)
  rapp = Rack::Lint.new(rapp)
  rapp = Camping::Server::XSendfile.new(rapp)
  rapp = Rack::ShowExceptions.new(rapp)
end

#startObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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

  # preload the apps in order to show any startup errors when
  # the app is run from the command line (otherwise they would only
  # show up after the first request to the web server)
  reload!
        
  handler.run(self, conf) 
end