Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Generate a config.ru stub

  • Loading branch information...
commit 382870f763d8f51a49d3379cf5f3e93d59ab1abf 1 parent f14ad41
Joshua Peek josh authored
21 railties/lib/rails/commands/server.rb
View
@@ -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?
1  railties/lib/rails/generators/rails/app/app_generator.rb
View
@@ -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
2  railties/lib/rails/generators/rails/app/templates/config.ru
View
@@ -0,0 +1,2 @@
+require File.dirname(__FILE__) + '/config/environment'
+run ActionController::Dispatcher.new
Please sign in to comment.
Something went wrong with that request. Please try again.