1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Try to guess application's directory while trying to run the server, but only if config.ru is not present in current dir

This commit is contained in:
Piotr Sarnacki 2010-09-29 22:31:58 +02:00
parent 3049e645e5
commit 9f569c60ad

View file

@ -33,8 +33,13 @@ when 'console'
Rails::Console.start(Rails.application)
when 'server'
# try to guess application's path if there is no config.ru file in current dir
# it allows to run script/rails server from other directories
Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exists?(File.expand_path("config.ru"))
require 'rails/commands/server'
Rails::Server.new.tap { |server|
# we need to require application after the server sets environment
require APP_PATH
Dir.chdir(Rails.application.root)
server.start