aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/commands
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-12-01 12:21:18 -0600
committerJoshua Peek <josh@joshpeek.com>2008-12-01 12:21:18 -0600
commit61958032d3dbb8da8363d02ccda8933b99421fb1 (patch)
treedd52b4c4c42ce50f000457f721879abafe67b1c7 /railties/lib/commands
parent725928854d4b6ff5dbafc2bbc95cfade243411a9 (diff)
downloadrails-61958032d3dbb8da8363d02ccda8933b99421fb1.tar.gz
rails-61958032d3dbb8da8363d02ccda8933b99421fb1.tar.bz2
rails-61958032d3dbb8da8363d02ccda8933b99421fb1.zip
Generate rackup dispatcher with rails:update:generate_dispatchers
Diffstat (limited to 'railties/lib/commands')
-rw-r--r--railties/lib/commands/server.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/railties/lib/commands/server.rb b/railties/lib/commands/server.rb
index a4bb52592f..3611f80ed3 100644
--- a/railties/lib/commands/server.rb
+++ b/railties/lib/commands/server.rb
@@ -65,7 +65,6 @@ end
ENV["RAILS_ENV"] = options[:environment]
RAILS_ENV.replace(options[:environment]) if defined?(RAILS_ENV)
-require RAILS_ROOT + "/config/environment"
if File.exist?(options[:config])
config = options[:config]
@@ -74,20 +73,23 @@ if File.exist?(options[:config])
if cfgfile[/^#\\(.*)/]
opts.parse!($1.split(/\s+/))
end
- app = eval("Rack::Builder.new {( " + cfgfile + "\n )}.to_app", nil, config)
+ inner_app = eval("Rack::Builder.new {( " + cfgfile + "\n )}.to_app", nil, config)
else
require config
- app = Object.const_get(File.basename(config, '.rb').capitalize)
+ inner_app = Object.const_get(File.basename(config, '.rb').capitalize)
end
else
- app = Rack::Builder.new {
- use Rails::Rack::Logger
- use Rails::Rack::Static
- use Rails::Rack::Debugger if options[:debugger]
- run ActionController::Dispatcher.new
- }.to_app
+ require RAILS_ROOT + "/config/environment"
end
+inner_app = ActionController::Dispatcher.new
+app = Rack::Builder.new {
+ use Rails::Rack::Logger
+ use Rails::Rack::Static
+ use Rails::Rack::Debugger if options[:debugger]
+ run inner_app
+}.to_app
+
puts "=> Call with -d to detach"
trap(:INT) { exit }