diff options
Diffstat (limited to 'bin/mongrel_rails')
-rw-r--r-- | bin/mongrel_rails | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/bin/mongrel_rails b/bin/mongrel_rails index 2b363bd..059c782 100644 --- a/bin/mongrel_rails +++ b/bin/mongrel_rails @@ -1,5 +1,6 @@ require 'rubygems' require 'mongrel/rails' +require 'yaml' class Start < Mongrel::Plugin "/commands" @@ -18,7 +19,6 @@ class Start < Mongrel::Plugin "/commands" ['-m', '--mime PATH', "A YAML file that lists additional MIME types", :@mime_map, nil], ['-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"], - ['-L', '--load PATH', "Loads plugins from the given directory", :@load_from, nil], ] end @@ -34,8 +34,6 @@ class Start < Mongrel::Plugin "/commands" valid_dir? @docroot, "Path to docroot not valid: #@docroot" valid_exists? @mime_map, "MIME mapping file does not exist: #@mime_map" if @mime_map - valid_dir? @load_from, "Plugin directory path does not exist" if @load_from - return @valid end @@ -87,6 +85,8 @@ class Start < Mongrel::Plugin "/commands" server = Mongrel::HttpServer.new(@address, @port, @num_procs.to_i, @timeout.to_i) server.register("/", rails) + + # start mongrel processing thread server.run # signal trapping just applies to posix systems @@ -109,7 +109,10 @@ class Start < Mongrel::Plugin "/commands" @restart = true } end - + + # hook up any rails specific plugins + Mongrel::PluginManager.instance.load(MONGREL_PLUGINS_DIR) + begin STDERR.puts "Server ready." server.acceptor.join @@ -123,7 +126,6 @@ class Start < Mongrel::Plugin "/commands" end def run - Mongrel::PluginManager.instance.load(@load_from) if @load_from daemonize rails = configure_rails start_mongrel(rails) @@ -212,5 +214,13 @@ class Restart < Mongrel::Plugin "/commands" end end +if ARGV[0] == "-L" || ARGV[0] == "--load" + ARGV.shift # drop the -L + MONGREL_PLUGINS_DIR=ARGV.shift +else + MONGREL_PLUGINS_DIR=nil +end + +Mongrel::PluginManager.instance.load(MONGREL_PLUGINS_DIR, ["rails"]) Mongrel::Command::Registry.instance.run ARGV |