Ticket #5004: lighttpd.rb.diff
| File lighttpd.rb.diff, 2.3 kB (added by elliot@townx.org, 2 years ago) |
|---|
-
railties/lib/commands/servers/lighttpd.rb
old new 1 1 require 'rbconfig' 2 2 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 16 end7 8 unless defined?(FCGI)9 puts "PROBLEM: Lighttpd requires that the FCGI Ruby bindings are installed on the system"10 exit 111 end12 13 3 require 'initializer' 14 4 configuration = Rails::Initializer.run(:initialize_logger).configuration 15 5 default_config_file = config_file = Pathname.new("#{RAILS_ROOT}/config/lighttpd.conf").cleanpath … … 18 8 19 9 detach = false 20 10 11 lighttpd_modules = '' 12 lighttpd_executable = 'lighttpd' 13 21 14 ARGV.options do |opt| 22 15 opt.on('-c', "--config=#{config_file}", 'Specify a different lighttpd config file.') { |path| config_file = path } 23 16 opt.on('-h', '--help', 'Show this message.') { puts opt; exit 0 } 24 17 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 25 22 opt.parse! 26 23 end 27 24 25 unless 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 28 end 29 30 unless defined?(FCGI) 31 puts "PROBLEM: Lighttpd requires that the FCGI Ruby bindings are installed on the system" 32 exit 1 33 end 34 28 35 unless File.exist?(config_file) 29 36 if config_file != default_config_file 30 37 puts "=> #{config_file} not found." … … 75 82 76 83 begin 77 84 `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}` 79 86 ensure 80 87 unless detach 81 88 tail_thread.kill if tail_thread