Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Setting up rollover rake task

  • Loading branch information...
commit 3324cd2682f7a58ef4ae0d2435375d008885d78c 1 parent 103f0af
@qrush qrush authored
Showing with 7 additions and 2 deletions.
  1. +2 −1  Rakefile
  2. +0 −1  app/models/download.rb
  3. +5 −0 lib/tasks/downloads.rake
View
3  Rakefile
@@ -9,4 +9,5 @@ require 'tasks/rails'
desc "Run all tests and features"
task :default => [:test, :cucumber]
-task :cron => ['gemcutter:store_legacy_index']
+desc "Run daily at 00:00 UTC"
+task :cron => %w[gemcutter:downloads:rollover gemcutter:store_legacy_index]
View
1  app/models/download.rb
@@ -49,7 +49,6 @@ def self.rollover
hash
end
- #{"rails-2.3.5" => 9299, "rack-1.1" => 2323",
downloads = Hash[*$redis.zrange(YESTERDAY_KEY, 0, -1, :with_scores => true)]
downloads.each do |key, score|
version = versions[key]
View
5 lib/tasks/downloads.rake
@@ -1,4 +1,9 @@
namespace "gemcutter:downloads" do
+ desc "Daily rollover and aggregation"
+ task :rollover => :environment do
+ Download.rollover
+ end
+
desc "Migrate from downloads table to redis"
task :migrate => :environment do
# create index "index_downloads_on_created_at_and_date" on downloads (version_id, date(created_at));
Please sign in to comment.
Something went wrong with that request. Please try again.