socialforge/lib/tasks/project_commits_query.rake

30 lines
816 B
Ruby

#coding=utf-8
namespace :gitlab do
desc "sync gitlab's users which lost in last sync"
task :query => :environment do
g = Gitlab.client
projects = Project.all
users_email = User.find_by_sql("select mail from users where mail != '' ")
projects.each do|project|
gpid = project.gpid
begin
contributors_list = g.contributors(gpid)
rescue
next
end
puts "project_id #{project.id}"
contributors_list.each do|contributor|
if users_email.include?(contributor.email)
contributors_list.delete(contributor)
end
end
contributors_list.each do|contributor|
puts "name #{contributor.name}"
puts "email #{contributor.email}"
puts "commits_count #{contributor.commits}"
end
end
end
end