aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/commands/server.rb8
-rw-r--r--railties/lib/commands/servers/mongrel.rb9
3 files changed, 14 insertions, 5 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index 1a8f3d4b2a..507b3a0219 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Mongrel: script/server works on Win32. #5499 [jeremydurham@gmail.com]
+
* Remove opts.on { |options[:option_name] } style hash assignment. Closes #4440. [nicksieger@gmail.com]
* Mongrel support for script/server. #5475 [jeremydurham@gmail.com]
diff --git a/railties/lib/commands/server.rb b/railties/lib/commands/server.rb
index 1a8d3fd29d..c61a4388d5 100644
--- a/railties/lib/commands/server.rb
+++ b/railties/lib/commands/server.rb
@@ -7,13 +7,19 @@ rescue Exception
# FCGI not available
end
+begin
+ require_library_or_gem 'mongrel'
+rescue Exception
+ # Mongrel not available
+end
+
server = case ARGV.first
when "lighttpd", "mongrel", "webrick"
ARGV.shift
else
if RUBY_PLATFORM !~ /mswin/ && !silence_stderr { `lighttpd -version` }.blank? && defined?(FCGI)
"lighttpd"
- elsif !silence_stderr { `mongrel_rails -v` }.blank?
+ elsif defined?(Mongrel)
"mongrel"
else
"webrick"
diff --git a/railties/lib/commands/servers/mongrel.rb b/railties/lib/commands/servers/mongrel.rb
index 6d42316ba2..b46923eb8f 100644
--- a/railties/lib/commands/servers/mongrel.rb
+++ b/railties/lib/commands/servers/mongrel.rb
@@ -1,6 +1,6 @@
require 'rbconfig'
-unless RUBY_PLATFORM !~ /mswin/ && !silence_stderr { `mongrel_rails` }.blank?
+unless defined?(Mongrel)
puts "PROBLEM: Mongrel is not available on your system (or not in your path)"
exit 1
end
@@ -11,11 +11,11 @@ detach = false
ip = nil
port = nil
-ARGV.options do |opt|
+ARGV.clone.options do |opt|
opt.on("-p", "--port=port", Integer,
"Runs Rails on the specified port.",
"Default: 3000") { |p| port = p }
- opt.on("-b", "--binding=ip", String,
+ opt.on("-a", "--binding=ip", String,
"Binds Rails to the specified ip.",
"Default: 0.0.0.0") { |i| ip = i }
opt.on('-h', '--help', 'Show this message.') { puts opt; exit 0 }
@@ -37,7 +37,8 @@ trap(:INT) { exit }
tail_thread = nil
begin
- `mongrel_rails start #{detach ? "-d " : ""} -p #{port || default_port} -a #{ip || default_ip}`
+ ARGV.unshift("start")
+ load 'mongrel_rails'
ensure
unless detach
tail_thread.kill if tail_thread