Added that you can change the web server port in config/lighttpd.conf from...

Added that you can change the web server port in config/lighttpd.conf from script/server --port/-p (closes #5465) [mats@imediatec.co.uk]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4676 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 4699c336
*SVN*
* Added that you can change the web server port in config/lighttpd.conf from script/server --port/-p #5465 [mats@imediatec.co.uk]
* script/performance/profiler compatibility with the new ruby-prof, including an option to choose the results printer. #5679 [shugo@ruby-lang.org]
* Fixed the failsafe response so it uses either the current recognized controller or ApplicationController. [Rick Olson]
......
......@@ -18,8 +18,10 @@
require 'optparse'
detach = false
user_defined_active_port = nil
ARGV.options do |opt|
opt.on("-p", "--port=port", "Changes the server.port number in the config/lighttpd.conf") { |port| command_line_port = port }
opt.on('-c', "--config=#{config_file}", 'Specify a different lighttpd config file.') { |path| config_file = path }
opt.on('-h', '--help', 'Show this message.') { puts opt; exit 0 }
opt.on('-d', '-d', 'Call with -d to detach') { detach = true; puts "=> Configuration in config/lighttpd.conf" }
......@@ -41,6 +43,21 @@
FileUtils.cp(source, config_file)
end
# open the config/lighttpd.conf file and add the current user defined port setting to it
if command_line_port
File.open(config_file, 'r+') do |config|
lines = config.readlines
lines.each do |line|
line.gsub!(/^\s*server.port\s*=\s*(\d+)/, "server.port = #{command_line_port}")
end
config.rewind
config.print(lines)
config.truncate(config.pos)
end
end
config = IO.read(config_file)
default_port, default_ip = 3000, '0.0.0.0'
port = config.scan(/^\s*server.port\s*=\s*(\d+)/).first rescue default_port
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册