Permalink
Browse files

clean task added

  • Loading branch information...
1 parent f1faf4a commit 1086f7d50a0d990630386e3de3dcf5bdf8a32ef7 @tompesman committed Jun 20, 2012
Showing with 21 additions and 0 deletions.
  1. +1 −0 lib/push-core.rb
  2. +11 −0 lib/push/railtie.rb
  3. +9 −0 lib/tasks/push_tasks.rake
View
@@ -0,0 +1 @@
+require 'push/railtie' if defined?(Rails)
View
@@ -0,0 +1,11 @@
+require 'push'
+require 'rails'
+module Push
+ class Railtie < Rails::Railtie
+ railtie_name :push
+
+ rake_tasks do
+ load 'tasks/push_tasks.rake'
+ end
+ end
+end
@@ -0,0 +1,9 @@
+# Push Rake Tasks
+namespace :push do
+ desc "Delete all push messages and feedback older than 7 days or DAYS=x if defined (where x is an integer)"
+ task :clean => :environment do
+ days = ENV["DAYS"].to_i || 7
+ Push::Feedback.where("created_at < ?", days.days.ago).delete_all
+ Push::Message.where("created_at < ?", days.days.ago).delete_all
+ end
+end

0 comments on commit 1086f7d

Please sign in to comment.