Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4676

Show
Ignore:
Timestamp:
08/05/06 22:11:24 (2 years ago)
Author:
david
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/railties/CHANGELOG

    r4673 r4676  
    11*SVN* 
     2 
     3* Added that you can change the web server port in config/lighttpd.conf from script/server --port/-p #5465 [mats@imediatec.co.uk] 
    24 
    35* script/performance/profiler compatibility with the new ruby-prof, including an option to choose the results printer.  #5679 [shugo@ruby-lang.org] 
  • trunk/railties/lib/commands/servers/lighttpd.rb

    r4506 r4676  
    1919 
    2020detach = false 
     21user_defined_active_port = nil 
    2122 
    2223ARGV.options do |opt| 
     24  opt.on("-p", "--port=port", "Changes the server.port number in the config/lighttpd.conf") { |port| command_line_port = port } 
    2325  opt.on('-c', "--config=#{config_file}", 'Specify a different lighttpd config file.') { |path| config_file = path } 
    2426  opt.on('-h', '--help', 'Show this message.') { puts opt; exit 0 } 
     
    4042 
    4143  FileUtils.cp(source, config_file) 
     44end 
     45 
     46# open the config/lighttpd.conf file and add the current user defined port setting to it 
     47if command_line_port 
     48  File.open(config_file, 'r+') do |config| 
     49    lines = config.readlines 
     50 
     51    lines.each do |line| 
     52      line.gsub!(/^\s*server.port\s*=\s*(\d+)/, "server.port = #{command_line_port}") 
     53    end 
     54 
     55    config.rewind 
     56    config.print(lines) 
     57    config.truncate(config.pos) 
     58  end 
    4259end 
    4360