determinator 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Guardfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +34 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/determinator.gemspec +31 -0
- data/docs/img/determinator.jpg +0 -0
- data/examples/determinator-rails/.env +7 -0
- data/examples/determinator-rails/.gitignore +15 -0
- data/examples/determinator-rails/Gemfile +16 -0
- data/examples/determinator-rails/Gemfile.lock +163 -0
- data/examples/determinator-rails/Procfile +2 -0
- data/examples/determinator-rails/README.md +35 -0
- data/examples/determinator-rails/Rakefile +3 -0
- data/examples/determinator-rails/app/controllers/application_controller.rb +20 -0
- data/examples/determinator-rails/app/controllers/index_controller.rb +9 -0
- data/examples/determinator-rails/app/jobs/application_job.rb +2 -0
- data/examples/determinator-rails/bin/bundle +3 -0
- data/examples/determinator-rails/bin/rails +4 -0
- data/examples/determinator-rails/bin/rake +4 -0
- data/examples/determinator-rails/config.ru +3 -0
- data/examples/determinator-rails/config/application.rb +18 -0
- data/examples/determinator-rails/config/boot.rb +3 -0
- data/examples/determinator-rails/config/environment.rb +2 -0
- data/examples/determinator-rails/config/environments/development.rb +18 -0
- data/examples/determinator-rails/config/environments/production.rb +17 -0
- data/examples/determinator-rails/config/environments/test.rb +13 -0
- data/examples/determinator-rails/config/initializers/determinator.rb +7 -0
- data/examples/determinator-rails/config/initializers/filter_parameter_logging.rb +1 -0
- data/examples/determinator-rails/config/initializers/new_framework_defaults.rb +3 -0
- data/examples/determinator-rails/config/initializers/wrap_parameters.rb +3 -0
- data/examples/determinator-rails/config/puma.rb +5 -0
- data/examples/determinator-rails/config/routes.rb +6 -0
- data/examples/determinator-rails/config/secrets.yml +8 -0
- data/examples/determinator-rails/config/sidekiq.yml +2 -0
- data/examples/determinator-rails/public/favicon.ico +0 -0
- data/examples/determinator-rails/public/robots.txt +5 -0
- data/lib/determinator.rb +16 -0
- data/lib/determinator/actor_control.rb +41 -0
- data/lib/determinator/control.rb +119 -0
- data/lib/determinator/feature.rb +48 -0
- data/lib/determinator/retrieve/routemaster.rb +70 -0
- data/lib/determinator/retrieve/routemaster_indexing_middleware.rb +28 -0
- data/lib/determinator/target_group.rb +28 -0
- data/lib/determinator/version.rb +3 -0
- metadata +193 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dcb22efe5a32a1ca4ff4d09429db1841c120e4a5
|
4
|
+
data.tar.gz: 1545a4cd7a88843ebae697d5eaab95fd33c95872
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 00893237a50d3d90bddfbfe436a8912e3603a19cf33ec6d3460050ccd9acf53a9dafce7afcd197e8303b0d0ead288104269746865d5dbe917e828f1875d8a423
|
7
|
+
data.tar.gz: c9b4037f91b5dbe4ea8cd05c64c6515c9d035eabc1ff9397dd0a9fc7a957dc130103dbddc86f0d4ba5e6143f0f3e8daa0f6d24700f5f333320c4587106a1c218
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at jp@deliveroo.co.uk. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 JP Hastings-Spital
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Determinator
|
2
|
+
|
3
|
+
A gem that works with [Florence](https://github.com/deliveroo/actor-tracking) to deterministically calculate whether an actor (a customer, rider, restaurant or employee) should have a feature flag turned on or off, or which variant they should see in an experiment.
|
4
|
+
|
5
|
+
![Determinator](docs/img/determinator.jpg)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'determinator'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install determinator
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Check the example Rails app in `examples` for more information on how to make use of this gem.
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/determinator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
30
|
+
|
31
|
+
## License
|
32
|
+
|
33
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
34
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "determinator"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'determinator/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "determinator"
|
8
|
+
spec.version = Determinator::VERSION
|
9
|
+
spec.authors = ["JP Hastings-Spital"]
|
10
|
+
spec.email = ["jp@deliveroo.co.uk"]
|
11
|
+
|
12
|
+
spec.summary = %q{Determine which experiments and features a specific actor should see.}
|
13
|
+
spec.homepage = "https://github.com/deliveroo/determinator"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_runtime_dependency "routemaster-drain", "~> 2.5"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
+
spec.add_development_dependency "rspec-its", "~> 1.2"
|
29
|
+
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
30
|
+
spec.add_development_dependency "factory_girl", "~> 4.8"
|
31
|
+
end
|
Binary file
|
@@ -0,0 +1,7 @@
|
|
1
|
+
ROUTEMASTER_DRAIN_TOKENS=demo
|
2
|
+
ROUTEMASTER_DRAIN_REDIS=redis://localhost/0/routemaster/drain
|
3
|
+
ROUTEMASTER_CACHE_REDIS=redis://localhost/0/routemaster/cache
|
4
|
+
ROUTEMASTER_CACHE_AUTH=
|
5
|
+
ROUTEMASTER_QUEUE_ADAPTER=sidekiq
|
6
|
+
ROUTEMASTER_QUEUE_NAME=routemaster
|
7
|
+
ROUTEMASTER_CALLBACK_URL=https://determinator-example.dev/events
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore all logfiles and tempfiles.
|
11
|
+
/log/*
|
12
|
+
/tmp/*
|
13
|
+
|
14
|
+
# Ignore Byebug command history file.
|
15
|
+
.byebug_history
|
@@ -0,0 +1,16 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rails', '~> 5.0.2'
|
4
|
+
gem 'puma', '~> 3.0'
|
5
|
+
gem 'sidekiq'
|
6
|
+
|
7
|
+
gem 'determinator', path: '../..'
|
8
|
+
|
9
|
+
group :development, :test do
|
10
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
11
|
+
gem 'byebug', platform: :mri
|
12
|
+
gem 'dotenv-rails'
|
13
|
+
end
|
14
|
+
|
15
|
+
group :development do
|
16
|
+
end
|
@@ -0,0 +1,163 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../..
|
3
|
+
specs:
|
4
|
+
determinator (0.1.0)
|
5
|
+
routemaster-drain (~> 2.5)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actioncable (5.0.2)
|
11
|
+
actionpack (= 5.0.2)
|
12
|
+
nio4r (>= 1.2, < 3.0)
|
13
|
+
websocket-driver (~> 0.6.1)
|
14
|
+
actionmailer (5.0.2)
|
15
|
+
actionpack (= 5.0.2)
|
16
|
+
actionview (= 5.0.2)
|
17
|
+
activejob (= 5.0.2)
|
18
|
+
mail (~> 2.5, >= 2.5.4)
|
19
|
+
rails-dom-testing (~> 2.0)
|
20
|
+
actionpack (5.0.2)
|
21
|
+
actionview (= 5.0.2)
|
22
|
+
activesupport (= 5.0.2)
|
23
|
+
rack (~> 2.0)
|
24
|
+
rack-test (~> 0.6.3)
|
25
|
+
rails-dom-testing (~> 2.0)
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
+
actionview (5.0.2)
|
28
|
+
activesupport (= 5.0.2)
|
29
|
+
builder (~> 3.1)
|
30
|
+
erubis (~> 2.7.0)
|
31
|
+
rails-dom-testing (~> 2.0)
|
32
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
33
|
+
activejob (5.0.2)
|
34
|
+
activesupport (= 5.0.2)
|
35
|
+
globalid (>= 0.3.6)
|
36
|
+
activemodel (5.0.2)
|
37
|
+
activesupport (= 5.0.2)
|
38
|
+
activerecord (5.0.2)
|
39
|
+
activemodel (= 5.0.2)
|
40
|
+
activesupport (= 5.0.2)
|
41
|
+
arel (~> 7.0)
|
42
|
+
activesupport (5.0.2)
|
43
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
44
|
+
i18n (~> 0.7)
|
45
|
+
minitest (~> 5.1)
|
46
|
+
tzinfo (~> 1.1)
|
47
|
+
addressable (2.5.0)
|
48
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
49
|
+
arel (7.1.4)
|
50
|
+
builder (3.2.3)
|
51
|
+
byebug (9.0.6)
|
52
|
+
concurrent-ruby (1.0.5)
|
53
|
+
connection_pool (2.2.1)
|
54
|
+
dotenv (2.2.0)
|
55
|
+
dotenv-rails (2.2.0)
|
56
|
+
dotenv (= 2.2.0)
|
57
|
+
railties (>= 3.2, < 5.1)
|
58
|
+
erubis (2.7.0)
|
59
|
+
ethon (0.10.1)
|
60
|
+
ffi (>= 1.3.0)
|
61
|
+
faraday (0.11.0)
|
62
|
+
multipart-post (>= 1.2, < 3)
|
63
|
+
faraday_middleware (0.11.0.1)
|
64
|
+
faraday (>= 0.7.4, < 1.0)
|
65
|
+
ffi (1.9.18)
|
66
|
+
globalid (0.3.7)
|
67
|
+
activesupport (>= 4.1.0)
|
68
|
+
hashie (3.5.5)
|
69
|
+
i18n (0.8.1)
|
70
|
+
loofah (2.0.3)
|
71
|
+
nokogiri (>= 1.5.9)
|
72
|
+
mail (2.6.4)
|
73
|
+
mime-types (>= 1.16, < 4)
|
74
|
+
method_source (0.8.2)
|
75
|
+
mime-types (3.1)
|
76
|
+
mime-types-data (~> 3.2015)
|
77
|
+
mime-types-data (3.2016.0521)
|
78
|
+
mini_portile2 (2.1.0)
|
79
|
+
minitest (5.10.1)
|
80
|
+
multipart-post (2.0.0)
|
81
|
+
nio4r (2.0.0)
|
82
|
+
nokogiri (1.7.1)
|
83
|
+
mini_portile2 (~> 2.1.0)
|
84
|
+
public_suffix (2.0.5)
|
85
|
+
puma (3.8.2)
|
86
|
+
rack (2.0.1)
|
87
|
+
rack-protection (1.5.3)
|
88
|
+
rack
|
89
|
+
rack-test (0.6.3)
|
90
|
+
rack (>= 1.0)
|
91
|
+
rails (5.0.2)
|
92
|
+
actioncable (= 5.0.2)
|
93
|
+
actionmailer (= 5.0.2)
|
94
|
+
actionpack (= 5.0.2)
|
95
|
+
actionview (= 5.0.2)
|
96
|
+
activejob (= 5.0.2)
|
97
|
+
activemodel (= 5.0.2)
|
98
|
+
activerecord (= 5.0.2)
|
99
|
+
activesupport (= 5.0.2)
|
100
|
+
bundler (>= 1.3.0, < 2.0)
|
101
|
+
railties (= 5.0.2)
|
102
|
+
sprockets-rails (>= 2.0.0)
|
103
|
+
rails-dom-testing (2.0.2)
|
104
|
+
activesupport (>= 4.2.0, < 6.0)
|
105
|
+
nokogiri (~> 1.6)
|
106
|
+
rails-html-sanitizer (1.0.3)
|
107
|
+
loofah (~> 2.0)
|
108
|
+
railties (5.0.2)
|
109
|
+
actionpack (= 5.0.2)
|
110
|
+
activesupport (= 5.0.2)
|
111
|
+
method_source
|
112
|
+
rake (>= 0.8.7)
|
113
|
+
thor (>= 0.18.1, < 2.0)
|
114
|
+
rake (12.0.0)
|
115
|
+
redis (3.3.3)
|
116
|
+
redis-namespace (1.5.3)
|
117
|
+
redis (~> 3.0, >= 3.0.4)
|
118
|
+
routemaster-drain (2.5.0)
|
119
|
+
addressable
|
120
|
+
concurrent-ruby
|
121
|
+
faraday (>= 0.9.0)
|
122
|
+
faraday_middleware
|
123
|
+
hashie
|
124
|
+
rack (>= 1.4.5)
|
125
|
+
redis-namespace
|
126
|
+
typhoeus (~> 1.1)
|
127
|
+
wisper (~> 1.6.1)
|
128
|
+
sidekiq (4.2.10)
|
129
|
+
concurrent-ruby (~> 1.0)
|
130
|
+
connection_pool (~> 2.2, >= 2.2.0)
|
131
|
+
rack-protection (>= 1.5.0)
|
132
|
+
redis (~> 3.2, >= 3.2.1)
|
133
|
+
sprockets (3.7.1)
|
134
|
+
concurrent-ruby (~> 1.0)
|
135
|
+
rack (> 1, < 3)
|
136
|
+
sprockets-rails (3.2.0)
|
137
|
+
actionpack (>= 4.0)
|
138
|
+
activesupport (>= 4.0)
|
139
|
+
sprockets (>= 3.0.0)
|
140
|
+
thor (0.19.4)
|
141
|
+
thread_safe (0.3.6)
|
142
|
+
typhoeus (1.1.2)
|
143
|
+
ethon (>= 0.9.0)
|
144
|
+
tzinfo (1.2.3)
|
145
|
+
thread_safe (~> 0.1)
|
146
|
+
websocket-driver (0.6.5)
|
147
|
+
websocket-extensions (>= 0.1.0)
|
148
|
+
websocket-extensions (0.1.2)
|
149
|
+
wisper (1.6.1)
|
150
|
+
|
151
|
+
PLATFORMS
|
152
|
+
ruby
|
153
|
+
|
154
|
+
DEPENDENCIES
|
155
|
+
byebug
|
156
|
+
determinator!
|
157
|
+
dotenv-rails
|
158
|
+
puma (~> 3.0)
|
159
|
+
rails (~> 5.0.2)
|
160
|
+
sidekiq
|
161
|
+
|
162
|
+
BUNDLED WITH
|
163
|
+
1.13.6
|