[refs #753] add rake
This commit is contained in:
parent
18e53bd5b8
commit
76223ebff8
|
@ -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
|
Loading…
Reference in New Issue