2005-11-07 05:25:36 -05:00
|
|
|
require 'active_support'
|
2006-03-25 22:29:09 -05:00
|
|
|
require 'fileutils'
|
2005-11-07 05:25:36 -05:00
|
|
|
|
2005-11-07 08:31:19 -05:00
|
|
|
begin
|
2005-11-07 10:35:03 -05:00
|
|
|
require_library_or_gem 'fcgi'
|
2005-11-07 08:31:19 -05:00
|
|
|
rescue Exception
|
|
|
|
# FCGI not available
|
|
|
|
end
|
|
|
|
|
2006-06-28 19:41:29 -04:00
|
|
|
begin
|
|
|
|
require_library_or_gem 'mongrel'
|
|
|
|
rescue Exception
|
|
|
|
# Mongrel not available
|
|
|
|
end
|
|
|
|
|
2005-11-07 05:25:36 -05:00
|
|
|
server = case ARGV.first
|
2006-06-23 18:32:10 -04:00
|
|
|
when "lighttpd", "mongrel", "webrick"
|
2005-11-07 05:25:36 -05:00
|
|
|
ARGV.shift
|
|
|
|
else
|
2006-06-28 20:57:54 -04:00
|
|
|
if defined?(Mongrel)
|
2006-06-23 18:32:10 -04:00
|
|
|
"mongrel"
|
2006-06-28 20:57:54 -04:00
|
|
|
elsif RUBY_PLATFORM !~ /mswin/ && !silence_stderr { `lighttpd -version` }.blank? && defined?(FCGI)
|
|
|
|
"lighttpd"
|
2005-11-07 05:25:36 -05:00
|
|
|
else
|
|
|
|
"webrick"
|
|
|
|
end
|
2004-11-23 20:04:44 -05:00
|
|
|
end
|
|
|
|
|
2006-06-23 18:32:10 -04:00
|
|
|
case server
|
|
|
|
when "webrick"
|
|
|
|
puts "=> Booting WEBrick..."
|
|
|
|
when "lighttpd"
|
|
|
|
puts "=> Booting lighttpd (use 'script/server webrick' to force WEBrick)"
|
|
|
|
when "mongrel"
|
|
|
|
puts "=> Booting Mongrel (use 'script/server webrick' to force WEBrick)"
|
2005-11-07 05:25:36 -05:00
|
|
|
end
|
2005-02-20 18:04:42 -05:00
|
|
|
|
2006-09-13 19:25:02 -04:00
|
|
|
%w(cache pids sessions sockets).each { |dir_to_make| FileUtils.mkdir_p(File.join(RAILS_ROOT, 'tmp', dir_to_make)) }
|
2006-03-12 12:04:33 -05:00
|
|
|
require "commands/servers/#{server}"
|