From b8f8776f0cffc1b73719f16513a5721d77b19186 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 16 Dec 2004 15:45:55 +0000 Subject: Renamed public/dispatch.servlet to script/server -- it wasn't really dispatching anyway as its delegating calls to public/dispatch.rb git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@186 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/bin/server | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 railties/bin/server (limited to 'railties/bin') diff --git a/railties/bin/server b/railties/bin/server new file mode 100644 index 0000000000..a1fa403a67 --- /dev/null +++ b/railties/bin/server @@ -0,0 +1,49 @@ +#!/usr/local/bin/ruby + +require 'webrick' +require 'optparse' + +OPTIONS = { + :port => 3000, + :ip => "127.0.0.1", + :environment => "development", + :server_root => File.expand_path(File.dirname(__FILE__)), + :server_type => WEBrick::SimpleServer +} + +ARGV.options do |opts| + script_name = File.basename($0) + opts.banner = "Usage: ruby #{script_name} [options]" + + opts.separator "" + + opts.on("-p", "--port=port", Integer, + "Runs Rails on the specified port.", + "Default: 3000") { |OPTIONS[:port]| } + opts.on("-b", "--binding=ip", String, + "Binds Rails to the specified ip.", + "Default: 127.0.0.1") { |OPTIONS[:ip]| } + opts.on("-i", "--index=controller", String, + "Specifies an index controller that requests for root will go to (instead of congratulations screen)." + ) { |OPTIONS[:index_controller]| } + opts.on("-e", "--environment=name", String, + "Specifies the environment to run this server under (test/development/production).", + "Default: development") { |OPTIONS[:environment]| } + opts.on("-d", "--daemon", + "Make Rails run as a Daemon (only works if fork is available -- meaning on *nix)." + ) { OPTIONS[:server_type] = WEBrick::Daemon } + + opts.separator "" + + opts.on("-h", "--help", + "Show this help message.") { puts opts; exit } + + opts.parse! +end + +ENV["RAILS_ENV"] = OPTIONS[:environment] +require File.dirname(__FILE__) + "/../config/environment" +require 'webrick_server' + +puts "=> Rails application started on http://#{OPTIONS[:ip]}:#{OPTIONS[:port]}" +DispatchServlet.dispatch(OPTIONS) \ No newline at end of file -- cgit v1.2.3