2005-11-07 10:25:36 +00:00
|
|
|
require 'active_support'
|
2006-03-26 03:29:09 +00:00
|
|
|
require 'fileutils'
|
2005-11-07 10:25:36 +00:00
|
|
|
|
2005-11-07 13:31:19 +00:00
|
|
|
begin
|
2005-11-07 15:35:03 +00:00
|
|
|
require_library_or_gem 'fcgi'
|
2005-11-07 13:31:19 +00:00
|
|
|
rescue Exception
|
|
|
|
# FCGI not available
|
|
|
|
end
|
|
|
|
|
2006-06-28 23:41:29 +00:00
|
|
|
begin
|
|
|
|
require_library_or_gem 'mongrel'
|
|
|
|
rescue Exception
|
|
|
|
# Mongrel not available
|
|
|
|
end
|
|
|
|
|
2008-06-25 21:40:00 +00:00
|
|
|
begin
|
|
|
|
require_library_or_gem 'thin'
|
|
|
|
rescue Exception
|
|
|
|
# Thin not available
|
|
|
|
end
|
|
|
|
|
2005-11-07 10:25:36 +00:00
|
|
|
server = case ARGV.first
|
2008-11-22 20:10:50 +00:00
|
|
|
when "mongrel", "webrick", "thin"
|
2005-11-07 10:25:36 +00:00
|
|
|
ARGV.shift
|
|
|
|
else
|
2008-07-19 16:42:27 +00:00
|
|
|
if defined?(Mongrel)
|
2007-12-29 19:43:39 +00:00
|
|
|
"mongrel"
|
2008-07-19 16:42:27 +00:00
|
|
|
elsif defined?(Thin)
|
|
|
|
"thin"
|
2005-11-07 10:25:36 +00:00
|
|
|
else
|
|
|
|
"webrick"
|
|
|
|
end
|
2004-11-24 01:04:44 +00:00
|
|
|
end
|
|
|
|
|
2006-06-23 22:32:10 +00:00
|
|
|
case server
|
|
|
|
when "webrick"
|
|
|
|
puts "=> Booting WEBrick..."
|
2008-11-22 20:00:58 +00:00
|
|
|
when "mongrel"
|
2006-06-23 22:32:10 +00:00
|
|
|
puts "=> Booting Mongrel (use 'script/server webrick' to force WEBrick)"
|
2008-06-25 21:40:00 +00:00
|
|
|
when "thin"
|
|
|
|
puts "=> Booting Thin (use 'script/server webrick' to force WEBrick)"
|
2005-11-07 10:25:36 +00:00
|
|
|
end
|
2005-02-20 23:04:42 +00:00
|
|
|
|
2006-09-13 23:25:02 +00:00
|
|
|
%w(cache pids sessions sockets).each { |dir_to_make| FileUtils.mkdir_p(File.join(RAILS_ROOT, 'tmp', dir_to_make)) }
|
2006-03-12 17:04:33 +00:00
|
|
|
require "commands/servers/#{server}"
|