aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/rails-2.0.2/railties/lib/commands/server.rb
diff options
context:
space:
mode:
authorfrancis <francis>2008-01-23 01:48:14 +0000
committerfrancis <francis>2008-01-23 01:48:14 +0000
commit60eaae4f7df1f1dae91defb87d3707451c359cf4 (patch)
treee74835c37779a2f094e810960cda07b99a75330e /vendor/rails-2.0.2/railties/lib/commands/server.rb
parent71d22c740302e1f83bbbd89b229734ea9c67493c (diff)
Freeze in rails 2.0.2 (Am I going to regret having this beast in CVS?)
Diffstat (limited to 'vendor/rails-2.0.2/railties/lib/commands/server.rb')
-rw-r--r--vendor/rails-2.0.2/railties/lib/commands/server.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/rails-2.0.2/railties/lib/commands/server.rb b/vendor/rails-2.0.2/railties/lib/commands/server.rb
new file mode 100644
index 000000000..f84db9c04
--- /dev/null
+++ b/vendor/rails-2.0.2/railties/lib/commands/server.rb
@@ -0,0 +1,39 @@
+require 'active_support'
+require 'fileutils'
+
+begin
+ require_library_or_gem 'fcgi'
+rescue Exception
+ # FCGI not available
+end
+
+begin
+ require_library_or_gem 'mongrel'
+rescue Exception
+ # Mongrel not available
+end
+
+server = case ARGV.first
+ when "lighttpd", "mongrel", "webrick"
+ ARGV.shift
+ else
+ if defined?(Mongrel)
+ "mongrel"
+ elsif RUBY_PLATFORM !~ /(:?mswin|mingw)/ && !silence_stderr { `lighttpd -version` }.blank? && defined?(FCGI)
+ "lighttpd"
+ else
+ "webrick"
+ end
+end
+
+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)"
+end
+
+%w(cache pids sessions sockets).each { |dir_to_make| FileUtils.mkdir_p(File.join(RAILS_ROOT, 'tmp', dir_to_make)) }
+require "commands/servers/#{server}"