aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/commands.rb')
-rw-r--r--railties/lib/rails/commands.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb
index 4240038673..6972e25b29 100644
--- a/railties/lib/rails/commands.rb
+++ b/railties/lib/rails/commands.rb
@@ -34,8 +34,12 @@ when 'c', 'console'
Rails::Console.start(Rails::Application)
when 's', 'server'
require 'rails/commands/server'
- Dir.chdir(ROOT_PATH)
- Rails::Server.start
+ # Initialize the server first, so environment options are set
+ server = Rails::Server.new
+ require APP_PATH
+
+ Dir.chdir(Rails::Application.root)
+ server.start
when 'db', 'dbconsole'
require 'rails/commands/dbconsole'
require APP_PATH
@@ -57,11 +61,7 @@ when 'plugin'
require 'rails/commands/plugin'
when 'runner'
require 'rails/commands/runner'
- require ENV_PATH
-
-when '--version', '-v'
- puts "Rails #{Rails::VERSION::STRING}"
when '--help', '-h'
puts HELP_TEXT
when '--version', '-v'
@@ -70,4 +70,4 @@ when '--version', '-v'
else
puts "Error: Command not recognized"
puts HELP_TEXT
-end \ No newline at end of file
+end