Permalink
Browse files

SwitchTower: allow variables to be set via the cli using the -s switch

git-svn-id: http://svn.rubyonrails.org/rails/trunk/switchtower@2061 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 199f261 commit 554984e04a873410f50f4b2de822235c7a8e5409 @jamis jamis committed Aug 27, 2005
Showing with 12 additions and 1 deletion.
  1. +2 −0 CHANGELOG
  2. +10 −1 bin/switchtower
View
2 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
View
11 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 }

0 comments on commit 554984e

Please sign in to comment.