2007-01-22 14:43:50 +01:00
|
|
|
require 'active_support'
|
|
|
|
require 'fileutils'
|
|
|
|
|
|
|
|
begin
|
|
|
|
require_library_or_gem 'fcgi'
|
|
|
|
rescue Exception
|
|
|
|
# FCGI not available
|
|
|
|
end
|
|
|
|
|
2007-02-09 09:04:31 +01:00
|
|
|
begin
|
|
|
|
require_library_or_gem 'mongrel'
|
|
|
|
rescue Exception
|
|
|
|
# Mongrel not available
|
|
|
|
end
|
|
|
|
|
2007-01-22 14:43:50 +01:00
|
|
|
server = case ARGV.first
|
2008-05-18 06:22:34 +02:00
|
|
|
when "lighttpd", "mongrel", "new_mongrel", "webrick"
|
2007-01-22 14:43:50 +01:00
|
|
|
ARGV.shift
|
|
|
|
else
|
2007-02-09 09:04:31 +01:00
|
|
|
if defined?(Mongrel)
|
|
|
|
"mongrel"
|
2007-03-18 17:56:12 +01:00
|
|
|
elsif RUBY_PLATFORM !~ /(:?mswin|mingw)/ && !silence_stderr { `lighttpd -version` }.blank? && defined?(FCGI)
|
2007-01-22 14:43:50 +01:00
|
|
|
"lighttpd"
|
|
|
|
else
|
|
|
|
"webrick"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2007-02-09 09:04:31 +01:00
|
|
|
case server
|
|
|
|
when "webrick"
|
|
|
|
puts "=> Booting WEBrick..."
|
|
|
|
when "lighttpd"
|
|
|
|
puts "=> Booting lighttpd (use 'script/server webrick' to force WEBrick)"
|
2008-05-18 06:22:34 +02:00
|
|
|
when "mongrel", "new_mongrel"
|
2007-02-09 09:04:31 +01:00
|
|
|
puts "=> Booting Mongrel (use 'script/server webrick' to force WEBrick)"
|
2007-01-22 14:43:50 +01:00
|
|
|
end
|
|
|
|
|
2007-02-09 09:04:31 +01:00
|
|
|
%w(cache pids sessions sockets).each { |dir_to_make| FileUtils.mkdir_p(File.join(RAILS_ROOT, 'tmp', dir_to_make)) }
|
2007-01-22 14:43:50 +01:00
|
|
|
require "commands/servers/#{server}"
|