Browse files

Generate a config.ru stub

  • Loading branch information...
1 parent f14ad41 commit 382870f763d8f51a49d3379cf5f3e93d59ab1abf @josh josh committed Sep 26, 2009
View
21 railties/lib/rails/commands/server.rb
@@ -60,21 +60,16 @@
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?
View
1 railties/lib/rails/generators/rails/app/app_generator.rb
@@ -56,6 +56,7 @@ def create_root
def create_root_files
copy_file "Rakefile"
copy_file "README"
+ copy_file "config.ru"
end
def create_app_files
View
2 railties/lib/rails/generators/rails/app/templates/config.ru
@@ -0,0 +1,2 @@
+require File.dirname(__FILE__) + '/config/environment'
+run ActionController::Dispatcher.new

0 comments on commit 382870f

Please sign in to comment.