From 595e5f377af64ed61862c6d68e9e46ef3d742903 Mon Sep 17 00:00:00 2001 From: Karl Matthias Date: Wed, 30 May 2012 22:22:55 +0100 Subject: [PATCH] Remove *-latest tag to prevent remote/local collisions. --- lib/capistrano/deploy_tags.rb | 9 --------- spec/capistrano_deploy_tags_spec.rb | 5 ++--- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/capistrano/deploy_tags.rb b/lib/capistrano/deploy_tags.rb index 69d4cf5..d7027a5 100644 --- a/lib/capistrano/deploy_tags.rb +++ b/lib/capistrano/deploy_tags.rb @@ -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 diff --git a/spec/capistrano_deploy_tags_spec.rb b/spec/capistrano_deploy_tags_spec.rb index 2eddc43..c1766c6 100644 --- a/spec/capistrano_deploy_tags_spec.rb +++ b/spec/capistrano_deploy_tags_spec.rb @@ -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