From 0eebae97b3f0996da74bf489312d241ce2d1a4b6 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Thu, 28 Aug 2014 18:53:42 +0600 Subject: [PATCH] add task remove branch for platform projects --- lib/tasks/remove_branch.rake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/tasks/remove_branch.rake b/lib/tasks/remove_branch.rake index 5019c52cb..040a9dc8a 100644 --- a/lib/tasks/remove_branch.rake +++ b/lib/tasks/remove_branch.rake @@ -11,4 +11,20 @@ namespace :remove_branch do end say 'DONE' end + + desc "Remove branch for platform projects" + task platform: :environment do + branch = ENV['BRANCH'] + platform = ENV['PLATFORM'] + say "START remove branch #{branch} from #{platform} platform" + Platform.find_by(name: platform).repositories.each do |r| + say "=== Process #{r.name} repo" + r.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 + end + say 'DONE' + end end