From cb82fbd51286a0dc9699e6265ea86311cadd019f Mon Sep 17 00:00:00 2001 From: zedshaw Date: Fri, 12 May 2006 19:39:42 +0000 Subject: Implemented the -G option for generating config files. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@171 19e92222-5c0b-0410-8929-a290d50e31e9 --- bin/mongrel_rails | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'bin') 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) -- cgit v1.2.3-24-ge0c7