2013-08-27 16:28:56 +01:00
|
|
|
namespace :remove_branch do
|
|
|
|
desc "Remove branch for group projects"
|
2014-01-21 04:51:49 +00:00
|
|
|
task group: :environment do
|
2013-08-27 16:28:56 +01:00
|
|
|
branch = ENV['BRANCH']
|
|
|
|
group = ENV['GROUP']
|
|
|
|
say "START remove branch #{branch} from #{group} group"
|
2014-03-18 13:58:51 +00:00
|
|
|
Group.find_by(uname: group).projects.find_each do |p|
|
2013-08-27 16:28:56 +01:00
|
|
|
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
|
2014-08-28 13:53:42 +01:00
|
|
|
|
|
|
|
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
|
2013-08-27 16:28:56 +01:00
|
|
|
end
|