Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactored to use same option setup

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-pre-release@5654 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 25d7ea8ad20d7753d6c6f33fd26495d98b89d023 1 parent 91cd889
@dhh dhh authored
Showing with 11 additions and 6 deletions.
  1. +11 −6 railties/lib/commands/servers/mongrel.rb
View
17 railties/lib/commands/servers/mongrel.rb
@@ -32,8 +32,16 @@
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 @@
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
Please sign in to comment.
Something went wrong with that request. Please try again.