Generate a config.ru stub
This commit is contained in:
parent
f14ad41456
commit
382870f763
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
require File.dirname(__FILE__) + '/config/environment'
|
||||
run ActionController::Dispatcher.new
|
Loading…
Reference in New Issue