rosa-build/lib/tasks/change_git_head.rake

14 lines
508 B
Ruby
Raw Normal View History

2012-12-06 07:34:45 +00:00
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