mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
On a dry run, don't throw an error when trying to use the current_release variable
This commit is contained in:
parent
068204324b
commit
f2f23f32d9
2 changed files with 26 additions and 1 deletions
|
@ -56,7 +56,7 @@ _cset(:current_path) { File.join(deploy_to, current_dir) }
|
||||||
_cset(:release_path) { File.join(releases_path, release_name) }
|
_cset(:release_path) { File.join(releases_path, release_name) }
|
||||||
|
|
||||||
_cset(:releases) { capture("ls -x #{releases_path}", :except => { :no_release => true }).split.sort }
|
_cset(:releases) { capture("ls -x #{releases_path}", :except => { :no_release => true }).split.sort }
|
||||||
_cset(:current_release) { File.join(releases_path, releases.last) }
|
_cset(:current_release) { releases.length > 0 ? File.join(releases_path, releases.last) : nil }
|
||||||
_cset(:previous_release) { releases.length > 1 ? File.join(releases_path, releases[-2]) : nil }
|
_cset(:previous_release) { releases.length > 1 ? File.join(releases_path, releases[-2]) : nil }
|
||||||
|
|
||||||
_cset(:current_revision) { capture("cat #{current_path}/REVISION", :except => { :no_release => true }).chomp }
|
_cset(:current_revision) { capture("cat #{current_path}/REVISION", :except => { :no_release => true }).chomp }
|
||||||
|
|
25
test/recipes_test.rb
Normal file
25
test/recipes_test.rb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
require 'utils'
|
||||||
|
require 'capistrano/configuration'
|
||||||
|
|
||||||
|
class RecipesTest < Test::Unit::TestCase
|
||||||
|
|
||||||
|
def setup
|
||||||
|
@config = Capistrano::Configuration.new
|
||||||
|
@config.stubs(:logger).returns(stub_everything)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_current_releases_does_not_cause_error_on_dry_run
|
||||||
|
@config.dry_run = true
|
||||||
|
@config.load 'deploy'
|
||||||
|
@config.load do
|
||||||
|
set :application, "foo"
|
||||||
|
task :dry_run_test do
|
||||||
|
fetch :current_release
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_nothing_raised do
|
||||||
|
@config.dry_run_test
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue