require 'trustie/gitlab/sync' namespace :gitlab do namespace :sync do desc "sync users to gitlab" task :users => :environment do # User.where(username: 'root').find_each do |user| s = Trustie::Gitlab::Sync.new User.find_each do |user| s.sync_user(user) end end desc "update user password" task :password => :environment do s = Trustie::Gitlab::Sync.new s.change_password(1,'5188b7a65acf294ee7deceb397b6f9c62214ea50','dcb8d9fffabec60c2d0d1030b679fbbb') end desc "sync projects to gitlab" task :projects => :environment do s = Trustie::Gitlab::Sync.new Project.where(id: ENV["PROJECT_ID"]).find_each do |project| s.sync_project(project, path: 'trustie', import_url: 'http://xianbo_trustie2:1234@repository.trustie.net/xianbo/trustie2.git') end end desc "remove all projects" task :remove_all_projects => :environment do g = Gitlab.client 100.times do g.projects(scope: 'all').each do |p| puts p.id begin g.delete_project(p.id) rescue => e puts e end end end end end end