Sha256: 9a96e8ac3568f465dde1eea2b469a554b6c0ab5a33c13238f6b53130879c0f06
Contents?: true
Size: 986 Bytes
Versions: 1
Compression:
Stored size: 986 Bytes
Contents
if File.exist? Rails.root.join('config/mongoid.yml') namespace :mongodb do config = YAML.load(File.read(Rails.root.join('config/mongoid.yml')))[Rails.env.to_s]['sessions']['default'] db = config['database'] host = config['hosts'][0].split(':')[0] port = config['hosts'][0].split(':')[1] clear = "mongod --host #{host} --port #{port} --db #{db} --eval 'db.DropDatabase()'" desc clear task :clear do zfben_rails_rake_system clear end backup = "mongodump --host #{host} --port #{port} --db #{db}" desc backup task :dump do zfben_rails_rake_system backup end restore = "mongorestore --host #{host} --port #{port}" desc restore task :restore do zfben_rails_rake_system restore end repair = "mongod --nohttpinterface --nojournal --port #{port} --bind_ip #{host} --dbpath #{Rails.root}/mongo --repair" desc repair task :repair do zfben_rails_rake_system repair end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
h2ocube_rails_tasks-0.0.2 | lib/h2ocube_rails_tasks/tasks/mongodb.rb |