diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-11-24 01:04:44 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-11-24 01:04:44 +0000 |
commit | db045dbbf60b53dbe013ef25554fd013baf88134 (patch) | |
tree | 257830e3c76458c8ff3d1329de83f32b23926028 /railties/dispatches | |
download | rails-db045dbbf60b53dbe013ef25554fd013baf88134.tar.gz rails-db045dbbf60b53dbe013ef25554fd013baf88134.tar.bz2 rails-db045dbbf60b53dbe013ef25554fd013baf88134.zip |
Initial
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/dispatches')
-rwxr-xr-x | railties/dispatches/dispatch.fcgi | 7 | ||||
-rwxr-xr-x | railties/dispatches/dispatch.rb | 10 | ||||
-rw-r--r-- | railties/dispatches/dispatch.servlet | 49 | ||||
-rw-r--r-- | railties/dispatches/start_server | 1 |
4 files changed, 67 insertions, 0 deletions
diff --git a/railties/dispatches/dispatch.fcgi b/railties/dispatches/dispatch.fcgi new file mode 100755 index 0000000000..dc43f03b19 --- /dev/null +++ b/railties/dispatches/dispatch.fcgi @@ -0,0 +1,7 @@ +#!/usr/local/bin/ruby + +require File.dirname(__FILE__) + "/../config/environment" +require 'dispatcher' +require 'fcgi' + +FCGI.each_cgi { |cgi| Dispatcher.dispatch(cgi, Dispatcher::DEFAULT_SESSION_OPTIONS, File.dirname(__FILE__) + "/500.html") }
\ No newline at end of file diff --git a/railties/dispatches/dispatch.rb b/railties/dispatches/dispatch.rb new file mode 100755 index 0000000000..eb2c95e813 --- /dev/null +++ b/railties/dispatches/dispatch.rb @@ -0,0 +1,10 @@ +#!/usr/local/bin/ruby + +require File.dirname(__FILE__) + "/../config/environment" + +# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: +# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired +require "dispatcher" + +ADDITIONAL_LOAD_PATHS.flatten.each { |dir| $:.unshift "#{RAILS_ROOT}/#{dir}" } +Dispatcher.dispatch
\ No newline at end of file diff --git a/railties/dispatches/dispatch.servlet b/railties/dispatches/dispatch.servlet new file mode 100644 index 0000000000..a1fa403a67 --- /dev/null +++ b/railties/dispatches/dispatch.servlet @@ -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 diff --git a/railties/dispatches/start_server b/railties/dispatches/start_server new file mode 100644 index 0000000000..c6ecb4e4fe --- /dev/null +++ b/railties/dispatches/start_server @@ -0,0 +1 @@ +ruby public/dispatch.servlet
\ No newline at end of file |