[refs file-store-4] small refactoring

This commit is contained in:
Alexander Machehin 2012-08-31 10:59:40 +06:00
parent 1e84da0057
commit e0c25563f0
1 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ namespace :project do
owner = User.find_by_uname(uname) || Group.find_by_uname(uname) owner = User.find_by_uname(uname) || Group.find_by_uname(uname)
owner.projects owner.projects
else else
Project Project.scoped
end end
projects = projects.where :id => eval(ENV['PROJECT_ID']) if ENV['PROJECT_ID'] projects = projects.where :id => eval(ENV['PROJECT_ID']) if ENV['PROJECT_ID']
@ -15,7 +15,7 @@ namespace :project do
FileUtils.mkdir_p "#{ENV['CLONE_PATH']}/archives" if total_count > 0 FileUtils.mkdir_p "#{ENV['CLONE_PATH']}/archives" if total_count > 0
begin_time = Time.now begin_time = Time.now
pr_count = 0 pr_count = 0
projects.where('1=1').each_with_index do |project, ind| projects.each_with_index do |project, ind|
project_stats = "#{project.name_with_owner}: #{ind+1}/#{total_count}" project_stats = "#{project.name_with_owner}: #{ind+1}/#{total_count}"
if project.repo.commits.count == 0 if project.repo.commits.count == 0
say "Skipping empty project #{project_stats}" say "Skipping empty project #{project_stats}"