public
Rubygem
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-core.git
Search Repo:
ezmobius (author)
Sat May 03 18:21:08 -0700 2008
commit  76f58a0c22c40e3d86dc7fd7b4601abbfa0fa4d5
tree    37ee46b92802d5bc62ed1f7b2c607868a99cd6d8
parent  770bf3caabf070769d14a0e26e4f1792cffa2737
merb-core / lib / merb-core / rack / adapter / mongrel.rb
100644 26 lines (23 sloc) 0.759 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require 'mongrel'
require 'merb-core/rack/handler/mongrel'
module Merb
 
  module Rack
 
    class Mongrel
      # start server on given host and port.
      
      # ==== Parameters
      # opts<Hash>:: Options for Mongrel (see below).
      #
      # ==== Options (opts)
      # :host<String>:: The hostname that Mongrel should serve.
      # :port<Fixnum>:: The port Mongrel should bind to.
      # :app<String>>:: The application name.
      def self.start(opts={})
        Merb.logger.warn!("Using Mongrel adapter")
        server = ::Mongrel::HttpServer.new(opts[:host], opts[:port].to_i)
        Merb::Server.change_privilege
        server.register('/', ::Merb::Rack::Handler::Mongrel.new(opts[:app]))
        server.run.join
      end
    end
  end
end