Sha256: 8382db0b33566447ad31dc3aba5f0028944f205a9e451dbcdfb386e746a26a2c

Contents?: true

Size: 567 Bytes

Versions: 9

Compression:

Stored size: 567 Bytes

Contents

require 'pact_broker/tasks'

PactBroker::DB::MigrationTask.new do | task |
  require 'pact_broker/db'
  task.database_connection = DB::PACT_BROKER_DB
end


namespace :db do
  desc 'drop and recreate DB'
  task :recreate => [:drop, 'pact_broker:db:migrate']

  desc 'drop DB'
  task :drop do
    require 'yaml'
    puts "Removing database #{db_file}"
    FileUtils.rm_f db_file
    FileUtils.mkdir_p File.dirname(db_file)
  end

  def db_file
    @@db_file ||= YAML.load(ERB.new(File.read(File.join('./config', 'database.yml'))).result)[RACK_ENV]["database"]
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pact_broker-0.0.10 tasks/db.rake
pact_broker-0.0.9 tasks/db.rake
pact_broker-0.0.8 tasks/db.rake
pact_broker-0.0.7 tasks/db.rake
pact_broker-0.0.6 tasks/db.rake
pact_broker-0.0.5 tasks/db.rake
pact_broker-0.0.4 tasks/db.rake
pact_broker-0.0.3 tasks/db.rake
pact_broker-0.0.2 tasks/db.rake