-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
53 lines (43 loc) · 1.04 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# frozen_string_literal: true
require 'rake/testtask'
Rake::TestTask.new(:spec) do |t|
t.pattern = 'spec/*_spec.rb'
t.warning = false
end
namespace :db do
task :_setup do
require 'sequel'
require_relative 'init'
Sequel.extension :migration
end
desc 'Run database migrations'
task migrate: [:_setup] do
puts "Migrating to latest for: #{ENV['RACK_ENV'] || 'development'}"
Sequel::Migrator.run(DB, 'db/migrations')
end
desc 'Reset migrations (full rollback and migration)'
task reset: [:_setup] do
Sequel::Migrator.run(DB, 'db/migrations', target: 0)
Sequel::Migrator.run(DB, 'db/migrations')
end
end
desc 'delete cassette fixtures'
task :wipe do
sh 'rm spec/fixtures/cassettes/*.yml' do |ok, _|
puts(ok ? 'Cassettes deleted' : 'No casseettes found')
end
end
namespace :quality do
CODE = 'app.rb'
desc 'run all quality checks'
task all: [:rubocop, :flog, :flay]
task :flog do
sh "flog #{CODE}"
end
task :flay do
sh "flay #{CODE}"
end
task :rubocop do
sh 'rubocop'
end
end