提交 0e146d54 编写于 作者: J Jeremy Kemper

Mongrel: script/server works on Win32. Closes #5499.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4504 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 a0927495
*SVN* *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] * Remove opts.on { |options[:option_name] } style hash assignment. Closes #4440. [nicksieger@gmail.com]
* Mongrel support for script/server. #5475 [jeremydurham@gmail.com] * Mongrel support for script/server. #5475 [jeremydurham@gmail.com]
......
...@@ -7,13 +7,19 @@ ...@@ -7,13 +7,19 @@
# FCGI not available # FCGI not available
end end
begin
require_library_or_gem 'mongrel'
rescue Exception
# Mongrel not available
end
server = case ARGV.first server = case ARGV.first
when "lighttpd", "mongrel", "webrick" when "lighttpd", "mongrel", "webrick"
ARGV.shift ARGV.shift
else else
if RUBY_PLATFORM !~ /mswin/ && !silence_stderr { `lighttpd -version` }.blank? && defined?(FCGI) if RUBY_PLATFORM !~ /mswin/ && !silence_stderr { `lighttpd -version` }.blank? && defined?(FCGI)
"lighttpd" "lighttpd"
elsif !silence_stderr { `mongrel_rails -v` }.blank? elsif defined?(Mongrel)
"mongrel" "mongrel"
else else
"webrick" "webrick"
......
require 'rbconfig' 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)" puts "PROBLEM: Mongrel is not available on your system (or not in your path)"
exit 1 exit 1
end end
...@@ -11,11 +11,11 @@ ...@@ -11,11 +11,11 @@
ip = nil ip = nil
port = nil port = nil
ARGV.options do |opt| ARGV.clone.options do |opt|
opt.on("-p", "--port=port", Integer, opt.on("-p", "--port=port", Integer,
"Runs Rails on the specified port.", "Runs Rails on the specified port.",
"Default: 3000") { |p| port = p } "Default: 3000") { |p| port = p }
opt.on("-b", "--binding=ip", String, opt.on("-a", "--binding=ip", String,
"Binds Rails to the specified ip.", "Binds Rails to the specified ip.",
"Default: 0.0.0.0") { |i| ip = i } "Default: 0.0.0.0") { |i| ip = i }
opt.on('-h', '--help', 'Show this message.') { puts opt; exit 0 } opt.on('-h', '--help', 'Show this message.') { puts opt; exit 0 }
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
tail_thread = nil tail_thread = nil
begin begin
`mongrel_rails start #{detach ? "-d " : ""} -p #{port || default_port} -a #{ip || default_ip}` ARGV.unshift("start")
load 'mongrel_rails'
ensure ensure
unless detach unless detach
tail_thread.kill if tail_thread tail_thread.kill if tail_thread
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册