determinator 0.11.1 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +46 -2
- data/examples/determinator-rails/Gemfile.lock +22 -17
- data/lib/determinator.rb +9 -0
- data/lib/determinator/retrieve/routemaster.rb +5 -3
- data/lib/determinator/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ccc82084d2734ddf50ebb5900f73b9e985bd05f
|
4
|
+
data.tar.gz: 1b231a0fc9228692f357a2db213a170c046fb92e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 968a15520388364e962099c8d762431c38a7ff21825263352f506ace9ee568f03564e2aa5428d9ede53c46a33a2d7c3e482da4339d9503ecaf890b7cdf18a850
|
7
|
+
data.tar.gz: fbe0fface76305e3348c76647f34272df03a0fde293db796d565db8fe3e615c7ebcfd743288d783e7c2892c3847afed85e849b35ca987cb10ada1d24121174d4
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# v0.12.0 (2018-01-23)
|
2
|
+
|
3
|
+
Feature:
|
4
|
+
- Adds the `Determinator.feature_details` method, which allows lookup of feature details as are currently available to Determinator. Whatever is returned here is what Determinator is acting upon. (#38)
|
5
|
+
|
6
|
+
Bug Fix:
|
7
|
+
- Upgrades a dependency of the example rails app which has a known vulnerability. (#39)
|
8
|
+
|
1
9
|
# v0.11.1 (2017-10-27)
|
2
10
|
|
3
11
|
Feature:
|
data/README.md
CHANGED
@@ -2,14 +2,26 @@
|
|
2
2
|
|
3
3
|
A gem that works with _Florence_ to deterministically calculate whether an **actor** should have a feature flag turned on or off, or which variant they should see in an experiment.
|
4
4
|
|
5
|
-
![Determinator](docs/img/determinator.jpg)
|
5
|
+
![Arnold Schwarzenegger might say "Come with me if you want to experiment" if he played The Determinator instead of The Terminator.](docs/img/determinator.jpg)
|
6
6
|
|
7
|
-
|
7
|
+
---
|
8
|
+
|
9
|
+
#### Useful documentation
|
8
10
|
|
9
11
|
- [Terminology and Background](docs/background.md)
|
10
12
|
- [Local development](docs/local_development.md)
|
11
13
|
- [Example implemention in Rails](examples/determinator-rails)
|
12
14
|
|
15
|
+
#### Getting help
|
16
|
+
|
17
|
+
For Deliveroo Employees:
|
18
|
+
|
19
|
+
- Many people contribute to Determinator and Florence. We hang out in [this Slack channel](slack://channel?team=T03EUNC3F&id=C7437816J)
|
20
|
+
- [This JIRA board](https://deliveroo.atlassian.net/secure/RapidBoard.jspa?rapidView=156) covers pieces of work that are planned or in-flight
|
21
|
+
- [This Workplace group](https://deliveroo.facebook.com/groups/1893254264328414/) holds more general discussions about the Florence ecosystem
|
22
|
+
|
23
|
+
At the moment we can only promise support for Determinator within Deliveroo, but if you add [issues to this github repo](https://github.com/deliveroo/determinator/issues) we'll try and help if we can!
|
24
|
+
|
13
25
|
## Usage
|
14
26
|
|
15
27
|
Once [set up](#installation), determinator can be used to determine whether a **feature flag** or **experiment** is on or off for the current user and, for experiments, which **variant** they should see.
|
@@ -67,6 +79,38 @@ Determinator.configure(
|
|
67
79
|
)
|
68
80
|
```
|
69
81
|
|
82
|
+
### Using Determinator in RSpec
|
83
|
+
|
84
|
+
* Include those lines in `spec_helper.rb`.
|
85
|
+
|
86
|
+
|
87
|
+
```
|
88
|
+
require 'rspec/determinator'
|
89
|
+
|
90
|
+
Determinator.configure(retrieval: nil)
|
91
|
+
|
92
|
+
```
|
93
|
+
|
94
|
+
* Tag your rspec test with `:determinator_support`, so `forced_determination` helper method will be available.
|
95
|
+
|
96
|
+
|
97
|
+
```
|
98
|
+
|
99
|
+
RSpec.describe "something", :determinator_support do
|
100
|
+
|
101
|
+
context "something" do
|
102
|
+
forced_determination(:my_feature_flag, true)
|
103
|
+
forced_determination(:my_experiment, "variant_a")
|
104
|
+
|
105
|
+
it "uses forced_determination" do
|
106
|
+
expect(Determinator.instance.feature_flag_on?(:my_feature_flag)).to eq(true)
|
107
|
+
expect(Determinator.instance.which_variant(:my_experiment)).to eq("variant_a")
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
```
|
113
|
+
|
70
114
|
### Retrieval Cache
|
71
115
|
|
72
116
|
Determinator will function fully without a retrieval_cache set, although Determinator will produce 1 Redis query for every determination. By setting a `retrieval_cache` as an instance of `ActiveSupport::Cache::MemoryStore` (or equivalent) this can be reduced per application instance. This cache is not expired so *must* have a `expires_in` set, ideally to a short amount of time.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
|
-
determinator (0.1
|
5
|
-
routemaster-drain (~>
|
4
|
+
determinator (0.11.1)
|
5
|
+
routemaster-drain (~> 3.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -44,11 +44,14 @@ GEM
|
|
44
44
|
i18n (~> 0.7)
|
45
45
|
minitest (~> 5.1)
|
46
46
|
tzinfo (~> 1.1)
|
47
|
-
addressable (2.5.
|
48
|
-
public_suffix (
|
47
|
+
addressable (2.5.2)
|
48
|
+
public_suffix (>= 2.0.2, < 4.0)
|
49
49
|
arel (7.1.4)
|
50
50
|
builder (3.2.3)
|
51
51
|
byebug (9.0.6)
|
52
|
+
circuitbox (1.1.1)
|
53
|
+
activesupport
|
54
|
+
moneta
|
52
55
|
concurrent-ruby (1.0.5)
|
53
56
|
connection_pool (2.2.1)
|
54
57
|
dotenv (2.2.0)
|
@@ -56,16 +59,16 @@ GEM
|
|
56
59
|
dotenv (= 2.2.0)
|
57
60
|
railties (>= 3.2, < 5.1)
|
58
61
|
erubis (2.7.0)
|
59
|
-
ethon (0.
|
62
|
+
ethon (0.11.0)
|
60
63
|
ffi (>= 1.3.0)
|
61
|
-
faraday (0.
|
64
|
+
faraday (0.14.0)
|
62
65
|
multipart-post (>= 1.2, < 3)
|
63
|
-
faraday_middleware (0.
|
66
|
+
faraday_middleware (0.12.2)
|
64
67
|
faraday (>= 0.7.4, < 1.0)
|
65
68
|
ffi (1.9.18)
|
66
69
|
globalid (0.3.7)
|
67
70
|
activesupport (>= 4.1.0)
|
68
|
-
hashie (3.5.
|
71
|
+
hashie (3.5.7)
|
69
72
|
i18n (0.8.1)
|
70
73
|
loofah (2.0.3)
|
71
74
|
nokogiri (>= 1.5.9)
|
@@ -75,13 +78,14 @@ GEM
|
|
75
78
|
mime-types (3.1)
|
76
79
|
mime-types-data (~> 3.2015)
|
77
80
|
mime-types-data (3.2016.0521)
|
78
|
-
mini_portile2 (2.
|
81
|
+
mini_portile2 (2.3.0)
|
79
82
|
minitest (5.10.1)
|
83
|
+
moneta (1.0.0)
|
80
84
|
multipart-post (2.0.0)
|
81
85
|
nio4r (2.0.0)
|
82
|
-
nokogiri (1.
|
83
|
-
mini_portile2 (~> 2.
|
84
|
-
public_suffix (
|
86
|
+
nokogiri (1.8.1)
|
87
|
+
mini_portile2 (~> 2.3.0)
|
88
|
+
public_suffix (3.0.1)
|
85
89
|
puma (3.8.2)
|
86
90
|
rack (2.0.1)
|
87
91
|
rack-protection (1.5.3)
|
@@ -113,10 +117,11 @@ GEM
|
|
113
117
|
thor (>= 0.18.1, < 2.0)
|
114
118
|
rake (12.0.0)
|
115
119
|
redis (3.3.3)
|
116
|
-
redis-namespace (1.
|
117
|
-
redis (
|
118
|
-
routemaster-drain (
|
120
|
+
redis-namespace (1.6.0)
|
121
|
+
redis (>= 3.0.4)
|
122
|
+
routemaster-drain (3.4.0)
|
119
123
|
addressable
|
124
|
+
circuitbox
|
120
125
|
concurrent-ruby
|
121
126
|
faraday (>= 0.9.0)
|
122
127
|
faraday_middleware
|
@@ -139,7 +144,7 @@ GEM
|
|
139
144
|
sprockets (>= 3.0.0)
|
140
145
|
thor (0.19.4)
|
141
146
|
thread_safe (0.3.6)
|
142
|
-
typhoeus (1.
|
147
|
+
typhoeus (1.3.0)
|
143
148
|
ethon (>= 0.9.0)
|
144
149
|
tzinfo (1.2.3)
|
145
150
|
thread_safe (~> 0.1)
|
@@ -160,4 +165,4 @@ DEPENDENCIES
|
|
160
165
|
sidekiq
|
161
166
|
|
162
167
|
BUNDLED WITH
|
163
|
-
1.
|
168
|
+
1.16.0
|
data/lib/determinator.rb
CHANGED
@@ -15,11 +15,20 @@ module Determinator
|
|
15
15
|
@instance = Control.new(retrieval: retrieval)
|
16
16
|
end
|
17
17
|
|
18
|
+
# @return [Determinator::Control] The currently active instance of determinator.
|
19
|
+
# @raises [RuntimeError] If no Determinator instance is set up (with `.configure`)
|
18
20
|
def self.instance
|
19
21
|
raise "No singleton Determinator instance defined" unless @instance
|
20
22
|
@instance
|
21
23
|
end
|
22
24
|
|
25
|
+
# Returns the feature with the given name as Determinator uses it. This is useful for
|
26
|
+
# debugging issues with the retrieval mechanism which delivers features to Determinator.
|
27
|
+
# @returns [Determinator::Feature,nil] The feature details Determinator would use for a determination right now.
|
28
|
+
def self.feature_details(name)
|
29
|
+
instance.retrieval.retrieve(name)
|
30
|
+
end
|
31
|
+
|
23
32
|
def self.notice_error(error)
|
24
33
|
return unless @error_logger
|
25
34
|
|
@@ -27,9 +27,11 @@ module Determinator
|
|
27
27
|
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
# Retrieves and processes the feature that goes by the given name on this retrieval mechanism.
|
31
|
+
# @return [Determinator::Feature,nil] The details of the specified feature
|
32
|
+
def retrieve(name)
|
33
|
+
cached_feature_lookup(name) do
|
34
|
+
@actor_service.feature.show(name)
|
33
35
|
end
|
34
36
|
rescue ::Routemaster::Errors::ResourceNotFound
|
35
37
|
# Don't be noisy
|
data/lib/determinator/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: determinator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Hastings-Spital
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: routemaster-drain
|
@@ -211,3 +211,4 @@ signing_key:
|
|
211
211
|
specification_version: 4
|
212
212
|
summary: Determine which experiments and features a specific actor should see.
|
213
213
|
test_files: []
|
214
|
+
has_rdoc:
|