From d2ba254197355645e5922b2eb0189a2373905360 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Tue, 27 Aug 2013 21:05:58 +0600 Subject: [PATCH] add new task --- lib/tasks/add_branch.rake | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/tasks/add_branch.rake b/lib/tasks/add_branch.rake index 47c0bf9ed..c8055d8c4 100644 --- a/lib/tasks/add_branch.rake +++ b/lib/tasks/add_branch.rake @@ -12,6 +12,21 @@ namespace :add_branch do FileUtils.rm_rf tmp_path end + desc "Add branch for group projects" + task :group => :environment do + src_branch = ENV['SRC_BRANCH'] + dst_branch = ENV['DST_BRANCH'] + group = ENV['GROUP'] + say "START add branch #{dst_branch} from #{src_branch} in #{group} group" + Group.find_by_uname(group).projects.find_each do |p| + next if p.repo.branches.map(&:name).include?(dst_branch) + next if p.repo.branches.map(&:name).exclude?(src_branch) + say "===== Process #{p.name} project" + Rake::Task['add_branch:fork_branch'].execute(:path => p.path, :src_branch => src_branch, :dst_branch => dst_branch) + end + say 'DONE' + end + desc "Add branch for platform projects" task :platform => :environment do src_branch = ENV['SRC_BRANCH'] || 'import_mandriva2011'