socialforge/db/migrate/20160113024927_statics_repo...

20 lines
434 B
Ruby

class StaticsRepositoryCommits < ActiveRecord::Migration
def up
g = Gitlab.client
Project.all.each do |project|
unless project.gpid.nil?
begin
puts project.id
count = g.project(project.gpid).commit_count
rescue
logger.error("The project's rep is not exit!")
end
project.update_attribute(:commits_count, count)
end
end
end
def down
end
end