Remove *-latest tag to prevent remote/local collisions.

This commit is contained in:
Karl Matthias
2012-05-30 22:22:55 +01:00
parent 6eed2bcd51
commit 595e5f377a
2 changed files with 2 additions and 12 deletions
-9
View File
@@ -9,10 +9,6 @@ module Capistrano
"#{stage}-#{Time.now.strftime("%Y.%m.%d-%H%M%S")}"
end
def last_git_tag_for(stage)
"#{stage}-latest"
end
def safe_run(*args)
raise "#{args.join(" ")} failed!" unless system(*args)
end
@@ -62,12 +58,7 @@ module Capistrano
tag_user = (ENV['USER'] || ENV['USERNAME']).strip
cdt.safe_run "git", "tag", "-a", cdt.git_tag_for(stage), "-m", "#{tag_user} deployed #{current_sha} to #{stage}"
if cdt.git_tag?(cdt.last_git_tag_for(stage))
cdt.safe_run "git", "tag", "-d", cdt.last_git_tag_for(stage)
cdt.safe_run "git", "push", "origin", ":refs/tags/#{cdt.last_git_tag_for(stage)}" if cdt.has_remote?
end
cdt.safe_run "git", "tag", "-a", cdt.last_git_tag_for(stage), "-m", "#{tag_user} deployed #{current_sha} to #{stage}"
cdt.safe_run "git", "push", "--tags" if cdt.has_remote?
end
end
+2 -3
View File
@@ -64,10 +64,9 @@ describe Capistrano::DeployTags do
with_clean_repo do
configuration.find_and_execute_task('git:tagdeploy')
tags = `git tag -l`.split(/\n/).sort
tags.should have(2).items
tags = `git tag -l`.split(/\n/)
tags.should have(1).items
tags.first.should =~ /^test-\d{4}\.\d{2}\.\d{2}/
tags.last.should == 'test-latest'
end
end
end