From b0179615e7dcf8612ee6fa6f585ae1d6a201190e Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Tue, 27 Aug 2013 21:28:56 +0600 Subject: [PATCH] add one more task --- lib/tasks/remove_branch.rake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/tasks/remove_branch.rake diff --git a/lib/tasks/remove_branch.rake b/lib/tasks/remove_branch.rake new file mode 100644 index 000000000..89281d5a1 --- /dev/null +++ b/lib/tasks/remove_branch.rake @@ -0,0 +1,14 @@ +namespace :remove_branch do + desc "Remove branch for group projects" + task :group => :environment do + branch = ENV['BRANCH'] + group = ENV['GROUP'] + say "START remove branch #{branch} from #{group} group" + Group.find_by_uname(group).projects.find_each do |p| + next if p.repo.branches.map(&:name).exclude?(branch) + say "===== Process #{p.name} project" + p.repo.git.native(:branch, {}, '-D', branch) + end + say 'DONE' + end +end