提交 16846553 编写于 作者: J José Valim

Always load the environment before executing any command. [#3905 status:resolved]

上级 4840acd4
# 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'
......@@ -30,19 +30,17 @@
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 @@
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'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册