Sha256: 3ecaa648b5e0d0768087d53292133a80c63f52da062b023d43fa765e3a8797d0

Contents?: true

Size: 679 Bytes

Versions: 1

Compression:

Stored size: 679 Bytes

Contents

require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task default: :spec
task "db:prepare" do
  require "dotenv"
  Dotenv.load(".env.development")
  sh "createdb #{env_database_name}" do
    # Ignore errors
  end

  Dotenv.overload(".env.test")
  sh "createdb #{env_database_name}" do
    # Ignore errors
  end
end

task "db:drop" do
  require "dotenv"
  Dotenv.load(".env.development")
  sh "dropdb #{env_database_name}" do
    # Ignore errors
  end

  Dotenv.overload(".env.test")
  sh "dropdb #{env_database_name}" do
    # Ignore errors
  end
end

def env_database_name
  require "uri"
  ENV.fetch("DATABASE_URL").split("/").last
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blood_contracts-1.0.0 Rakefile