about summary refs log tree commit homepage
path: root/bin
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-03-02 03:54:32 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-03-02 03:54:32 +0000
commit5c13c5dd9d92c60223829881b9835ee9fb02f400 (patch)
tree908a64c658caa2ceddac28ae692b5692d081b26a /bin
parent58723a54f16e73b6d92a201200f1972283be9b74 (diff)
downloadunicorn-5c13c5dd9d92c60223829881b9835ee9fb02f400.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@67 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'bin')
-rw-r--r--bin/mongrel_rails33
-rw-r--r--bin/mongrel_rails_service8
2 files changed, 23 insertions, 18 deletions
diff --git a/bin/mongrel_rails b/bin/mongrel_rails
index c9051fe..c78895d 100644
--- a/bin/mongrel_rails
+++ b/bin/mongrel_rails
@@ -3,21 +3,22 @@ require 'mongrel/rails'
 
 
 class Start < Mongrel::Plugin "/commands"
-  include Mongrel::Command::Command
+  include Mongrel::Command::Base
 
   def configure
     options [
-             ["-e", "--environment ENV", "Rails environment to run as", :@environment, ENV['RAILS_ENV'] || "development"],
-             ["-d", "--daemonize", "Whether to run in the background or not", :@daemon, false],
-             ['-p', '--port PORT', "Which port to bind to", :@port, 3000],
-             ['-a', '--address ADDR', "Address to bind to", :@address, "0.0.0.0"],
-             ['-l', '--log FILE', "Where to write log messages", :@log_file, "log/mongrel.log"],
-             ['-P', '--pid FILE', "Where to write the PID", :@pid_file, "log/mongrel.pid"],
-             ['-n', '--num-procs INT', "Number of processor threads to use", :@num_procs, 20],
-             ['-t', '--timeout SECONDS', "Timeout all requests after SECONDS time", :@timeout, 120],
-             ['-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"],
+      ["-e", "--environment ENV", "Rails environment to run as", :@environment, ENV['RAILS_ENV'] || "development"],
+      ["-d", "--daemonize", "Whether to run in the background or not", :@daemon, false],
+      ['-p', '--port PORT', "Which port to bind to", :@port, 3000],
+      ['-a', '--address ADDR', "Address to bind to", :@address, "0.0.0.0"],
+      ['-l', '--log FILE', "Where to write log messages", :@log_file, "log/mongrel.log"],
+      ['-P', '--pid FILE', "Where to write the PID", :@pid_file, "log/mongrel.pid"],
+      ['-n', '--num-procs INT', "Number of processor threads to use", :@num_procs, 20],
+      ['-t', '--timeout SECONDS', "Timeout all requests after SECONDS time", :@timeout, 120],
+      ['-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
   
@@ -33,9 +34,12 @@ 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
 
+
   def daemonize
     # save this for later since daemonize will hose it
     if @daemon and RUBY_PLATFORM !~ /mswin/
@@ -120,6 +124,7 @@ class Start < Mongrel::Plugin "/commands"
   end
 
   def run
+    Mongrel::PluginManager.instance.load(@load_from) if @load_from
     daemonize
     rails = configure_rails
     start_mongrel(rails)
@@ -141,7 +146,7 @@ end
 
 
 class Stop < Mongrel::Plugin "/commands"
-  include Mongrel::Command::Command
+  include Mongrel::Command::Base
 
   def configure
     options [
@@ -176,7 +181,7 @@ end
 
 
 class Restart < Mongrel::Plugin "/commands"
-    include Mongrel::Command::Command
+  include Mongrel::Command::Base
 
   def configure
     options [
diff --git a/bin/mongrel_rails_service b/bin/mongrel_rails_service
index 8609890..a82546e 100644
--- a/bin/mongrel_rails_service
+++ b/bin/mongrel_rails_service
@@ -31,7 +31,7 @@ module GenericCommand
 end
 
 class Install < Mongrel::Plugin "/commands"
-  include Mongrel::Command::Command
+  include Mongrel::Command::Base
 
   # Default every option to nil so only the defined ones get passed to service
   # (which will override ServiceCommand defaults).
@@ -175,7 +175,7 @@ class Install < Mongrel::Plugin "/commands"
 end
 
 class Delete < Mongrel::Plugin "/commands"
-  include Mongrel::Command::Command
+  include Mongrel::Command::Base
   include GenericCommand
 
   def run
@@ -194,7 +194,7 @@ class Delete < Mongrel::Plugin "/commands"
 end
 
 class Start < Mongrel::Plugin "/commands"
-  include Mongrel::Command::Command
+  include Mongrel::Command::Base
   include GenericCommand
   
   def run
@@ -219,7 +219,7 @@ class Start < Mongrel::Plugin "/commands"
 end
 
 class Stop < Mongrel::Plugin "/commands"
-  include Mongrel::Command::Command
+  include Mongrel::Command::Base
   include GenericCommand
   
   def run