about summary refs log tree commit homepage
path: root/bin
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-03-05 07:58:18 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-03-05 07:58:18 +0000
commit9d120bf9b5a2caccddfedae428b8057a3fa66539 (patch)
treed91f9c5a9cae8ae014e429951e7e7d64768ef9be /bin
parentf33725d72c63ee7afcec913ebf09a188edd158c3 (diff)
downloadunicorn-9d120bf9b5a2caccddfedae428b8057a3fa66539.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@80 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'bin')
-rw-r--r--bin/mongrel_rails20
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