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

Ticket #5004: lighttpd.rb.diff

File lighttpd.rb.diff, 2.3 kB (added by elliot@townx.org, 2 years ago)

Patch to allow passing of non-standard lighttpd locations to lighttpd.rb script

  • railties/lib/commands/servers/lighttpd.rb

    old new  
    11require 'rbconfig' 
    22 
    3 unless RUBY_PLATFORM !~ /mswin/ && !silence_stderr { `lighttpd -version` }.blank? 
    4   puts "PROBLEM: Lighttpd is not available on your system (or not in your path)" 
    5   exit 1 
    6 end 
    7  
    8 unless defined?(FCGI) 
    9   puts "PROBLEM: Lighttpd requires that the FCGI Ruby bindings are installed on the system" 
    10   exit 1 
    11 end 
    12  
    133require 'initializer' 
    144configuration = Rails::Initializer.run(:initialize_logger).configuration 
    155default_config_file = config_file = Pathname.new("#{RAILS_ROOT}/config/lighttpd.conf").cleanpath 
     
    188 
    199detach = false 
    2010 
     11lighttpd_modules = '' 
     12lighttpd_executable = 'lighttpd' 
     13 
    2114ARGV.options do |opt| 
    2215  opt.on('-c', "--config=#{config_file}", 'Specify a different lighttpd config file.') { |path| config_file = path } 
    2316  opt.on('-h', '--help', 'Show this message.') { puts opt; exit 0 } 
    2417  opt.on('-d', '-d', 'Call with -d to detach') { detach = true; puts "=> Configuration in config/lighttpd.conf" } 
     18  opt.on('-l', "--lighttpd_modules=path", 'Path to lighttpd modules (e.g. /opt/lightty/lib)') { |lighttpd_modules| } 
     19  opt.on('-e', "--lighttpd=path", 'Path to lighttpd executable (e.g. /opt/lightty/bin)') do |path| 
     20    lighttpd_executable = File.join(path, lighttpd_executable) 
     21  end 
    2522  opt.parse! 
    2623end 
    2724 
     25unless RUBY_PLATFORM !~ /mswin/ && !silence_stderr { `#{lighttpd_executable} -version` }.blank? 
     26  puts "PROBLEM: Lighttpd is not available on your system (or not in your path)" 
     27  exit 1 
     28end 
     29 
     30unless defined?(FCGI) 
     31  puts "PROBLEM: Lighttpd requires that the FCGI Ruby bindings are installed on the system" 
     32  exit 1 
     33end 
     34 
    2835unless File.exist?(config_file) 
    2936  if config_file != default_config_file 
    3037    puts "=> #{config_file} not found." 
     
    7582 
    7683begin 
    7784  `rake tmp:sockets:clear` # Needed if lighttpd crashes or otherwise leaves FCGI sockets around 
    78   `lighttpd #{!detach ? "-D " : ""}-f #{config_file}` 
     85  `#{lighttpd_executable} #{lighttpd_modules ? "-m #{lighttpd_modules}" : ""} #{!detach ? "-D " : ""}-f #{config_file}` 
    7986ensure 
    8087  unless detach 
    8188    tail_thread.kill if tail_thread