# #coding=utf-8
#
# namespace :projects do
#   desc "sync some projects which just have sigle repository"
#   task :commits_count => :environment do
#     projects = Project.where("gpid is not null")
#     puts projects.count
#     projects.each do |project|
#       unless project.gpid.nil?
#         begin
#         url = "https://gittest.trustie.net/api/v3/projects/#{project.gpid}/repository/commits_total_count?private_token=kZUYYbAY12QSQ2Tx1zes&ref_name=master"
#         require 'net/http'
#         count =  Net::HTTP.get(URI(url))
#         puts "count is ===>#{count}"
#         ensure
#           puts "**************** #{project.id}"
#         end
#         project.update_attributes(:commits_count => count)
#       end
#
#     end
#   end
#
#   task :delete_rep => :environment do
#   end
# end