Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

root/trunk/railties/lib/commands/server.rb

Revision 8511, 0.9 kB (checked in by bitsweat, 2 years ago)

Don't make new_mongrel server default yet

Line 
1 require 'active_support'
2 require 'fileutils'
3
4 begin
5   require_library_or_gem 'fcgi'
6 rescue Exception
7   # FCGI not available
8 end
9
10 begin
11   require_library_or_gem 'mongrel'
12 rescue Exception
13   # Mongrel not available
14 end
15
16 server = case ARGV.first
17   when "lighttpd", "mongrel", "new_mongrel", "webrick"
18     ARGV.shift
19   else
20     if defined?(Mongrel)
21       "mongrel"
22     elsif RUBY_PLATFORM !~ /(:?mswin|mingw)/ && !silence_stderr { `lighttpd -version` }.blank? && defined?(FCGI)
23       "lighttpd"
24     else
25       "webrick"
26     end
27 end
28
29 case server
30   when "webrick"
31     puts "=> Booting WEBrick..."
32   when "lighttpd"
33     puts "=> Booting lighttpd (use 'script/server webrick' to force WEBrick)"
34   when "mongrel", "new_mongrel"
35     puts "=> Booting Mongrel (use 'script/server webrick' to force WEBrick)"
36 end
37
38 %w(cache pids sessions sockets).each { |dir_to_make| FileUtils.mkdir_p(File.join(RAILS_ROOT, 'tmp', dir_to_make)) }
39 require "commands/servers/#{server}"
Note: See TracBrowser for help on using the browser.