mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
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
This commit is contained in:
parent
21e030e787
commit
cb82fbd512
1 changed files with 8 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue