diff options
-rw-r--r-- | switchtower/CHANGELOG | 2 | ||||
-rwxr-xr-x | switchtower/bin/switchtower | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/switchtower/CHANGELOG b/switchtower/CHANGELOG index 94f368d674..f8d05cb8dc 100644 --- a/switchtower/CHANGELOG +++ b/switchtower/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Allow variables to be set via the cli using the -s switch + * Log checkouts to a "revisions.log" file * Changed behavior of checkout to use the timestamp as the release name, instead of the revision number diff --git a/switchtower/bin/switchtower b/switchtower/bin/switchtower index 7cb8f9228f..d567ad7555 100755 --- a/switchtower/bin/switchtower +++ b/switchtower/bin/switchtower @@ -27,7 +27,7 @@ rescue LoadError end end -options = { :verbose => 0, :recipes => [], :actions => [] } +options = { :verbose => 0, :recipes => [], :actions => [], :vars => {} } OptionParser.new do |opts| opts.banner = "Usage: #{$0} [options]" @@ -56,6 +56,14 @@ OptionParser.new do |opts| "be specified, and are loaded in the given order." ) { |value| options[:recipes] << value } + opts.on("-s", "--set NAME=VALUE", + "Specify a variable and it's value to set. This", + "will be set after loading all recipe files." + ) do |pair| + name, value = pair.split(/=/) + options[:vars][name.to_sym] = value + end + opts.on("-v", "--verbose", "Specify the verbosity of the output.", "May be given multiple times. (Default: silent)" @@ -104,6 +112,7 @@ config.set :pretend, options[:pretend] config.load "standard" # load the standard recipe definition options[:recipes].each { |recipe| config.load(recipe) } +options[:vars].each { |name, value| config.set(name, value) } actor = config.actor options[:actions].each { |action| actor.send action } |