Sha256: 22a4671eb8df4f81f5f6b384acb13d96595c4ff3aa6bb50800441f989c7e3853

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

namespace :spot do
  desc "Migrate the core Spontaneous database"
  task :migrate do
    Spontaneous.database.logger = Spontaneous.logger
    Sequel.extension :migration
    Sequel::Migrator.apply(Spontaneous.database, Spontaneous.gem_dir('db/migrations'))
  end
end

namespace :db do
  desc "Make a dump of the current database"
  task :dump do
    dumpfilename = ENV['dumpfile']
    if dumpfilename.nil?
      dumpfilename = "#{Time.now.to_i}.mysql.gz"
    end
    dump_file = "tmp/#{dumpfilename}"
    dumper = Spontaneous::Utils::Database.dumper_for_database
    # Spontaneous::Cli::Site::MySQL.new(Spontaneous.database)
    dumper.dump(dump_file)
  end

  desc "Load a database dump into the local database"
  task :load do
    dumpfile = ENV['dumpfile']
    if dumpfile.nil?
      $stderr.puts "Usage: rake spot:database:load dumpfile=/path/to/dump.mysql.gz"
      exit 1
    end
    dumper = Spontaneous::Utils::Database.dumper_for_database
    # dumper = Spontaneous::Cli::Site::MySQL.new(Spontaneous.database)
    dumper.load(dumpfile)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta5 lib/spontaneous/tasks/database.rake
spontaneous-0.2.0.beta4 lib/spontaneous/tasks/database.rake
spontaneous-0.2.0.beta3 lib/spontaneous/tasks/database.rake
spontaneous-0.2.0.beta2 lib/spontaneous/tasks/database.rake
spontaneous-0.2.0.beta1 lib/spontaneous/tasks/database.rake
spontaneous-0.2.0.alpha7 lib/spontaneous/tasks/database.rake
spontaneous-0.2.0.alpha6 lib/spontaneous/tasks/database.rake
spontaneous-0.2.0.alpha5 lib/spontaneous/tasks/database.rake
spontaneous-0.2.0.alpha4 lib/spontaneous/tasks/database.rake
spontaneous-0.2.0.alpha3 lib/spontaneous/tasks/database.rake