-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
37 lines (30 loc) · 898 Bytes
/
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
# frozen_string_literal: true
require 'rake/testtask'
require 'rubocop/rake_task'
Dir['tasks/*.rake'].each { |f| load f }
task default: [:test]
task test: ['test:unit', 'test:integration', 'rubocop']
RuboCop::RakeTask.new
namespace(:test) do
Rake::TestTask.new(:integration) do |t|
t.pattern = "test/integration/*_test.rb"
end
Rake::TestTask.new(:unit) do |t|
t.pattern = "test/unit/*_test.rb"
end
end
namespace(:db) do
desc "Run migrations"
task :migrate, [:version] do |t, args|
require 'sequel'
Sequel.extension(:migration)
db = Sequel.connect(ENV.fetch('DATABASE_URL', 'postgres://localhost/wikimum'))
if args[:version]
puts "Migrating to version #{args[:version]}"
Sequel::Migrator.run(db, 'migrations', target: args[:version].to_i)
else
puts "Migrating to latest"
Sequel::Migrator.run(db, 'migrations')
end
end
end