renwu
This commit is contained in:
parent
747493993b
commit
dae6e68623
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20151218022014) do
|
ActiveRecord::Schema.define(:version => 20151218110033) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
@ -1361,6 +1361,7 @@ ActiveRecord::Schema.define(:version => 20151218022014) do
|
||||||
t.integer "gpid"
|
t.integer "gpid"
|
||||||
t.integer "forked_from_project_id"
|
t.integer "forked_from_project_id"
|
||||||
t.integer "forked_count"
|
t.integer "forked_count"
|
||||||
|
t.integer "commits_count", :default => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "projects", ["lft"], :name => "index_projects_on_lft"
|
add_index "projects", ["lft"], :name => "index_projects_on_lft"
|
||||||
|
|
|
@ -1,18 +1,26 @@
|
||||||
# #coding=utf-8
|
#coding=utf-8
|
||||||
#
|
|
||||||
# namespace :projects do
|
namespace :projects do
|
||||||
# desc "sync some projects which just have sigle repository"
|
desc "sync some projects which just have sigle repository"
|
||||||
# task :commits_count => :environment do
|
task :commits_count => :environment do
|
||||||
# projects = Project.where("gpid is not null")
|
projects = Project.where("gpid is not null")
|
||||||
# puts projects.count
|
puts projects.count
|
||||||
# projects.each do |project|
|
projects.each do |project|
|
||||||
# unless project.gpid.nil?
|
unless project.gpid.nil?
|
||||||
# count =
|
begin
|
||||||
# end
|
url = "https://gittest.trustie.net/api/v3/projects/#{project.gpid}/repository/commits_total_count?private_token=kZUYYbAY12QSQ2Tx1zes&ref_name=master"
|
||||||
#
|
require 'net/http'
|
||||||
# end
|
count = Net::HTTP.get(URI(url))
|
||||||
# end
|
puts "count is ===>#{count}"
|
||||||
#
|
ensure
|
||||||
# task :delete_rep => :environment do
|
puts "**************** #{project.id}"
|
||||||
# end
|
end
|
||||||
# end
|
project.update_attributes(:commits_count => count)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
task :delete_rep => :environment do
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue