mirror of
https://github.com/github/rails.git
synced 2026-01-30 00:38:00 -05:00
Refactored to use same option setup
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5654 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -32,8 +32,16 @@ end
|
||||
|
||||
puts "=> Rails application starting on http://#{OPTIONS[:ip]}:#{OPTIONS[:port]}"
|
||||
|
||||
parameters = [
|
||||
"start",
|
||||
"-p", OPTIONS[:port].to_s,
|
||||
"-a", OPTIONS[:ip].to_s,
|
||||
"-e", OPTIONS[:environment],
|
||||
"-P", "#{RAILS_ROOT}/tmp/pids/mongrel.pid"
|
||||
]
|
||||
|
||||
if OPTIONS[:detach]
|
||||
`mongrel_rails start -d -p #{OPTIONS[:port]} -a #{OPTIONS[:ip]} -e #{OPTIONS[:environment]} -P #{RAILS_ROOT}/tmp/pids/mongrel.pid`
|
||||
`mongrel_rails #{parameters.join(" ")} -d`
|
||||
else
|
||||
ENV["RAILS_ENV"] = OPTIONS[:environment]
|
||||
RAILS_ENV.replace(OPTIONS[:environment]) if defined?(RAILS_ENV)
|
||||
@@ -43,15 +51,12 @@ else
|
||||
|
||||
puts "=> Call with -d to detach"
|
||||
puts "=> Ctrl-C to shutdown server"
|
||||
tail_thread = tail(Pathname.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log").cleanpath)
|
||||
tail_thread = tail(Pathname.new("#{File.expand_path(RAILS_ROOT)}/log/#{RAILS_ENV}.log").cleanpath)
|
||||
|
||||
trap(:INT) { exit }
|
||||
|
||||
begin
|
||||
silence_warnings do
|
||||
ARGV = [ "start", "-p", OPTIONS[:port].to_s, "-a", OPTIONS[:ip].to_s, "-e", OPTIONS[:environment] ]
|
||||
end
|
||||
|
||||
silence_warnings { ARGV = parameters }
|
||||
load("mongrel_rails")
|
||||
ensure
|
||||
tail_thread.kill if tail_thread
|
||||
|
||||
Reference in New Issue
Block a user