[refs #753] add rake

This commit is contained in:
Alexander Machehin 2012-12-06 13:34:45 +06:00
parent 18e53bd5b8
commit 76223ebff8
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
namespace :project do
desc 'Change HEAD at projects where default branch is not master'
task :git_change_head => :environment do
projects = Project.where("default_branch <> 'master'")
say "Find #{projects.count} project(s) without master HEAD"
say "Start working..."
projects.each do |project|
`cd #{project.path} && git symbolic-ref HEAD refs/heads/#{project.default_branch}` if project.repo.branches.map(&:name).include?(project.default_branch)
end
say 'Done!'
end
end