aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-11-30 22:22:02 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-11-30 22:22:02 +0000
commitcd2be89b7c6ba341d4a45cd1767509d4a3aedb70 (patch)
tree89d11a325534286bb037d3d871c36542321b1409
parent033a5148eb03a6b4a3441cdf0c4cbda357c6d702 (diff)
downloadrails-cd2be89b7c6ba341d4a45cd1767509d4a3aedb70.tar.gz
rails-cd2be89b7c6ba341d4a45cd1767509d4a3aedb70.tar.bz2
rails-cd2be89b7c6ba341d4a45cd1767509d4a3aedb70.zip
Refactored to use same option setup
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5654 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--railties/lib/commands/servers/mongrel.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/railties/lib/commands/servers/mongrel.rb b/railties/lib/commands/servers/mongrel.rb
index 63dd6bd71c..995274f9a0 100644
--- a/railties/lib/commands/servers/mongrel.rb
+++ b/railties/lib/commands/servers/mongrel.rb
@@ -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