141: def rails(options={})
142:
143: return @rails_handler if @rails_handler
144:
145: ops = resolve_defaults(options)
146:
147:
148: ops[:environment] ||= "development"
149: ops[:docroot] ||= "public"
150: ops[:mime] ||= {}
151:
152:
153: $orig_dollar_quote = $".clone
154: ENV['RAILS_ENV'] = ops[:environment]
155: env_location = "#{ops[:cwd]}/config/environment"
156: require env_location
157: require 'dispatcher'
158: require 'mongrel/rails'
159:
160: if ActionController::Base.allow_concurrency
161: log "[RAILS] ActionController::Base.allow_concurrency is true. Wow, you're very brave."
162: end
163: @rails_handler = RailsHandler.new(ops[:docroot], ops[:mime])
164: end