require "minitest/test_task" require "sequel" task default: :test namespace :db do desc "Run migrations" task :migrate, [:version] do |t, args| require "sequel/core" Sequel.extension :migration version = args[:version].to_i if args[:version] Sequel.connect(ENV.fetch("DATABASE_URL")) do |db| Sequel::Migrator.run(db, "db/migrations", target: version) end end end Minitest::TestTask.create(:test) do |t| t.test_globs = ["test/**/test_*.rb"] end namespace :test do desc "Run tests on Ruby file changes" task :watch do sh "fd .*.rb | entr -d rake test" end end