socialforge/lib/tasks/sync_check_members.rake

26 lines
699 B
Ruby

require 'trustie/gitlab/sync'
namespace :gitlab do
namespace :check_members do
desc "check up projects' members "
task :projects => :environment do
s = Trustie::Gitlab::Sync.new
g = Gitlab.client
Project.all.each do |project|
unless project.gpid.nil?
begin
gmembers = g.team_members(project.gpid)
if gmembers.count != project.members.count
puts "gitlab' projects count #{gmembers.count}"
puts "project ID is #{project.id}"
s.only_members(project)
end
rescue
p "This project is wrong #{project.id}"
end
end
end
end
end
end