add task remove branch for platform projects

This commit is contained in:
Alexander Machehin 2014-08-28 18:53:42 +06:00
parent 50c329abaa
commit 0eebae97b3
1 changed files with 16 additions and 0 deletions

View File

@ -11,4 +11,20 @@ namespace :remove_branch do
end end
say 'DONE' say 'DONE'
end 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 end