From e093c74b856dc62e326b6432c2af68a0013185c6 Mon Sep 17 00:00:00 2001 From: Raine Virta Date: Tue, 20 Apr 2010 15:48:40 +0300 Subject: [PATCH] - --- config/git-deployment.rb | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/config/git-deployment.rb b/config/git-deployment.rb index 7c6d5dc..58b3d54 100644 --- a/config/git-deployment.rb +++ b/config/git-deployment.rb @@ -4,11 +4,15 @@ Capistrano::Configuration.instance(true).load do |configuration| namespace :git do def sh cmd puts cmd; system cmd + + if $? != 0 + raise "#{cmd} failed" + end end - + def last_tag_matching(pattern) lastTag = nil - + matching_tags = `git tag -l '#{pattern}'` matching_tags = matching_tags.split natcmp_src = File.join(File.dirname(__FILE__), '/natcmp.rb') @@ -16,7 +20,7 @@ Capistrano::Configuration.instance(true).load do |configuration| matching_tags.sort! do |a,b| String.natcmp(b,a,true) end - + if matching_tags.length > 0 last_tag = matching_tags[0] end @@ -34,18 +38,16 @@ Capistrano::Configuration.instance(true).load do |configuration| task :calculate_tag do sh "git fetch" - method = "tag_#{stage}" - send method - - # push tags and latest code - sh 'git push' - if $? != 0 - raise "git push failed" - end + # ignore the tag-based deployment process and a deploy non-master branch + if branch != "master" && stage == "devqa" + sh 'git push' + else + method = "tag_#{stage}" + send method - sh 'git push --tags' - if $? != 0 - raise "git push --tags failed" + # push tags and latest code + sh 'git push' + sh 'git push --tags' end end @@ -78,7 +80,6 @@ Capistrano::Configuration.instance(true).load do |configuration| sh "git tag -a -m 'tagging current code for deployment to devqa' #{new_devqa_tag}" end - p new_devqa_tag set :branch, new_devqa_tag end -- 2.11.4.GIT