diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-09-25 21:10:00 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-09-25 21:10:00 -0500 |
commit | 382870f763d8f51a49d3379cf5f3e93d59ab1abf (patch) | |
tree | 330323af82362d829ea41de3b10b7960e154a04d /railties/lib | |
parent | f14ad4145622f45e9bf7433b5fdef4ce427efe4b (diff) | |
download | rails-382870f763d8f51a49d3379cf5f3e93d59ab1abf.tar.gz rails-382870f763d8f51a49d3379cf5f3e93d59ab1abf.tar.bz2 rails-382870f763d8f51a49d3379cf5f3e93d59ab1abf.zip |
Generate a config.ru stub
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/commands/server.rb | 21 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/app_generator.rb | 1 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config.ru | 2 |
3 files changed, 11 insertions, 13 deletions
diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb index 823916b1dc..54d512dd67 100644 --- a/railties/lib/rails/commands/server.rb +++ b/railties/lib/rails/commands/server.rb @@ -60,21 +60,16 @@ end ENV["RAILS_ENV"] = options[:environment] RAILS_ENV.replace(options[:environment]) if defined?(RAILS_ENV) -if File.exist?(options[:config]) - config = options[:config] - if config =~ /\.ru$/ - cfgfile = File.read(config) - if cfgfile[/^#\\(.*)/] - opts.parse!($1.split(/\s+/)) - end - inner_app = eval("Rack::Builder.new {( " + cfgfile + "\n )}.to_app", nil, config) - else - require config - inner_app = Object.const_get(File.basename(config, '.rb').capitalize) +config = options[:config] +if config =~ /\.ru$/ + cfgfile = File.read(config) + if cfgfile[/^#\\(.*)/] + opts.parse!($1.split(/\s+/)) end + inner_app = eval("Rack::Builder.new {( " + cfgfile + "\n )}.to_app", nil, config) else - require RAILS_ROOT + "/config/environment" - inner_app = ActionController::Dispatcher.new + require config + inner_app = Object.const_get(File.basename(config, '.rb').capitalize) end if options[:path].nil? diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 24c9a969f9..8d8f138dca 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -56,6 +56,7 @@ module Rails::Generators def create_root_files copy_file "Rakefile" copy_file "README" + copy_file "config.ru" end def create_app_files diff --git a/railties/lib/rails/generators/rails/app/templates/config.ru b/railties/lib/rails/generators/rails/app/templates/config.ru new file mode 100644 index 0000000000..30b00bfa1f --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/config.ru @@ -0,0 +1,2 @@ +require File.dirname(__FILE__) + '/config/environment' +run ActionController::Dispatcher.new |