Sha256: c14d00a13e28fe827c93346fb034443de44d364614aa734e4d7cd142100fded8

Contents?: true

Size: 523 Bytes

Versions: 1

Compression:

Stored size: 523 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
  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

1 entries across 1 versions & 1 rubygems

Version Path
pact_broker-0.0.1 tasks/db.rake