diff options
author | José Valim <jose.valim@gmail.com> | 2010-03-12 12:53:22 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-03-12 12:53:22 +0100 |
commit | 16846553b8866eab2aa3b128a2a23a221a25f7e3 (patch) | |
tree | bc396157d90d872d8677e8475e36bd3aa0f7c2ee /railties/lib | |
parent | 4840acd485a4a6bcdd73338447af7e1340587e54 (diff) | |
download | rails-16846553b8866eab2aa3b128a2a23a221a25f7e3.tar.gz rails-16846553b8866eab2aa3b128a2a23a221a25f7e3.tar.bz2 rails-16846553b8866eab2aa3b128a2a23a221a25f7e3.zip |
Always load the environment before executing any command. [#3905 status:resolved]
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/generators/rails/app/templates/script/rails | 7 | ||||
-rw-r--r-- | railties/lib/rails/commands.rb | 10 |
2 files changed, 6 insertions, 11 deletions
diff --git a/railties/lib/generators/rails/app/templates/script/rails b/railties/lib/generators/rails/app/templates/script/rails index b01d1ee183..199fe1a6d3 100644 --- a/railties/lib/generators/rails/app/templates/script/rails +++ b/railties/lib/generators/rails/app/templates/script/rails @@ -1,8 +1,5 @@ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. -ENV_PATH = File.expand_path('../../config/environment', __FILE__) -BOOT_PATH = File.expand_path('../../config/boot', __FILE__) -APP_PATH = File.expand_path('../../config/application', __FILE__) - -require BOOT_PATH +ENV_PATH = File.expand_path('../../config/environment', __FILE__) +require File.expand_path('../../config/boot', __FILE__) require 'rails/commands' diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb index 6972e25b29..d4558be00f 100644 --- a/railties/lib/rails/commands.rb +++ b/railties/lib/rails/commands.rb @@ -30,19 +30,17 @@ when 'g', 'generate' require 'rails/commands/generate' when 'c', 'console' require 'rails/commands/console' - require APP_PATH + require ENV_PATH Rails::Console.start(Rails::Application) when 's', 'server' require 'rails/commands/server' - # Initialize the server first, so environment options are set server = Rails::Server.new - require APP_PATH - + require ENV_PATH Dir.chdir(Rails::Application.root) server.start when 'db', 'dbconsole' require 'rails/commands/dbconsole' - require APP_PATH + require ENV_PATH Rails::DBConsole.start(Rails::Application) when 'application' @@ -57,7 +55,7 @@ when 'profiler' require ENV_PATH require 'rails/commands/performance/profiler' when 'plugin' - require APP_PATH + require ENV_PATH require 'rails/commands/plugin' when 'runner' require 'rails/commands/runner' |