Merge branch 'develop' into szzh

This commit is contained in:
huang 2015-12-18 21:36:09 +08:00
commit 2efb7b6e66
1 changed files with 26 additions and 26 deletions

View File

@ -1,26 +1,26 @@
#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
# #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