aboutsummaryrefslogblamecommitdiffstats
path: root/railties/lib/commands/server.rb
blob: 82a3e1083f257b3259bc7c1eefe5dd3e10749c18 (plain) (tree)
1
2
3
4
5
6
7
8
9
                        
                   
 
     
                               



                      





                        
                                                                                                   



                

   




                                                                           
 
                                                           
                                    
require 'active_support'
require 'fileutils'

begin
  require_library_or_gem 'fcgi'
rescue Exception
  # FCGI not available
end

server = case ARGV.first
  when "lighttpd"
    ARGV.shift
  when "webrick"
    ARGV.shift
  else
    if RUBY_PLATFORM !~ /mswin/ && !silence_stderr { `lighttpd -version` }.blank? && defined?(FCGI)
      "lighttpd"
    else
      "webrick"
    end
end

if server == "webrick"
  puts "=> Booting WEBrick..."
else
  puts "=> Booting lighttpd (use 'script/server webrick' to force WEBrick)"
end

FileUtils.mkdir_p(%w( tmp/sessions tmp/cache tmp/sockets ))
require "commands/servers/#{server}"