this_feature-adapters-flipper 0.5.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +33 -29
- data/README.md +1 -1
- data/lib/this_feature/adapters/flipper.rb +1 -7
- data/lib/this_feature/adapters/memory.rb +5 -5
- data/lib/this_feature/adapters/split_io.rb +12 -11
- data/lib/this_feature/configuration.rb +2 -0
- data/lib/this_feature/errors.rb +2 -2
- data/lib/this_feature/version.rb +1 -1
- data/memory +0 -0
- data/this_feature-0.6.0.gem +0 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59fad6c074fe4555362a332da9c2be41ee793da92a4c4d4b9569b5dcc02043df
|
4
|
+
data.tar.gz: d73ef69e4524b58b890db551f63caee673bb66b1e87aaef0f260951a1e7d0c1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaaa6a00c083509395ee5c21acfc6475cc3291273d41a3d3d16026c985680444e02ed3000a26232e3eebf577adb0a9a1ae01344ddf39fce5c7987130c7bce575
|
7
|
+
data.tar.gz: a8e3e946918977ae9c34af2233bd46efcab168f6e54381b5ceda0418f03044b01554cd378ad1a04ac303f1c9d812601eda662fd93e64cfc1aedcc1f7cd6febd1
|
data/Gemfile.lock
CHANGED
@@ -1,55 +1,58 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
this_feature (0.
|
5
|
-
this_feature-adapters-flipper (0.
|
4
|
+
this_feature (0.6.1)
|
5
|
+
this_feature-adapters-flipper (0.6.1)
|
6
6
|
flipper (~> 0.16)
|
7
7
|
flipper-active_record (~> 0.16)
|
8
8
|
this_feature
|
9
|
-
this_feature-adapters-split_io (0.
|
9
|
+
this_feature-adapters-split_io (0.6.1)
|
10
10
|
splitclient-rb
|
11
11
|
this_feature
|
12
12
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
15
15
|
specs:
|
16
|
-
activemodel (6.
|
17
|
-
activesupport (= 6.
|
18
|
-
activerecord (6.
|
19
|
-
activemodel (= 6.
|
20
|
-
activesupport (= 6.
|
21
|
-
activesupport (6.
|
16
|
+
activemodel (6.1.3)
|
17
|
+
activesupport (= 6.1.3)
|
18
|
+
activerecord (6.1.3)
|
19
|
+
activemodel (= 6.1.3)
|
20
|
+
activesupport (= 6.1.3)
|
21
|
+
activesupport (6.1.3)
|
22
22
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
23
|
-
i18n (>=
|
24
|
-
minitest (
|
25
|
-
tzinfo (~>
|
26
|
-
zeitwerk (~> 2.
|
23
|
+
i18n (>= 1.6, < 2)
|
24
|
+
minitest (>= 5.1)
|
25
|
+
tzinfo (~> 2.0)
|
26
|
+
zeitwerk (~> 2.3)
|
27
27
|
byebug (11.1.2)
|
28
28
|
coderay (1.1.2)
|
29
|
-
concurrent-ruby (1.1.
|
29
|
+
concurrent-ruby (1.1.8)
|
30
30
|
connection_pool (2.2.3)
|
31
31
|
database_cleaner (1.8.4)
|
32
32
|
database_cleaner-active_record (1.8.0)
|
33
33
|
activerecord
|
34
34
|
database_cleaner (~> 1.8.0)
|
35
35
|
diff-lcs (1.3)
|
36
|
-
faraday (1.0
|
36
|
+
faraday (1.3.0)
|
37
|
+
faraday-net_http (~> 1.0)
|
37
38
|
multipart-post (>= 1.2, < 3)
|
38
|
-
|
39
|
-
|
39
|
+
ruby2_keywords
|
40
|
+
faraday-net_http (1.0.1)
|
41
|
+
flipper (0.20.3)
|
42
|
+
flipper-active_record (0.20.3)
|
40
43
|
activerecord (>= 5.0, < 7)
|
41
|
-
flipper (~> 0.
|
42
|
-
gem-release (2.
|
44
|
+
flipper (~> 0.20.3)
|
45
|
+
gem-release (2.2.1)
|
43
46
|
hitimes (1.3.1)
|
44
|
-
i18n (1.8.
|
47
|
+
i18n (1.8.9)
|
45
48
|
concurrent-ruby (~> 1.0)
|
46
|
-
json (2.
|
49
|
+
json (2.5.1)
|
47
50
|
jwt (2.2.2)
|
48
51
|
lru_redux (1.1.0)
|
49
52
|
method_source (1.0.0)
|
50
|
-
minitest (5.14.
|
53
|
+
minitest (5.14.4)
|
51
54
|
multipart-post (2.1.1)
|
52
|
-
net-http-persistent (4.0.
|
55
|
+
net-http-persistent (4.0.1)
|
53
56
|
connection_pool (~> 2.2)
|
54
57
|
pry (0.13.1)
|
55
58
|
coderay (~> 1.1)
|
@@ -58,7 +61,7 @@ GEM
|
|
58
61
|
byebug (~> 11.0)
|
59
62
|
pry (~> 0.13.0)
|
60
63
|
rake (13.0.1)
|
61
|
-
redis (4.2.
|
64
|
+
redis (4.2.5)
|
62
65
|
rspec (3.9.0)
|
63
66
|
rspec-core (~> 3.9.0)
|
64
67
|
rspec-expectations (~> 3.9.0)
|
@@ -72,23 +75,24 @@ GEM
|
|
72
75
|
diff-lcs (>= 1.2.0, < 2.0)
|
73
76
|
rspec-support (~> 3.9.0)
|
74
77
|
rspec-support (3.9.2)
|
78
|
+
ruby2_keywords (0.0.4)
|
75
79
|
socketry (0.5.1)
|
76
80
|
hitimes (~> 1.2)
|
77
|
-
splitclient-rb (7.
|
81
|
+
splitclient-rb (7.2.3)
|
78
82
|
concurrent-ruby (~> 1.0)
|
79
83
|
faraday (>= 0.8)
|
80
84
|
json (>= 1.8)
|
81
85
|
jwt (>= 2.2.1)
|
82
86
|
lru_redux
|
83
87
|
net-http-persistent (>= 2.9)
|
84
|
-
redis (>=
|
88
|
+
redis (>= 4.2.2)
|
85
89
|
socketry (~> 0.5.1)
|
86
90
|
thread_safe (>= 0.3)
|
87
91
|
sqlite3 (1.4.2)
|
88
92
|
thread_safe (0.3.6)
|
89
|
-
tzinfo (
|
90
|
-
|
91
|
-
zeitwerk (2.4.
|
93
|
+
tzinfo (2.0.4)
|
94
|
+
concurrent-ruby (~> 1.0)
|
95
|
+
zeitwerk (2.4.2)
|
92
96
|
|
93
97
|
PLATFORMS
|
94
98
|
ruby
|
data/README.md
CHANGED
@@ -63,7 +63,7 @@ These adapters do behave slightly differently, so make sure to read the followin
|
|
63
63
|
|
64
64
|
- [Flipper adapter](./docs/flipper.md)
|
65
65
|
- [Split.io adapter](./docs/splitio.md)
|
66
|
-
- [Memory adapter](./docs/memory.md) - **
|
66
|
+
- [Memory adapter](./docs/memory.md) - **designed for use in tests**
|
67
67
|
|
68
68
|
## Development
|
69
69
|
|
@@ -19,17 +19,11 @@ class ThisFeature
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def on?(flag_name, context: nil, data: {})
|
22
|
-
return unless present?(flag_name)
|
23
|
-
|
24
22
|
client[flag_name].enabled?(*[context].compact)
|
25
23
|
end
|
26
24
|
|
27
25
|
def off?(flag_name, context: nil, data: {})
|
28
|
-
|
29
|
-
|
30
|
-
return if on_result.nil?
|
31
|
-
|
32
|
-
!on_result
|
26
|
+
!on?(flag_name, context: context)
|
33
27
|
end
|
34
28
|
|
35
29
|
private
|
@@ -15,7 +15,7 @@ class ThisFeature
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def on?(flag_name, context: nil, data: {})
|
18
|
-
return unless present?(flag_name)
|
18
|
+
return false unless present?(flag_name)
|
19
19
|
|
20
20
|
flag_data = storage[flag_name]
|
21
21
|
|
@@ -28,11 +28,11 @@ class ThisFeature
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def off?(flag_name, context: nil, data: {})
|
31
|
-
|
32
|
-
|
33
|
-
return if on_result.nil?
|
31
|
+
!on?(flag_name, context: context, data: data)
|
32
|
+
end
|
34
33
|
|
35
|
-
|
34
|
+
def control?(flag_name, **kwargs)
|
35
|
+
!present?(flag_name)
|
36
36
|
end
|
37
37
|
|
38
38
|
def on!(flag_name, context: nil, data: {})
|
@@ -6,8 +6,9 @@ class ThisFeature
|
|
6
6
|
# used as treatment key when none is given, it's required by split
|
7
7
|
UNDEFINED_KEY = 'undefined_key'
|
8
8
|
|
9
|
-
def initialize(client: nil)
|
9
|
+
def initialize(client: nil, context_key_method: nil)
|
10
10
|
@client = client || default_split_client
|
11
|
+
@context_key_method = context_key_method
|
11
12
|
|
12
13
|
@client.block_until_ready
|
13
14
|
end
|
@@ -30,18 +31,18 @@ class ThisFeature
|
|
30
31
|
|
31
32
|
private
|
32
33
|
|
33
|
-
attr_reader :client
|
34
|
+
attr_reader :client, :context_key_method
|
34
35
|
|
35
36
|
def treatment(flag_name, context: UNDEFINED_KEY, data: {})
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
37
|
+
client.get_treatment(context_key(context), flag_name, data)
|
38
|
+
end
|
39
|
+
|
40
|
+
def context_key(context)
|
41
|
+
return UNDEFINED_KEY if context.nil? || context.eql?(UNDEFINED_KEY)
|
42
|
+
return context.send(context_key_method) unless context_key_method.nil?
|
43
|
+
return context.to_s if context.respond_to?(:to_s)
|
44
|
+
|
45
|
+
context
|
45
46
|
end
|
46
47
|
|
47
48
|
def default_split_client
|
data/lib/this_feature/errors.rb
CHANGED
@@ -14,9 +14,9 @@ class ThisFeature
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
class
|
17
|
+
class NoAdaptersError < Error
|
18
18
|
def initialize
|
19
|
-
super("
|
19
|
+
super("No adapters configured.")
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
data/lib/this_feature/version.rb
CHANGED
data/memory
CHANGED
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: this_feature-adapters-flipper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Pleaner
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: this_feature
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/this_feature/flag.rb
|
79
79
|
- lib/this_feature/version.rb
|
80
80
|
- memory
|
81
|
+
- this_feature-0.6.0.gem
|
81
82
|
- this_feature-adapters-flipper.gemspec
|
82
83
|
- this_feature-adapters-split_io.gemspec
|
83
84
|
- this_feature.gemspec
|
@@ -85,7 +86,7 @@ homepage: http://hover.to
|
|
85
86
|
licenses:
|
86
87
|
- MIT
|
87
88
|
metadata: {}
|
88
|
-
post_install_message:
|
89
|
+
post_install_message:
|
89
90
|
rdoc_options: []
|
90
91
|
require_paths:
|
91
92
|
- lib
|
@@ -100,8 +101,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
101
|
- !ruby/object:Gem::Version
|
101
102
|
version: '0'
|
102
103
|
requirements: []
|
103
|
-
rubygems_version: 3.
|
104
|
-
signing_key:
|
104
|
+
rubygems_version: 3.1.2
|
105
|
+
signing_key:
|
105
106
|
specification_version: 4
|
106
107
|
summary: "[summary]"
|
107
108
|
test_files: []
|