1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Fixes incorrect version. Sets up an extra .rb config option (-S). Fixes an extra log message.

git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@135 19e92222-5c0b-0410-8929-a290d50e31e9
This commit is contained in:
zedshaw 2006-04-01 08:43:30 +00:00
parent 6d1c93465b
commit e20a52b735
5 changed files with 31 additions and 5 deletions

View file

@ -22,7 +22,8 @@ class Start < GemPlugin::Plugin "/commands"
['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, Dir.pwd],
['-r', '--root PATH', "Set the document root (default 'public')", :@docroot, "public"],
['-B', '--debug', "Enable debugging mode", :@debug, false],
['-C', '--config PATH', "Use a config file", :@config_file, nil]
['-C', '--config PATH', "Use a config file", :@config_file, nil],
['-S', '--script PATH', "Load the given file as an extra config script.", :@config_script, nil]
]
end
@ -83,6 +84,11 @@ class Start < GemPlugin::Plugin "/commands"
log "Loading any Rails specific GemPlugins"
load_plugins
if settings[:config_script]
log "Loading #{settings[:config_script]} external config script"
run_config("config/mongrel.rb")
end
setup_rails_signals
end
end

View file

@ -725,7 +725,6 @@ module Mongrel
# is organized.
def load_mime_map(file, mime={})
# configure any requested mime map
log "Loading additional MIME types from #{file}"
mime = load_yaml(file, mime)
# check all the mime types to make sure they are the right format
@ -786,11 +785,19 @@ module Mongrel
MongrelDbg.begin_trace :rails
MongrelDbg.begin_trace :files
uri location, :handler => plugin("/handlers/requestlog::access")
uri location, :handler => plugin("/handlers/requestlog::files")
uri location, :handler => plugin("/handlers/requestlog::objects")
uri location, :handler => plugin("/handlers/requestlog::params")
end
# Used to allow you to let users specify their own configurations
# inside your Configurator setup. You pass it a script name and
# reads it in and does an eval on the contents passing in the right
# binding so they can put their own Configurator statements.
def run_config(script)
open(script) {|f| eval(f.read, proc {self}) }
end
# Sets up the standard signal handlers that are used on most Ruby
# It only configures if the platform is not win32 and doesn't do

View file

@ -52,7 +52,7 @@ module Mongrel
@opt.on_tail("--version", "Show version") do
@done_validating = true
if VERSION
puts "Version #{VERSION}"
puts "Version #{MONGREL_VERSION}"
end
end

View file

@ -219,6 +219,19 @@ end
module RequestLog
# Just logs whatever requests it gets to STDERR (which ends up in the mongrel
# log when daemonized).
class Access < GemPlugin::Plugin "/handlers"
include Mongrel::HttpHandlerPlugin
def process(request,response)
p = request.params
STDERR.puts "#{p['REMOTE_ADDR']} - [#{HttpServer.httpdate(Time.now)}] \"#{p['REQUEST_METHOD']} #{p["REQUEST_URI"]} HTTP/1.1\""
end
end
class Files < GemPlugin::Plugin "/handlers"
include Mongrel::HttpHandlerPlugin

View file

@ -29,12 +29,12 @@ class ConfiguratorTest < Test::Unit::TestCase
# 2 in front should run, but the sentinel shouldn't since dirhandler processes the request
uri "/", :handler => plugin("/handlers/testplugin")
uri "/", :handler => plugin("/handlers/testplugin")
uri "/", :handler => Mongrel::DirHandler.new(".", load_mime_map("examples/mime.yaml"))
uri "/", :handler => Mongrel::DirHandler.new(".")
uri "/", :handler => plugin("/handlers/testplugin")
uri "/test", :handler => plugin("/handlers/testplugin")
uri "/test", :handler => plugin("/handlers/testplugin")
uri "/test", :handler => Mongrel::DirHandler.new(".", load_mime_map("examples/mime.yaml"))
uri "/test", :handler => Mongrel::DirHandler.new(".")
uri "/test", :handler => plugin("/handlers/testplugin")
run
end