This repository has been archived by the owner on Jun 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathRakefile
executable file
·68 lines (57 loc) · 1.91 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
66
67
68
#!/usr/bin/env rake
$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
task test: :spec
rescue LoadError
warn 'Could not load RSpec tasks'
end
namespace :bundler do
task :setup do
require 'bundler/setup'
end
end
task :environment, [:env] => 'bundler:setup' do |_cmd, args|
ENV['RACK_ENV'] ||= ENV['RAILS_ENV'] || args[:env] || 'development'
end
namespace :db do
desc 'Run DB migrations'
task migrate: :environment do |_cmd, _args|
Bandiera::Db.migrate
end
desc 'Rollback the DB'
task rollback: :environment do |_cmd, _args|
Bandiera::Db.rollback
end
task demo_reset: :environment do |_cmd, _args|
db = Bandiera::Db.connect
serv = Bandiera::FeatureService.new(db: db)
db[:groups].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