diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-11-07 10:25:36 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-11-07 10:25:36 +0000 |
commit | 5ca8b5fca42ca09bdaadfc7c985fbec9c2fbafa5 (patch) | |
tree | 11a05e7ef113a42c1c6f7117399332d0ae389e44 /railties/lib/commands/lighttpd.rb | |
parent | 72add11c441c51de79a179438cb308d96aeaac76 (diff) | |
download | rails-5ca8b5fca42ca09bdaadfc7c985fbec9c2fbafa5.tar.gz rails-5ca8b5fca42ca09bdaadfc7c985fbec9c2fbafa5.tar.bz2 rails-5ca8b5fca42ca09bdaadfc7c985fbec9c2fbafa5.zip |
Added default lighttpd config in config/lighttpd.conf and added a default runner for lighttpd in script/server (works like script/server, but using lighttpd and FastCGI). It will use lighttpd if available, otherwise WEBrick. You can force either or using 'script/server lighttpd' or 'script/server webrick' [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2912 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/commands/lighttpd.rb')
-rw-r--r-- | railties/lib/commands/lighttpd.rb | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/railties/lib/commands/lighttpd.rb b/railties/lib/commands/lighttpd.rb deleted file mode 100644 index df6ad663f9..0000000000 --- a/railties/lib/commands/lighttpd.rb +++ /dev/null @@ -1,45 +0,0 @@ -require 'active_support' - -unless RUBY_PLATFORM !~ /mswin/ && !silence_stderr { `lighttpd -version` }.blank? - puts "lighttpd is not available on your system (or not in your path)" - exit 1 -end - -def tail_f(input) - loop do - line = input.gets - yield line if line - if input.eof? - sleep 1 - input.seek(input.tell) - end - end -end - -config_file = "#{RAILS_ROOT}/config/lighttpd.conf" - -port = IO.read(config_file).scan(/^server.port\s*=\s*(\d+)/).first rescue 3000 -puts "=> Rails application started on http://0.0.0.0:#{port}" - -if ARGV.first == "-d" - puts "=> Configure in config/lighttpd.conf" - detach = true -else - puts "=> Call with -d to detach (requires absolute paths in config/lighttpd.conf)" - puts "=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)" - detach = false - - Process.detach(fork do - begin - File.open("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", 'r') do |log| - log.seek(0, IO::SEEK_END) - tail_f(log) {|line| puts line} - end - rescue Exception - end - exit - end) -end - -trap(:INT) {exit} -`lighttpd #{!detach ? "-D " : ""}-f #{config_file}` |