summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
authorazul <azul@riseup.net>2014-04-17 10:12:05 +0200
committerazul <azul@riseup.net>2014-04-17 10:12:05 +0200
commit3513ad74f950b113af1ba1e3d06bc6a55c48fde5 (patch)
treedb49ebd4428053d5c8d720275b77594a531a1ad1 /lib/tasks
parentcb6442c344d6bdaf52c3878b2de2fcf4d85f2648 (diff)
parent3d3688647fab7049e5b531c45b85c1e46a1d528f (diff)
Merge pull request #146 from azul/refactor/engines
Refactor/engines
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/leap_web_core_tasks.rake25
-rw-r--r--lib/tasks/leap_web_users_tasks.rake10
-rw-r--r--lib/tasks/test.rake19
3 files changed, 41 insertions, 13 deletions
diff --git a/lib/tasks/leap_web_core_tasks.rake b/lib/tasks/leap_web_core_tasks.rake
new file mode 100644
index 0000000..ec6abac
--- /dev/null
+++ b/lib/tasks/leap_web_core_tasks.rake
@@ -0,0 +1,25 @@
+namespace :couchrest do
+
+ desc "Dump all the design docs found in each model"
+ task :dump => :environment do
+ CouchRest::Model::Utils::Migrate.load_all_models
+ CouchRest::Model::Utils::Migrate.dump_all_models
+ end
+end
+
+namespace :cleanup do
+
+ desc "Cleanup all expired session documents"
+ task :sessions => :environment do
+ # make sure this is the same as in
+ # config/initializers/session_store.rb
+ store = CouchRest::Session::Store.new expire_after: 1800
+ store.cleanup(store.expired)
+ end
+
+ desc "Cleanup all expired tokens"
+ task :tokens => :environment do
+ Token.destroy_all_expired
+ end
+end
+
diff --git a/lib/tasks/leap_web_users_tasks.rake b/lib/tasks/leap_web_users_tasks.rake
new file mode 100644
index 0000000..62bcbe9
--- /dev/null
+++ b/lib/tasks/leap_web_users_tasks.rake
@@ -0,0 +1,10 @@
+# desc "Explaining what the task does"
+# task :leap_web_users do
+# # Task goes here
+# end
+
+# recommended that for our setup, we should have this triggered from a cron job in puppet rather than using whenever gem
+desc "Send one month warning messages"
+task :leap_web_users do
+ User.send_one_month_warnings
+end
diff --git a/lib/tasks/test.rake b/lib/tasks/test.rake
index 3c87b45..d96b625 100644
--- a/lib/tasks/test.rake
+++ b/lib/tasks/test.rake
@@ -1,18 +1,11 @@
namespace :test do
- Rails::SubTestTask.new(:units => "test:prepare") do |t|
- t.libs << "test"
- t.pattern = '*/test/unit/**/*_test.rb'
- end
-
- Rails::SubTestTask.new(:functionals => "test:prepare") do |t|
- t.libs << "test"
- t.pattern = '*/test/functional/**/*_test.rb'
- end
-
- Rails::SubTestTask.new(:integration => "test:prepare") do |t|
- t.libs << "test"
- t.pattern = '*/test/integration/**/*_test.rb'
+ [:units, :functionals, :integration].each do |type|
+ Rails::SubTestTask.new(type => "test:prepare") do |t|
+ t.libs << "test"
+ subdir = type.to_s.singularize
+ t.pattern = "engines/*/test/#{subdir}/**/*_test.rb"
+ end
end
end