mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Merge pull request #103 from nilbus/false-variables
Allow `set` to set variables to `false` as a value.
This commit is contained in:
commit
1ab5a415f9
2 changed files with 11 additions and 2 deletions
|
@ -163,9 +163,9 @@ module Capistrano
|
|||
# consideration the current mode ("normal" vs. "local").
|
||||
def variable(name, default = nil)
|
||||
if local? && configuration.exists?("local_#{name}".to_sym)
|
||||
return configuration["local_#{name}".to_sym] || default
|
||||
return configuration["local_#{name}".to_sym].nil? ? default : configuration["local_#{name}".to_sym]
|
||||
else
|
||||
configuration[name] || default
|
||||
configuration[name].nil? ? default : configuration[name]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -43,6 +43,15 @@ class DeploySCMGitTest < Test::Unit::TestCase
|
|||
assert_equal "#{git} clone -q git@somehost.com:project.git /var/www && cd /var/www && #{git} checkout -q -b deploy #{rev} && #{git} submodule -q init && #{git} submodule -q sync && export GIT_RECURSIVE=$([ ! \"`#{git} --version`\" \\< \"git version 1.6.5\" ] && echo --recursive) && #{git} submodule -q update --init $GIT_RECURSIVE", @source.checkout(rev, dest).gsub(/\s+/, ' ')
|
||||
end
|
||||
|
||||
def test_checkout_submodules_without_recursive
|
||||
@config[:repository] = "git@somehost.com:project.git"
|
||||
dest = "/var/www"
|
||||
rev = 'c2d9e79'
|
||||
@config[:git_enable_submodules] = true
|
||||
@config[:git_submodules_recursive] = false
|
||||
assert_equal "git clone -q git@somehost.com:project.git /var/www && cd /var/www && git checkout -q -b deploy #{rev} && git submodule -q init && git submodule -q sync && git submodule -q update --init", @source.checkout(rev, dest).gsub(/\s+/, ' ')
|
||||
end
|
||||
|
||||
def test_checkout_with_verbose_should_not_use_q_switch
|
||||
@config[:repository] = "git@somehost.com:project.git"
|
||||
@config[:scm_verbose] = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue