about summary refs log tree commit homepage
path: root/bin
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-05-12 19:39:42 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-05-12 19:39:42 +0000
commitcb82fbd51286a0dc9699e6265ea86311cadd019f (patch)
tree7c83846887c022fe0d855b6b3c6426a61200b94d /bin
parent21e030e787a02fd92a0e47ebc838fc2927890f21 (diff)
downloadunicorn-cb82fbd51286a0dc9699e6265ea86311cadd019f.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@171 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'bin')
-rw-r--r--bin/mongrel_rails9
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/mongrel_rails b/bin/mongrel_rails
index 2066f6e..2f95230 100644
--- a/bin/mongrel_rails
+++ b/bin/mongrel_rails
@@ -24,7 +24,8 @@ class Start < GemPlugin::Plugin "/commands"
       ['-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],
-      ['-S', '--script PATH', "Load the given file as an extra config script.", :@config_script, nil]
+      ['-S', '--script PATH', "Load the given file as an extra config script.", :@config_script, nil],
+      ['-G', '--generate CONFIG', "Generate a config file for -C", :@generate, nil]
     ]
   end
   
@@ -40,6 +41,7 @@ class Start < GemPlugin::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_exists? @config_file, "Config file not there: #@config_file" if @config_file
+    valid_dir? File.dirname(@generate), "Problem accessing directory to #@generate" if @generate
     return @valid
   end
 
@@ -53,6 +55,11 @@ class Start < GemPlugin::Plugin "/commands"
       :num_processors => @num_procs, :timeout => @timeout
     }
 
+    if @generate
+      STDERR.puts "** Writing config to #@generate"
+      open(@generate, "w") {|f| f.write(settings.to_yaml) }
+    end
+
     if @config_file
       STDERR.puts "** Loading settings from #{@config_file} (command line options override)."
       conf = YAML.load_file(@config_file)