Sha256: c4635d467be4aac221581e7ef0c8572e1938212ce6b73435c222bd1a01094bb2

Contents?: true

Size: 817 Bytes

Versions: 8

Compression:

Stored size: 817 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]

    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} --drop"
    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

8 entries across 8 versions & 1 rubygems

Version Path
h2ocube_rails_tasks-0.0.14 lib/h2ocube_rails_tasks/tasks/mongodb.rb
h2ocube_rails_tasks-0.0.13 lib/h2ocube_rails_tasks/tasks/mongodb.rb
h2ocube_rails_tasks-0.0.12 lib/h2ocube_rails_tasks/tasks/mongodb.rb
h2ocube_rails_tasks-0.0.11 lib/h2ocube_rails_tasks/tasks/mongodb.rb
h2ocube_rails_tasks-0.0.10 lib/h2ocube_rails_tasks/tasks/mongodb.rb
h2ocube_rails_tasks-0.0.9 lib/h2ocube_rails_tasks/tasks/mongodb.rb
h2ocube_rails_tasks-0.0.8 lib/h2ocube_rails_tasks/tasks/mongodb.rb
h2ocube_rails_tasks-0.0.7 lib/h2ocube_rails_tasks/tasks/mongodb.rb