Module: Innate::Adapter
- Includes:
- Optioned
- Defined in:
- /home/manveru/github/ramaze/ramaze.net/tmp/git/innate/lib/innate/adapter.rb
Overview
Lightweight wrapper around Rack::Handler, will apply our options in a unified manner and deal with adapters that don't like to do what we want or where Rack doesn't want to take a stand.
Rack handlers as of 2009.03.25: cgi, fastcgi, mongrel, emongrel, smongrel, webrick, lsws, scgi, thin
Class Method Summary (collapse)
-
+ (Object) start(app, given_options = nil)
Pass given app to the Handler, handler is chosen based on config.adapter option.
-
+ (Object) start_ebb(app, config)
Due to buggy autoload on Ruby 1.8 we have to require 'ebb' manually.
-
+ (Object) start_thin(app, config)
Thin shouldn't give excessive output, especially not to $stdout.
-
+ (Object) start_unicorn(app, config)
A simple Unicorn wrapper.
-
+ (Object) start_webrick(app, config)
We want webrick to use our logger.
Methods included from Optioned
Class Method Details
+ (Object) start(app, given_options = nil)
Pass given app to the Handler, handler is chosen based on config.adapter option. If there is a method named start_name_of_adapter it will be run instead of the default run method of the handler, this makes it easy to define custom startup of handlers for your server of choice.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File '/home/manveru/github/ramaze/ramaze.net/tmp/git/innate/lib/innate/adapter.rb', line 36 def self.start(app, = nil) .merge!() if handler = [:handler].to_s.downcase config = { :Host => [:host], :Port => [:port] } Log.debug "Using #{handler}" if respond_to?(method = "start_#{handler}") send(method, app, config) else Rack::Handler.get(handler).run(app, config) end end |
+ (Object) start_ebb(app, config)
Due to buggy autoload on Ruby 1.8 we have to require 'ebb' manually. This most likely happens because autoload doesn't respect the require of rubygems and uses the C require directly.
54 55 56 57 |
# File '/home/manveru/github/ramaze/ramaze.net/tmp/git/innate/lib/innate/adapter.rb', line 54 def self.start_ebb(app, config) require 'ebb' Rack::Handler.get('ebb').run(app, config) end |
+ (Object) start_thin(app, config)
Thin shouldn't give excessive output, especially not to $stdout
72 73 74 75 76 |
# File '/home/manveru/github/ramaze/ramaze.net/tmp/git/innate/lib/innate/adapter.rb', line 72 def self.start_thin(app, config) handler = Rack::Handler.get('thin') ::Thin::Logging.silent = true handler.run(app, config) end |
+ (Object) start_unicorn(app, config)
A simple Unicorn wrapper.
79 80 81 82 83 84 85 |
# File '/home/manveru/github/ramaze/ramaze.net/tmp/git/innate/lib/innate/adapter.rb', line 79 def self.start_unicorn(app, config) require 'unicorn' config = { :listeners => ["#{config[:Host]}:#{config[:Port]}"] } ::Unicorn.run(app, config) end |
+ (Object) start_webrick(app, config)
We want webrick to use our logger.
60 61 62 63 64 65 66 67 68 69 |
# File '/home/manveru/github/ramaze/ramaze.net/tmp/git/innate/lib/innate/adapter.rb', line 60 def self.start_webrick(app, config) handler = Rack::Handler.get('webrick') config = { :BindAddress => config[:Host], :Port => config[:Port], :Logger => Log, } handler.run(app, config) end |