aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-08-27 17:12:08 +0000
committerJamis Buck <jamis@37signals.com>2005-08-27 17:12:08 +0000
commit76e7de61c97f7b9bfff0e6e36eee290a551acb45 (patch)
tree3f02d99097681fabcb24cf6297dd443be3c06d8a
parent959e06a0fc1dd3b85aeb5d0d005eff2a02eb547e (diff)
downloadrails-76e7de61c97f7b9bfff0e6e36eee290a551acb45.tar.gz
rails-76e7de61c97f7b9bfff0e6e36eee290a551acb45.tar.bz2
rails-76e7de61c97f7b9bfff0e6e36eee290a551acb45.zip
SwitchTower: allow variables to be set via the cli using the -s switch
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2061 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--switchtower/CHANGELOG2
-rwxr-xr-xswitchtower/bin/switchtower11
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 }