Rakefile in blood_contracts-0.2.1 vs Rakefile in blood_contracts-1.0.0

- old
+ new

@@ -2,5 +2,35 @@ 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