Skip to content
Browse files

Add rake test for redis history migration

  • Loading branch information...
1 parent 63a39a9 commit c9eaab5e51fbb348dc80606a449b447fc315eb27 @evanphx evanphx committed Sep 15, 2012
Showing with 16 additions and 1 deletion.
  1. +9 −1 app/models/download.rb
  2. +7 −0 lib/tasks/gemcutter.rake
View
10 app/models/download.rb
@@ -135,8 +135,16 @@ def self.migrate_to_sql(version)
end
def self.migrate_all_to_sql
+ i = 0
count = 0
- Version.all.each do |ver|
+ versions = Version.all
+ total = versions.size
+
+
+ versions.each do |ver|
+ i += 1
+ yield total, i, ver if block_given?
+
dates = migrate_to_sql ver
count += 1 unless dates.empty?
end
View
7 lib/tasks/gemcutter.rake
@@ -58,4 +58,11 @@ namespace :gemcutter do
end
end
end
+
+ desc "Move all but the last 2 days of version history to SQL"
+ task :migrate_history => :environment do
+ Download.migrate_all_to_sql do |t,c,v|
+ puts "#{c} of #{t}: #{v.full_name}"
+ end
+ end
end

0 comments on commit c9eaab5

Please sign in to comment.
Something went wrong with that request. Please try again.