flipper-rollout 1.4.2 → 1.5.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/flipper/adapters/rollout.rb +4 -0
- data/lib/flipper/version.rb +1 -1
- metadata +7 -11
- data/examples/rollout/basic.rb +0 -26
- data/examples/rollout/import.rb +0 -33
- data/flipper-rollout.gemspec +0 -26
- data/spec/flipper/adapters/rollout_spec.rb +0 -161
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 99f1be57834c2e74ba417bafcf5cc144bb9cb1bc3acac88796d15e20082766d8
|
|
4
|
+
data.tar.gz: 7db1252475cc5cfbdd7336c620125bdb10d599801aef1071e73e266fc0dbcbf6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b1869fc97e5dc321c7c6485d30772544c43005b5d250812d9376ec4fae114e56adf92301e7801b185f666bbeecda2d8ac6d82e376e955ce31337d1b66c1b6e1
|
|
7
|
+
data.tar.gz: fca57f5ad181897903d942bf649ab887426adbf01320676a9794d053b9d6857e9adeec2814457162c42f6c6082034fc891104ca7a9db2e8cf4256cc38abb24dd
|
|
@@ -43,6 +43,10 @@ module Flipper
|
|
|
43
43
|
rollout_feature.percentage
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
+
# Rollout's built-in :all group is on for every user, but off when
|
|
47
|
+
# there is no user, which is how 100% of actors behaves.
|
|
48
|
+
percentage_of_actors = 100 if groups.delete?("all")
|
|
49
|
+
|
|
46
50
|
{
|
|
47
51
|
boolean: boolean,
|
|
48
52
|
groups: groups,
|
data/lib/flipper/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: flipper-rollout
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.5.0.rc1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Nunemaker
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: flipper
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 1.
|
|
19
|
+
version: 1.5.0.rc1
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 1.
|
|
26
|
+
version: 1.5.0.rc1
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: redis
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -33,7 +33,7 @@ dependencies:
|
|
|
33
33
|
version: '2.2'
|
|
34
34
|
- - "<"
|
|
35
35
|
- !ruby/object:Gem::Version
|
|
36
|
-
version: '
|
|
36
|
+
version: '7'
|
|
37
37
|
type: :runtime
|
|
38
38
|
prerelease: false
|
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -43,7 +43,7 @@ dependencies:
|
|
|
43
43
|
version: '2.2'
|
|
44
44
|
- - "<"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '
|
|
46
|
+
version: '7'
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: rollout
|
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -64,12 +64,8 @@ executables: []
|
|
|
64
64
|
extensions: []
|
|
65
65
|
extra_rdoc_files: []
|
|
66
66
|
files:
|
|
67
|
-
- examples/rollout/basic.rb
|
|
68
|
-
- examples/rollout/import.rb
|
|
69
|
-
- flipper-rollout.gemspec
|
|
70
67
|
- lib/flipper/adapters/rollout.rb
|
|
71
68
|
- lib/flipper/version.rb
|
|
72
|
-
- spec/flipper/adapters/rollout_spec.rb
|
|
73
69
|
homepage: https://www.flippercloud.io/docs/adapters/rollout
|
|
74
70
|
licenses:
|
|
75
71
|
- MIT
|
|
@@ -78,7 +74,7 @@ metadata:
|
|
|
78
74
|
homepage_uri: https://www.flippercloud.io
|
|
79
75
|
source_code_uri: https://github.com/flippercloud/flipper
|
|
80
76
|
bug_tracker_uri: https://github.com/flippercloud/flipper/issues
|
|
81
|
-
changelog_uri: https://github.com/flippercloud/flipper/releases/tag/v1.
|
|
77
|
+
changelog_uri: https://github.com/flippercloud/flipper/releases/tag/v1.5.0.rc1
|
|
82
78
|
funding_uri: https://github.com/sponsors/flippercloud
|
|
83
79
|
post_install_message:
|
|
84
80
|
rdoc_options: []
|
data/examples/rollout/basic.rb
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
require 'bundler/setup'
|
|
2
|
-
require 'redis'
|
|
3
|
-
require 'rollout'
|
|
4
|
-
require 'flipper'
|
|
5
|
-
require 'flipper/adapters/rollout'
|
|
6
|
-
|
|
7
|
-
redis = Redis.new
|
|
8
|
-
rollout = Rollout.new(redis)
|
|
9
|
-
rollout.activate(:stats)
|
|
10
|
-
|
|
11
|
-
adapter = Flipper::Adapters::Rollout.new(rollout)
|
|
12
|
-
flipper = Flipper.new(adapter)
|
|
13
|
-
|
|
14
|
-
if flipper[:stats].enabled?
|
|
15
|
-
puts "Enabled!"
|
|
16
|
-
else
|
|
17
|
-
puts "Disabled!"
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
rollout.deactivate(:stats)
|
|
21
|
-
|
|
22
|
-
if flipper[:stats].enabled?
|
|
23
|
-
puts "Enabled!"
|
|
24
|
-
else
|
|
25
|
-
puts "Disabled!"
|
|
26
|
-
end
|
data/examples/rollout/import.rb
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
require 'bundler/setup'
|
|
2
|
-
require 'redis'
|
|
3
|
-
require 'rollout'
|
|
4
|
-
require 'flipper'
|
|
5
|
-
require 'flipper/adapters/redis'
|
|
6
|
-
require 'flipper/adapters/rollout'
|
|
7
|
-
|
|
8
|
-
# setup redis, rollout and rollout flipper
|
|
9
|
-
redis = Redis.new
|
|
10
|
-
rollout = Rollout.new(redis)
|
|
11
|
-
rollout_adapter = Flipper::Adapters::Rollout.new(rollout)
|
|
12
|
-
rollout_flipper = Flipper.new(rollout_adapter)
|
|
13
|
-
|
|
14
|
-
# setup flipper default instance
|
|
15
|
-
Flipper.configure do |config|
|
|
16
|
-
config.adapter { Flipper::Adapters::Redis.new(redis) }
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# flush redis so we have clean state for script
|
|
20
|
-
redis.flushdb
|
|
21
|
-
|
|
22
|
-
# activate some rollout stuff to show that importing works
|
|
23
|
-
rollout.activate(:stats)
|
|
24
|
-
rollout.activate_user(:search, Struct.new(:id).new(1))
|
|
25
|
-
rollout.activate_group(:admin, :admins)
|
|
26
|
-
|
|
27
|
-
# import rollout into redis flipper
|
|
28
|
-
Flipper.import(rollout_flipper)
|
|
29
|
-
|
|
30
|
-
# demonstrate that the rollout enablements made it into flipper
|
|
31
|
-
p Flipper[:stats].boolean_value # true
|
|
32
|
-
p Flipper[:search].actors_value # #<Set: {"1"}>
|
|
33
|
-
p Flipper[:admin].groups_value # #<Set: {"admins"}>
|
data/flipper-rollout.gemspec
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
|
-
require File.expand_path('../lib/flipper/version', __FILE__)
|
|
3
|
-
require File.expand_path('../lib/flipper/metadata', __FILE__)
|
|
4
|
-
|
|
5
|
-
flipper_rollout_files = lambda do |file|
|
|
6
|
-
file =~ /rollout/
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
Gem::Specification.new do |gem|
|
|
10
|
-
gem.authors = ['John Nunemaker']
|
|
11
|
-
gem.email = 'support@flippercloud.io'
|
|
12
|
-
gem.summary = 'Rollout feature flag adapter for Flipper'
|
|
13
|
-
gem.license = 'MIT'
|
|
14
|
-
gem.homepage = 'https://www.flippercloud.io/docs/adapters/rollout'
|
|
15
|
-
|
|
16
|
-
gem.files = `git ls-files`.split("\n").select(&flipper_rollout_files) + ['lib/flipper/version.rb']
|
|
17
|
-
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_rollout_files)
|
|
18
|
-
gem.name = 'flipper-rollout'
|
|
19
|
-
gem.require_paths = ['lib']
|
|
20
|
-
gem.version = Flipper::VERSION
|
|
21
|
-
gem.metadata = Flipper::METADATA
|
|
22
|
-
|
|
23
|
-
gem.add_dependency 'flipper', "~> #{Flipper::VERSION}"
|
|
24
|
-
gem.add_dependency 'redis', '>= 2.2', '< 5'
|
|
25
|
-
gem.add_dependency 'rollout', "~> 2.0"
|
|
26
|
-
end
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
require 'redis'
|
|
2
|
-
require 'rollout'
|
|
3
|
-
require 'flipper/adapters/rollout'
|
|
4
|
-
|
|
5
|
-
RSpec.describe Flipper::Adapters::Rollout do
|
|
6
|
-
let(:redis) { Redis.new }
|
|
7
|
-
let(:rollout) { Rollout.new(redis) }
|
|
8
|
-
let(:source_adapter) { described_class.new(rollout) }
|
|
9
|
-
let(:source_flipper) { Flipper.new(source_adapter) }
|
|
10
|
-
let(:destination_adapter) { Flipper::Adapters::Memory.new }
|
|
11
|
-
let(:destination_flipper) { Flipper.new(destination_adapter) }
|
|
12
|
-
|
|
13
|
-
before do
|
|
14
|
-
skip_on_error(Redis::CannotConnectError, 'Redis not available') do
|
|
15
|
-
redis.flushdb
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
describe '#name' do
|
|
20
|
-
it 'has name that is a symbol' do
|
|
21
|
-
expect(source_adapter.name).not_to be_nil
|
|
22
|
-
expect(source_adapter.name).to be_instance_of(Symbol)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
describe '#get' do
|
|
27
|
-
it 'returns hash of gate data' do
|
|
28
|
-
rollout.activate_user(:chat, Struct.new(:id).new(1))
|
|
29
|
-
rollout.activate_percentage(:chat, 20)
|
|
30
|
-
rollout.activate_group(:chat, :admins)
|
|
31
|
-
feature = source_flipper[:chat]
|
|
32
|
-
expected = {
|
|
33
|
-
boolean: nil,
|
|
34
|
-
groups: Set.new(["admins"]),
|
|
35
|
-
actors: Set.new(["1"]),
|
|
36
|
-
expression: nil,
|
|
37
|
-
percentage_of_actors: 20.0,
|
|
38
|
-
percentage_of_time: nil,
|
|
39
|
-
}
|
|
40
|
-
expect(source_adapter.get(feature)).to eq(expected)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it 'returns fully flipper enabled for fully rollout activated' do
|
|
44
|
-
rollout.activate(:chat)
|
|
45
|
-
feature = source_flipper[:chat]
|
|
46
|
-
expected = {
|
|
47
|
-
boolean: true,
|
|
48
|
-
groups: Set.new,
|
|
49
|
-
actors: Set.new,
|
|
50
|
-
expression: nil,
|
|
51
|
-
percentage_of_actors: nil,
|
|
52
|
-
percentage_of_time: nil,
|
|
53
|
-
}
|
|
54
|
-
expect(source_adapter.get(feature)).to eq(expected)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
it 'returns fully flipper enabled for fully rollout activated with user/group' do
|
|
58
|
-
rollout.activate_user(:chat, Struct.new(:id).new(1))
|
|
59
|
-
rollout.activate_group(:chat, :admins)
|
|
60
|
-
rollout.activate(:chat)
|
|
61
|
-
feature = source_flipper[:chat]
|
|
62
|
-
expected = {
|
|
63
|
-
boolean: true,
|
|
64
|
-
groups: Set.new,
|
|
65
|
-
actors: Set.new,
|
|
66
|
-
expression: nil,
|
|
67
|
-
percentage_of_actors: nil,
|
|
68
|
-
percentage_of_time: nil,
|
|
69
|
-
}
|
|
70
|
-
expect(source_adapter.get(feature)).to eq(expected)
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it 'returns default hash of gate data for feature not existing in rollout' do
|
|
74
|
-
feature = source_flipper[:chat]
|
|
75
|
-
expect(source_adapter.get(feature)).to eq(source_adapter.default_config)
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
describe '#features' do
|
|
80
|
-
it 'returns all feature keys' do
|
|
81
|
-
rollout.activate(:chat)
|
|
82
|
-
rollout.activate(:messaging)
|
|
83
|
-
rollout.activate(:push_notifications)
|
|
84
|
-
expect(source_adapter.features).to match_array([:chat, :messaging, :push_notifications])
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
it 'can have one feature imported' do
|
|
89
|
-
rollout.activate(:search)
|
|
90
|
-
destination_flipper.import(source_flipper)
|
|
91
|
-
expect(destination_flipper.features.map(&:key)).to eq(["search"])
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
it 'can have multiple features imported' do
|
|
95
|
-
rollout.activate(:yep)
|
|
96
|
-
rollout.activate_group(:preview_features, :developers)
|
|
97
|
-
rollout.activate_group(:preview_features, :marketers)
|
|
98
|
-
rollout.activate_group(:preview_features, :company)
|
|
99
|
-
rollout.activate_group(:preview_features, :early_access)
|
|
100
|
-
rollout.activate_user(:preview_features, Struct.new(:id).new(1))
|
|
101
|
-
rollout.activate_user(:preview_features, Struct.new(:id).new(2))
|
|
102
|
-
rollout.activate_user(:preview_features, Struct.new(:id).new(3))
|
|
103
|
-
rollout.activate_percentage(:issues_next, 25)
|
|
104
|
-
|
|
105
|
-
destination_flipper.import(source_flipper)
|
|
106
|
-
|
|
107
|
-
feature = destination_flipper[:yep]
|
|
108
|
-
expect(feature.boolean_value).to eq(true)
|
|
109
|
-
|
|
110
|
-
feature = destination_flipper[:preview_features]
|
|
111
|
-
expect(feature.boolean_value).to be(false)
|
|
112
|
-
expect(feature.actors_value).to eq(Set['1', '2', '3'])
|
|
113
|
-
expected_groups = Set['developers', 'marketers', 'company', 'early_access']
|
|
114
|
-
expect(feature.groups_value).to eq(expected_groups)
|
|
115
|
-
expect(feature.percentage_of_actors_value).to be(0)
|
|
116
|
-
|
|
117
|
-
feature = destination_flipper[:issues_next]
|
|
118
|
-
expect(feature.boolean_value).to eq(false)
|
|
119
|
-
expect(feature.actors_value).to eq(Set.new)
|
|
120
|
-
expect(feature.groups_value).to eq(Set.new)
|
|
121
|
-
expect(feature.percentage_of_actors_value).to be(25.0)
|
|
122
|
-
|
|
123
|
-
feature = destination_flipper[:verbose_logging]
|
|
124
|
-
expect(feature.boolean_value).to eq(false)
|
|
125
|
-
expect(feature.actors_value).to eq(Set.new)
|
|
126
|
-
expect(feature.groups_value).to eq(Set.new)
|
|
127
|
-
expect(feature.percentage_of_actors_value).to be(0)
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
describe 'unsupported methods' do
|
|
131
|
-
it 'raises on add' do
|
|
132
|
-
expect { source_adapter.add(:feature) }
|
|
133
|
-
.to raise_error(Flipper::Adapters::Rollout::AdapterMethodNotSupportedError)
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
it 'raises on remove' do
|
|
137
|
-
expect { source_adapter.remove(:feature) }
|
|
138
|
-
.to raise_error(Flipper::Adapters::Rollout::AdapterMethodNotSupportedError)
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
it 'raises on clear' do
|
|
142
|
-
expect { source_adapter.clear(:feature) }
|
|
143
|
-
.to raise_error(Flipper::Adapters::Rollout::AdapterMethodNotSupportedError)
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
it 'raises on enable' do
|
|
147
|
-
expect { source_adapter.enable(:feature, :gate, :thing) }
|
|
148
|
-
.to raise_error(Flipper::Adapters::Rollout::AdapterMethodNotSupportedError)
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
it 'raises on disable' do
|
|
152
|
-
expect { source_adapter.disable(:feature, :gate, :thing) }
|
|
153
|
-
.to raise_error(Flipper::Adapters::Rollout::AdapterMethodNotSupportedError)
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
it 'raises on import' do
|
|
157
|
-
expect { source_adapter.import(:source_adapter) }
|
|
158
|
-
.to raise_error(Flipper::Adapters::Rollout::AdapterMethodNotSupportedError)
|
|
159
|
-
end
|
|
160
|
-
end
|
|
161
|
-
end
|