Sha256: eabbfb241c1be82c68940078dd49112fc024a4984ec19247e826f89bccda2263

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

#!/usr/local/bin/ruby

require File.dirname(__FILE__) + "/../config/environments/production"
require 'webrick_server'
require 'optparse'

OPTIONS = {
  :port          => 3000,
  :ip            => "127.0.0.1",
  :cache_classes => false,
  :server_root   => File.expand_path(File.dirname(__FILE__)),
  :server_type   => 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("-d", "--daemon",
          "Make Rails run as a Daemon (only works if fork is available -- meaning on *nix)."
          ) { OPTIONS[:server_type] = Daemon }
  opts.on("-c", "--cache-classes",
          "Caches class compilation which will speed up the serving of requests, but require a server restart on source changes."
          ) { |OPTIONS[:cache_classes]| }

  opts.separator ""

  opts.on("-h", "--help",
          "Show this help message.") { puts opts; exit }

  opts.parse!
end

DispatchServlet.dispatch(OPTIONS)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails-0.8.5 dispatches/dispatch.servlet
rails-0.8.0 dispatches/dispatch.servlet