this_feature-adapters-flipper 0.4.1 → 0.5.0
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/Gemfile.lock +6 -6
- data/README.md +27 -38
- data/lib/this_feature.rb +4 -0
- data/lib/this_feature/adapters/base.rb +0 -5
- data/lib/this_feature/configuration.rb +5 -2
- data/lib/this_feature/version.rb +1 -1
- data/memory +0 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0847ea9efa6fbb2220fde21f3ceb9bc0afc2ab346cdad21bc31baeba8b63be16'
|
4
|
+
data.tar.gz: 9ab147e60b74ce5c218b774faea6ab4cf42b22b953527cfd6ac98dacd0d185e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e80169640735a7f5cf5b1cf914a7151d1f7141a130d85c1e1db28b9bf12d6c7283852460a4c670687b4590931798bc7ebe1f650b0ef931fb4ed25a35a712165
|
7
|
+
data.tar.gz: 9d41296adb7c33692ca93244a0debe2470cfb8a4322dd5d598c0f4578ab53e4600c333d22786616c7c776b130000a608c50cc7f6450fe7e3e008b06b7f58db32
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
this_feature (0.
|
5
|
-
this_feature-adapters-flipper (0.
|
4
|
+
this_feature (0.5.0)
|
5
|
+
this_feature-adapters-flipper (0.5.0)
|
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.5.0)
|
10
10
|
splitclient-rb
|
11
11
|
this_feature
|
12
12
|
|
@@ -35,10 +35,10 @@ GEM
|
|
35
35
|
diff-lcs (1.3)
|
36
36
|
faraday (1.0.1)
|
37
37
|
multipart-post (>= 1.2, < 3)
|
38
|
-
flipper (0.
|
39
|
-
flipper-active_record (0.
|
38
|
+
flipper (0.19.0)
|
39
|
+
flipper-active_record (0.19.0)
|
40
40
|
activerecord (>= 5.0, < 7)
|
41
|
-
flipper (~> 0.
|
41
|
+
flipper (~> 0.19.0)
|
42
42
|
gem-release (2.1.1)
|
43
43
|
hitimes (1.3.1)
|
44
44
|
i18n (1.8.5)
|
data/README.md
CHANGED
@@ -1,65 +1,44 @@
|
|
1
1
|
# ThisFeature
|
2
2
|
|
3
|
-
|
3
|
+
**A common interface to interact with many feature flag providers.**
|
4
4
|
|
5
|
-
|
5
|
+
Can be used to more easily migrate among providers.
|
6
|
+
|
7
|
+
If your code uses ThisFeature,
|
8
|
+
then you can just swap out the adapter without having to do a bunch of find-and-replace.
|
6
9
|
|
7
|
-
|
10
|
+
## Installation
|
8
11
|
|
9
12
|
```ruby
|
10
13
|
gem 'this_feature'
|
11
14
|
```
|
12
15
|
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
```sh
|
16
|
-
bundle
|
17
|
-
```
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
```sh
|
22
|
-
gem install this_feature
|
23
|
-
```
|
24
|
-
|
25
16
|
## Configuration
|
26
17
|
|
27
18
|
```ruby
|
28
19
|
# config/initializers/this_feature.rb
|
29
20
|
require 'this_feature'
|
21
|
+
require 'this_feature/adapters/memory'
|
30
22
|
|
31
23
|
ThisFeature.configure do |config|
|
32
|
-
|
33
|
-
config.
|
24
|
+
adapter = ThisFeature::Adapters::Memory.new
|
25
|
+
config.adapters = [adapter]
|
26
|
+
config.default_adapter = adapter
|
34
27
|
end
|
35
28
|
```
|
36
29
|
|
37
30
|
**NOTE**: When searching for the presence of a flag, adapters are queried in order. The default adapter is the fallback adapter used when a flag isn't present in any of the adapters.
|
38
31
|
|
39
|
-
|
40
|
-
### With Flipper
|
41
|
-
|
42
|
-
```ruby
|
43
|
-
# config/initializers/this_feature.rb
|
44
|
-
require 'this_feature/adapters/flipper'
|
45
|
-
|
46
|
-
ThisFeature.configure do |config|
|
47
|
-
config.adapters = [ThisFeature::Adapters::Flipper]
|
48
|
-
config.default_adapter = config.adapters.first
|
49
|
-
end
|
50
|
-
```
|
51
|
-
|
52
|
-
|
53
|
-
|
54
32
|
## Usage
|
55
33
|
|
56
34
|
### Flags
|
35
|
+
|
57
36
|
```ruby
|
58
|
-
ThisFeature.flag('flag_name').on?
|
59
|
-
ThisFeature.flag('flag_name').off?
|
60
|
-
ThisFeature.flag('flag_name').control? #
|
61
|
-
ThisFeature.flag('flag_name').
|
62
|
-
ThisFeature.
|
37
|
+
ThisFeature.flag('flag_name').on? # is the flag is turned on?
|
38
|
+
ThisFeature.flag('flag_name').off? # is the flag is turned off?
|
39
|
+
ThisFeature.flag('flag_name').control? # is the adapter is using the control?
|
40
|
+
ThisFeature.flag('flag_name').present? # is the flag set at all?
|
41
|
+
ThisFeature.default_adapter # access the default adapter directly if needed
|
63
42
|
```
|
64
43
|
|
65
44
|
### Context
|
@@ -78,8 +57,13 @@ In case context is not sufficient, you can also pass a data hash.
|
|
78
57
|
ThisFeature.flag('flag_name', context: context, data: { org_id: 1 }).on?
|
79
58
|
```
|
80
59
|
|
81
|
-
##
|
60
|
+
## Available Adapters
|
61
|
+
|
62
|
+
These adapters do behave slightly differently, so make sure to read the following docs:
|
82
63
|
|
64
|
+
- [Flipper adapter](./docs/flipper.md)
|
65
|
+
- [Split.io adapter](./docs/splitio.md)
|
66
|
+
- [Memory adapter](./docs/memory.md) - **very helpful to use in tests**
|
83
67
|
|
84
68
|
## Development
|
85
69
|
|
@@ -90,6 +74,11 @@ You can run the tests with these commands in your Terminal:
|
|
90
74
|
bundle install && bundle exec rspec
|
91
75
|
```
|
92
76
|
|
77
|
+
To write a new adapter, check the [Guide](./docs/writing_an_adapter.md).
|
78
|
+
|
93
79
|
## License
|
94
80
|
|
95
81
|
ThisFeature is released under the [MIT License](https://choosealicense.com/licenses/mit).
|
82
|
+
|
83
|
+
|
84
|
+
|
data/lib/this_feature.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
|
2
1
|
class ThisFeature
|
3
2
|
class Configuration
|
4
|
-
attr_writer :adapters, :default_adapter
|
3
|
+
attr_writer :adapters, :default_adapter, :test_adapter
|
5
4
|
|
6
5
|
def init
|
7
6
|
validate_adapters!
|
@@ -20,5 +19,9 @@ class ThisFeature
|
|
20
19
|
def default_adapter
|
21
20
|
@default_adapter ||= adapters.first
|
22
21
|
end
|
22
|
+
|
23
|
+
def test_adapter
|
24
|
+
@test_adapter ||= Adapters::Memory.new
|
25
|
+
end
|
23
26
|
end
|
24
27
|
end
|
data/lib/this_feature/version.rb
CHANGED
data/memory
CHANGED
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.5.0
|
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: 2020-09-
|
11
|
+
date: 2020-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: this_feature
|
@@ -85,7 +85,7 @@ homepage: http://hover.to
|
|
85
85
|
licenses:
|
86
86
|
- MIT
|
87
87
|
metadata: {}
|
88
|
-
post_install_message:
|
88
|
+
post_install_message:
|
89
89
|
rdoc_options: []
|
90
90
|
require_paths:
|
91
91
|
- lib
|
@@ -100,8 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
|
-
rubygems_version: 3.
|
104
|
-
signing_key:
|
103
|
+
rubygems_version: 3.0.3
|
104
|
+
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: "[summary]"
|
107
107
|
test_files: []
|