mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Use -S switch to set variables before reading recipe files #2242
git-svn-id: http://svn.rubyonrails.org/rails/tools/switchtower@2528 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
30ef2a9d78
commit
69bb33d8a7
2 changed files with 16 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Use -S switch to set variables before reading recipe files #2242
|
||||
|
||||
* Have setup.rb create a switchtower.cmd file on Win32 platforms #2402
|
||||
|
||||
* Add diff_from_last_deploy to the rails switchtower rakefile template
|
||||
|
|
|
@ -36,7 +36,8 @@ module SwitchTower
|
|||
|
||||
def initialize(args = ARGV)
|
||||
@args = args
|
||||
@options = { :verbose => 0, :recipes => [], :actions => [], :vars => {} }
|
||||
@options = { :verbose => 0, :recipes => [], :actions => [], :vars => {},
|
||||
:pre_vars => {} }
|
||||
|
||||
OptionParser.new do |opts|
|
||||
opts.banner = "Usage: #{$0} [options] [args]"
|
||||
|
@ -70,6 +71,14 @@ module SwitchTower
|
|||
@options[:vars][name.to_sym] = value
|
||||
end
|
||||
|
||||
opts.on("-S", "--set-before NAME=VALUE",
|
||||
"Specify a variable and it's value to set. This",
|
||||
"will be set BEFORE loading all recipe files."
|
||||
) do |pair|
|
||||
name, value = pair.split(/=/, 2)
|
||||
@options[:pre_vars][name.to_sym] = value
|
||||
end
|
||||
|
||||
opts.separator ""
|
||||
opts.separator "Framework Integration Options --------"
|
||||
opts.separator ""
|
||||
|
@ -171,7 +180,10 @@ DETAIL
|
|||
config.set :password, options[:password]
|
||||
config.set :pretend, options[:pretend]
|
||||
|
||||
config.load "standard" # load the standard recipe definition
|
||||
options[:pre_vars].each { |name, value| config.set(name, value) }
|
||||
|
||||
# load the standard recipe definition
|
||||
config.load "standard"
|
||||
|
||||
options[:recipes].each { |recipe| config.load(recipe) }
|
||||
options[:vars].each { |name, value| config.set(name, value) }
|
||||
|
|
Loading…
Reference in a new issue