This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
executable file
·65 lines (54 loc) · 1.46 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
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env rake
# frozen_string_literal: true
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/lib")
require 'bandiera'
require 'bandiera/anonymous_audit_context'
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new
task default: :spec
desc 'Run the test suite (RSpec)'
task test: :spec
rescue LoadError
warn 'Could not load RSpec tasks'
end
desc 'Run Bandiera.init'
task :init do
Bandiera.init
end
namespace :db do
desc 'Run DB migrations'
task migrate: %i[init] do
Bandiera::Db.migrate
end
desc 'Rollback the DB'
task rollback: %i[init] do
Bandiera::Db.rollback
end
task dev_setup: %i[migrate] do
db = Bandiera::Db.connect
serv = Bandiera::FeatureService.new
db[:groups].delete
db[:features].delete
db[:audit_records].delete
serv.add_features(
Bandiera::AnonymousAuditContext.new,
[
{ group: 'pubserv',
name: 'show-article-metrics',
description: 'Show metrics on the article pages?',
active: true },
{ group: 'pubserv',
name: 'show-new-search',
description: 'Show the new search feature?',
active: true,
percentage: 50 },
{ group: 'pubserv',
name: 'show-reorganised-homepage',
description: 'Show the new homepage layout?',
active: true,
user_groups: { list: ['editor'], regex: '' } }
]
)
end
end