summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2015-03-31 10:52:07 -0700
committerelijah <elijah@riseup.net>2015-03-31 10:52:07 -0700
commite4679c66565d0ccae54ffc58a23083841e5585e7 (patch)
tree2cc7fbb5d3e6a48d21a605a8411da38ea8c999e3 /lib
parent2365129a1dcbb1231f0ac22d4bf975007a0c460d (diff)
fix travis: use couchdb.admin.yml and pin travis ruby version to one that is installed on travis-ci.org
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/leap_web_core_tasks.rake31
1 files changed, 19 insertions, 12 deletions
diff --git a/lib/tasks/leap_web_core_tasks.rake b/lib/tasks/leap_web_core_tasks.rake
index e446f93..6f5ea4e 100644
--- a/lib/tasks/leap_web_core_tasks.rake
+++ b/lib/tasks/leap_web_core_tasks.rake
@@ -22,7 +22,21 @@ namespace :cleanup do
end
end
+def use_admin_conf(couchrest_model_class)
+ couchrest_model_class.configure do |conf|
+ conf.environment = Rails.env
+ conf.connection_config_file = File.join(Rails.root, 'config', 'couchdb.admin.yml')
+ end
+end
+
namespace :db do
+ desc "Migrate all design documents (using couchdb.admin.yml)"
+ task :migrate => :environment do
+ use_admin_conf(CouchRest::Model::Base)
+ CouchRest::Model::Utils::Migrate.load_all_models
+ CouchRest::Model::Utils::Migrate.all_models
+ end
+
desc "Rotate the databases, as needed."
task :rotate => :environment do
#
@@ -31,26 +45,19 @@ namespace :db do
# override the default config twice.
#
- CouchRest::Model::Base.configure do |conf|
- conf.environment = Rails.env
- conf.connection_config_file = File.join(Rails.root, 'config', 'couchdb.admin.yml')
- end
+ use_admin_conf(CouchRest::Model::Base)
Token.rotate_database_now(:window => 1.day)
+ User.create_tmp_database!
+ User.design_doc.sync!(User.tmp_database)
- CouchRest::Session::Document.configure do |conf|
- conf.environment = Rails.env
- conf.connection_config_file = File.join(Rails.root, 'config', 'couchdb.admin.yml')
- end
+ use_admin_conf(CouchRest::Session::Document)
CouchRest::Session::Document.rotate_database_now(:window => 1.day)
end
desc "Delete and recreate temporary databases."
task :deletetmp => :environment do
# db deletion and creation must be performed by admin
- CouchRest::Model::Base.configure do |conf|
- conf.environment = Rails.env
- conf.connection_config_file = File.join(Rails.root, 'config', 'couchdb.admin.yml')
- end
+ use_admin_conf(CouchRest::Model::Base)
User.tmp_database.recreate!
User.design_doc.sync!(User.tmp_database)
end