flipper 0.12.2 → 0.24.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +1 -0
- data/.github/workflows/ci.yml +62 -0
- data/.github/workflows/examples.yml +67 -0
- data/.rspec +1 -0
- data/Changelog.md +263 -3
- data/Dockerfile +1 -1
- data/Gemfile +13 -16
- data/README.md +59 -56
- data/Rakefile +10 -2
- data/docker-compose.yml +37 -34
- data/docs/DockerCompose.md +0 -1
- data/docs/README.md +1 -0
- data/docs/images/banner.jpg +0 -0
- data/examples/api/basic.ru +19 -0
- data/examples/api/custom_memoized.ru +37 -0
- data/examples/api/memoized.ru +43 -0
- data/examples/basic.rb +1 -13
- data/examples/configuring_default.rb +2 -6
- data/examples/dsl.rb +13 -25
- data/examples/enabled_for_actor.rb +8 -16
- data/examples/group.rb +3 -7
- data/examples/group_dynamic_lookup.rb +5 -20
- data/examples/group_with_members.rb +4 -15
- data/examples/importing.rb +1 -1
- data/examples/individual_actor.rb +2 -6
- data/examples/instrumentation.rb +1 -3
- data/examples/instrumentation_last_accessed_at.rb +37 -0
- data/examples/memoizing.rb +35 -0
- data/examples/percentage_of_actors.rb +6 -17
- data/examples/percentage_of_actors_enabled_check.rb +7 -11
- data/examples/percentage_of_actors_group.rb +5 -19
- data/examples/percentage_of_time.rb +3 -7
- data/flipper.gemspec +2 -1
- data/lib/flipper/actor.rb +4 -0
- data/lib/flipper/adapter.rb +7 -42
- data/lib/flipper/adapters/dual_write.rb +61 -0
- data/lib/flipper/adapters/failover.rb +83 -0
- data/lib/flipper/adapters/http/client.rb +23 -1
- data/lib/flipper/adapters/http/error.rb +19 -1
- data/lib/flipper/adapters/http.rb +32 -28
- data/lib/flipper/adapters/instrumented.rb +20 -19
- data/lib/flipper/adapters/memoizable.rb +8 -16
- data/lib/flipper/adapters/memory.rb +24 -95
- data/lib/flipper/adapters/operation_logger.rb +19 -2
- data/lib/flipper/adapters/pstore.rb +12 -4
- data/lib/flipper/adapters/read_only.rb +2 -0
- data/lib/flipper/adapters/sync/feature_synchronizer.rb +118 -0
- data/lib/flipper/adapters/sync/interval_synchronizer.rb +49 -0
- data/lib/flipper/adapters/sync/synchronizer.rb +63 -0
- data/lib/flipper/adapters/sync.rb +91 -0
- data/lib/flipper/configuration.rb +33 -7
- data/lib/flipper/dsl.rb +22 -5
- data/lib/flipper/errors.rb +17 -2
- data/lib/flipper/feature.rb +9 -4
- data/lib/flipper/gate_values.rb +1 -0
- data/lib/flipper/identifier.rb +17 -0
- data/lib/flipper/instrumenters/memory.rb +18 -2
- data/lib/flipper/metadata.rb +5 -0
- data/lib/flipper/middleware/memoizer.rb +31 -18
- data/lib/flipper/middleware/setup_env.rb +13 -3
- data/lib/flipper/railtie.rb +47 -0
- data/lib/flipper/spec/shared_adapter_specs.rb +27 -1
- data/lib/flipper/test/shared_adapter_test.rb +29 -2
- data/lib/flipper/type.rb +0 -7
- data/lib/flipper/typecast.rb +2 -0
- data/lib/flipper/types/actor.rb +8 -2
- data/lib/flipper/types/boolean.rb +2 -0
- data/lib/flipper/types/group.rb +8 -1
- data/lib/flipper/types/percentage.rb +2 -0
- data/lib/flipper/version.rb +1 -1
- data/lib/flipper.rb +22 -5
- data/spec/flipper/actor_spec.rb +10 -2
- data/spec/flipper/adapter_spec.rb +2 -5
- data/spec/flipper/adapters/dual_write_spec.rb +69 -0
- data/spec/flipper/adapters/failover_spec.rb +129 -0
- data/spec/flipper/adapters/http_spec.rb +114 -11
- data/spec/flipper/adapters/instrumented_spec.rb +2 -3
- data/spec/flipper/adapters/memoizable_spec.rb +0 -3
- data/spec/flipper/adapters/memory_spec.rb +21 -5
- data/spec/flipper/adapters/operation_logger_spec.rb +9 -3
- data/spec/flipper/adapters/pstore_spec.rb +0 -2
- data/spec/flipper/adapters/read_only_spec.rb +0 -1
- data/spec/flipper/adapters/sync/feature_synchronizer_spec.rb +208 -0
- data/spec/flipper/adapters/sync/interval_synchronizer_spec.rb +33 -0
- data/spec/flipper/adapters/sync/synchronizer_spec.rb +88 -0
- data/spec/flipper/adapters/sync_spec.rb +200 -0
- data/spec/flipper/configuration_spec.rb +20 -3
- data/spec/flipper/dsl_spec.rb +24 -5
- data/spec/flipper/feature_check_context_spec.rb +2 -4
- data/spec/flipper/feature_spec.rb +30 -10
- data/spec/flipper/gate_spec.rb +0 -2
- data/spec/flipper/gate_values_spec.rb +0 -1
- data/spec/flipper/gates/actor_spec.rb +0 -2
- data/spec/flipper/gates/boolean_spec.rb +0 -2
- data/spec/flipper/gates/group_spec.rb +0 -2
- data/spec/flipper/gates/percentage_of_actors_spec.rb +0 -2
- data/spec/flipper/gates/percentage_of_time_spec.rb +0 -2
- data/spec/flipper/identifier_spec.rb +13 -0
- data/spec/flipper/instrumentation/log_subscriber_spec.rb +0 -2
- data/spec/flipper/instrumentation/statsd_subscriber_spec.rb +0 -2
- data/spec/flipper/instrumenters/memory_spec.rb +18 -1
- data/spec/flipper/instrumenters/noop_spec.rb +14 -9
- data/spec/flipper/middleware/memoizer_spec.rb +94 -39
- data/spec/flipper/middleware/setup_env_spec.rb +23 -5
- data/spec/flipper/railtie_spec.rb +73 -0
- data/spec/flipper/registry_spec.rb +0 -1
- data/spec/flipper/typecast_spec.rb +0 -1
- data/spec/flipper/types/actor_spec.rb +0 -1
- data/spec/flipper/types/boolean_spec.rb +0 -1
- data/spec/flipper/types/group_spec.rb +22 -1
- data/spec/flipper/types/percentage_of_actors_spec.rb +0 -1
- data/spec/flipper/types/percentage_of_time_spec.rb +0 -1
- data/spec/flipper/types/percentage_spec.rb +0 -1
- data/spec/{integration_spec.rb → flipper_integration_spec.rb} +0 -2
- data/spec/flipper_spec.rb +30 -1
- data/spec/{helper.rb → spec_helper.rb} +5 -3
- data/spec/support/descriptions.yml +1 -0
- data/spec/support/spec_helpers.rb +22 -2
- data/test/adapters/memory_test.rb +0 -1
- data/test/test_helper.rb +2 -1
- data/{test → test_rails}/helper.rb +1 -1
- metadata +48 -25
- data/.rubocop.yml +0 -48
- data/.rubocop_todo.yml +0 -199
- data/docs/Adapters.md +0 -125
- data/docs/Caveats.md +0 -4
- data/docs/Gates.md +0 -167
- data/docs/Instrumentation.md +0 -27
- data/docs/Optimization.md +0 -119
- data/docs/api/README.md +0 -849
- data/docs/http/README.md +0 -35
- data/docs/read-only/README.md +0 -22
- data/examples/example_setup.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a73ea66b4ab3342f5cf63a162bf8b0482fdc644dc0fff38fcb2d3fa2b39015be
|
4
|
+
data.tar.gz: a680008dad6bc0affee30e0d150aab5cc869d46d37ac2ae3ce8b7b2f57de9e9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50d1ff58301b4040e2ac0ed6590c057952f3c926aa88371858cec083be2d5fcdb17920fa120f6c59f9a5625ad2260aa0cdf40c26dfa64239a4790f247287c720
|
7
|
+
data.tar.gz: 40d68ac75fde3051cece778aa09145891ca3cf289abb795c66695f3e3fac569c28e81864d3be386d7ab03d0fd9c1b9c303fca6f5865ef6a2cd4eb9edbdc12eee
|
data/.codeclimate.yml
CHANGED
@@ -0,0 +1,62 @@
|
|
1
|
+
name: CI
|
2
|
+
on: [push, pull_request]
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
name: Test on ruby ${{ matrix.ruby }} and rails ${{ matrix.rails }}
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
services:
|
8
|
+
redis:
|
9
|
+
image: redis
|
10
|
+
ports: ['6379:6379']
|
11
|
+
options: >-
|
12
|
+
--health-cmd "redis-cli ping"
|
13
|
+
--health-interval 10s
|
14
|
+
--health-timeout 5s
|
15
|
+
--health-retries 5
|
16
|
+
strategy:
|
17
|
+
matrix:
|
18
|
+
ruby: ['2.6', '2.7', '3.0', '3.1']
|
19
|
+
rails: ['5.2', '6.0.0', '6.1.0', '7.0.0']
|
20
|
+
exclude:
|
21
|
+
- ruby: "2.6"
|
22
|
+
rails: "7.0.0"
|
23
|
+
- ruby: "3.0"
|
24
|
+
rails: "5.2"
|
25
|
+
- ruby: "3.1"
|
26
|
+
rails: "5.2"
|
27
|
+
- ruby: "3.1"
|
28
|
+
rails: "6.0.0"
|
29
|
+
env:
|
30
|
+
SQLITE3_VERSION: 1.4.1
|
31
|
+
REDIS_URL: redis://localhost:6379/0
|
32
|
+
CI: true
|
33
|
+
steps:
|
34
|
+
- name: Setup memcached
|
35
|
+
uses: KeisukeYamashita/memcached-actions@v1
|
36
|
+
- name: Start MongoDB
|
37
|
+
uses: supercharge/mongodb-github-action@1.3.0
|
38
|
+
with:
|
39
|
+
mongodb-version: 4.0
|
40
|
+
- name: Check out repository code
|
41
|
+
uses: actions/checkout@v2
|
42
|
+
- name: Do some action caching
|
43
|
+
uses: actions/cache@v1
|
44
|
+
with:
|
45
|
+
path: vendor/bundle
|
46
|
+
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ hashFiles('**/Gemfile.lock') }}
|
47
|
+
restore-keys: |
|
48
|
+
${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-
|
49
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
50
|
+
uses: ruby/setup-ruby@v1
|
51
|
+
with:
|
52
|
+
ruby-version: ${{ matrix.ruby }}
|
53
|
+
- name: Install libpq-dev
|
54
|
+
run: sudo apt-get -yqq install libpq-dev
|
55
|
+
- name: Install bundler
|
56
|
+
run: gem install bundler
|
57
|
+
- name: Run Rake with Rails ${{ matrix.rails }}
|
58
|
+
env:
|
59
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
60
|
+
run: |
|
61
|
+
bundle install --jobs 4 --retry 3
|
62
|
+
bundle exec rake
|
@@ -0,0 +1,67 @@
|
|
1
|
+
name: Examples
|
2
|
+
on: [push, pull_request]
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
if: github.repository_owner == 'jnunemaker'
|
6
|
+
name: Test on ruby ${{ matrix.ruby }} and rails ${{ matrix.rails }}
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
services:
|
9
|
+
redis:
|
10
|
+
image: redis
|
11
|
+
ports: ['6379:6379']
|
12
|
+
options: >-
|
13
|
+
--health-cmd "redis-cli ping"
|
14
|
+
--health-interval 10s
|
15
|
+
--health-timeout 5s
|
16
|
+
--health-retries 5
|
17
|
+
strategy:
|
18
|
+
matrix:
|
19
|
+
ruby: ['2.6', '2.7', '3.0', '3.1']
|
20
|
+
rails: ['5.2', '6.0.0', '6.1.0', '7.0.0']
|
21
|
+
exclude:
|
22
|
+
- ruby: "2.6"
|
23
|
+
rails: "7.0.0"
|
24
|
+
- ruby: "3.0"
|
25
|
+
rails: "5.2"
|
26
|
+
- ruby: "3.1"
|
27
|
+
rails: "5.2"
|
28
|
+
- ruby: "3.1"
|
29
|
+
rails: "6.0.0"
|
30
|
+
|
31
|
+
env:
|
32
|
+
SQLITE3_VERSION: 1.4.1
|
33
|
+
REDIS_URL: redis://localhost:6379/0
|
34
|
+
CI: true
|
35
|
+
steps:
|
36
|
+
- name: Setup memcached
|
37
|
+
uses: KeisukeYamashita/memcached-actions@v1
|
38
|
+
- name: Start MongoDB
|
39
|
+
uses: supercharge/mongodb-github-action@1.3.0
|
40
|
+
with:
|
41
|
+
mongodb-version: 4.0
|
42
|
+
- name: Check out repository code
|
43
|
+
uses: actions/checkout@v2
|
44
|
+
- name: Do some action caching
|
45
|
+
uses: actions/cache@v1
|
46
|
+
with:
|
47
|
+
path: vendor/bundle
|
48
|
+
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ hashFiles('**/Gemfile.lock') }}
|
49
|
+
restore-keys: |
|
50
|
+
${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-
|
51
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
52
|
+
uses: ruby/setup-ruby@v1
|
53
|
+
with:
|
54
|
+
ruby-version: ${{ matrix.ruby }}
|
55
|
+
- name: Install libpq-dev
|
56
|
+
run: sudo apt-get -yqq install libpq-dev
|
57
|
+
- name: Install bundler
|
58
|
+
run: gem install bundler
|
59
|
+
- name: Bundle install with Rails ${{ matrix.rails }}
|
60
|
+
env:
|
61
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
62
|
+
run: bundle install --jobs 4 --retry 3
|
63
|
+
- name: Run Examples with Rails ${{ matrix.rails }}
|
64
|
+
env:
|
65
|
+
FLIPPER_CLOUD_TOKEN: ${{ secrets.FLIPPER_CLOUD_TOKEN }}
|
66
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
67
|
+
run: script/examples
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/Changelog.md
CHANGED
@@ -1,3 +1,263 @@
|
|
1
|
+
## 0.24.1
|
2
|
+
|
3
|
+
### Additions/Changes
|
4
|
+
|
5
|
+
* flipper-api: `exclude_gates` parameter to exclude gate data in GETs (https://github.com/jnunemaker/flipper/pull/572).
|
6
|
+
* Make it possible to disable internal memoization (https://github.com/jnunemaker/flipper/pull/612).
|
7
|
+
* Add Flipper::Actor#hash so actors can be hash keys (https://github.com/jnunemaker/flipper/pull/616).
|
8
|
+
* Pretty Up `rails routes` again and make rack-protection dependency less strict (https://github.com/jnunemaker/flipper/pull/619).
|
9
|
+
* Add kwargs for method_missing using ruby 3.0 (https://github.com/jnunemaker/flipper/pull/620).
|
10
|
+
|
11
|
+
## 0.24.0
|
12
|
+
|
13
|
+
### Additions/Changes
|
14
|
+
|
15
|
+
* Add Ruby 3.0 and 3.1 to the CI matrix and fix groups block arity check for ruby 3 (https://github.com/jnunemaker/flipper/pull/601)
|
16
|
+
* Removed support for Ruby 2.5 (which was end of line 9 months ago)
|
17
|
+
* Add (alpha) client side instrumentation of events to cloud (https://github.com/jnunemaker/flipper/pull/602)
|
18
|
+
* Fix deprecated uses of Redis#pipelined (https://github.com/jnunemaker/flipper/pull/603). redis-rb >= 3 now required.
|
19
|
+
* Fix Flipper UI Rack application when `Rack::Session::Pool` is used to build it (https://github.com/jnunemaker/flipper/pull/606).
|
20
|
+
|
21
|
+
## 0.23.1
|
22
|
+
|
23
|
+
### Additions/Changes
|
24
|
+
|
25
|
+
* Relax dalli version constraint (https://github.com/jnunemaker/flipper/pull/596)
|
26
|
+
|
27
|
+
### Bug Fixes
|
28
|
+
|
29
|
+
* Fix railtie initialization to mount middleware after config/intializers/* (https://github.com/jnunemaker/flipper/pull/586)
|
30
|
+
|
31
|
+
## 0.23.0
|
32
|
+
|
33
|
+
### Additions/Changes
|
34
|
+
|
35
|
+
* Allow some HTML in banner and descriptions (https://github.com/jnunemaker/flipper/pull/570).
|
36
|
+
* Moved some cloud headers to http client (https://github.com/jnunemaker/flipper/pull/567).
|
37
|
+
* Update flipper-ui jquery and bootstrap versions (https://github.com/jnunemaker/flipper/issues/565 and https://github.com/jnunemaker/flipper/pull/566).
|
38
|
+
* Moved docs to www.flippercloud.io/docs (https://github.com/jnunemaker/flipper/pull/574).
|
39
|
+
* PStore adapter now defaults to thread safe and no longer supports `.thread_safe` (https://github.com/jnunemaker/flipper/commit/4048704fefe41b716015294a19a0b94546637630).
|
40
|
+
* Add failover adapter (https://github.com/jnunemaker/flipper/pull/584).
|
41
|
+
* Improve http adapter error message (https://github.com/jnunemaker/flipper/pull/587).
|
42
|
+
* Rails 7 support (mostly in https://github.com/jnunemaker/flipper/pull/592).
|
43
|
+
|
44
|
+
## 0.22.2
|
45
|
+
|
46
|
+
### Additions/Changes
|
47
|
+
|
48
|
+
* Allow adding multiple actors at once in flipper-ui via comma separation (configurable via `Flipper::UI.configuration.actors_separator`) (https://github.com/jnunemaker/flipper/pull/556)
|
49
|
+
|
50
|
+
### Bug Fixes
|
51
|
+
|
52
|
+
* Fix railtie initialization to avoid altering middleware order (https://github.com/jnunemaker/flipper/pull/563)
|
53
|
+
|
54
|
+
## 0.22.1
|
55
|
+
|
56
|
+
### Additions/Changes
|
57
|
+
|
58
|
+
* Remove Octicons and replace with a pure CSS status circle (https://github.com/jnunemaker/flipper/pull/547)
|
59
|
+
* Rescue unique errors in AR and Sequel when setting value (https://github.com/jnunemaker/flipper/commit/87f5a98bce7baad7a27b75b5bce3256967769f27)
|
60
|
+
* Add a Content-Security-Policy to flipper-ui (https://github.com/jnunemaker/flipper/pull/552)
|
61
|
+
* Fix Synchronizer issue that occurs for ActiveRecord adapter (https://github.com/jnunemaker/flipper/pull/554)
|
62
|
+
|
63
|
+
## 0.22.0
|
64
|
+
|
65
|
+
### Additions/Changes
|
66
|
+
|
67
|
+
* Enable log subscriber by default in Rails (https://github.com/jnunemaker/flipper/pull/525)
|
68
|
+
* Remove memoizer from API and UI (https://github.com/jnunemaker/flipper/pull/527). If you are using the UI or API without configuring the default instance of Flipper, you'll need to enable memoization if you want it. For examples, see the examples/ui and examples/api directories.
|
69
|
+
* Fix SQL reserved word use in get_all for ActiveRecord and Sequel (https://github.com/jnunemaker/flipper/pull/536).
|
70
|
+
* Handle spaces in names gracefully in UI (https://github.com/jnunemaker/flipper/pull/541).
|
71
|
+
|
72
|
+
## 0.21.0
|
73
|
+
|
74
|
+
### Additions/Changes
|
75
|
+
|
76
|
+
* Default to using memory adapter (https://github.com/jnunemaker/flipper/pull/501)
|
77
|
+
* Adapters now configured on require when possible (https://github.com/jnunemaker/flipper/pull/502)
|
78
|
+
* Added cloud recommendation to flipper-ui. Can be disabled with `Flipper::UI.configure { |config| config.cloud_recommendation = false }`. Just want to raise awareness that more is available if people want it (https://github.com/jnunemaker/flipper/pull/504)
|
79
|
+
* Added default `flipper_id` implementation via `Flipper::Identifier` and automatically included it in ActiveRecord and Sequel models (https://github.com/jnunemaker/flipper/pull/505)
|
80
|
+
* Deprecate superflous sync_method setting (https://github.com/jnunemaker/flipper/pull/511)
|
81
|
+
* Flipper is now pre-configured when used with Rails. By default, it will [memoize and preload all features for each request](https://flippercloud.io/docs/optimization#memoization). (https://github.com/jnunemaker/flipper/pull/506)
|
82
|
+
|
83
|
+
### Upgrading
|
84
|
+
|
85
|
+
You should be able to upgrade to 0.21 without any breaking changes. However, if you want to simplify your setup, you can remove some configuration that is now handled automatically:
|
86
|
+
|
87
|
+
1. Adapters are configured when on require, so unless you are using caching or other customizations, you can remove adapter configuration.
|
88
|
+
|
89
|
+
```diff
|
90
|
+
# config/initializers/flipper.rb
|
91
|
+
- Flipper.configure do |config|
|
92
|
+
- config.default { Flipper.new(Flipper::Adapters::ActiveRecord.new) }
|
93
|
+
- end
|
94
|
+
```
|
95
|
+
|
96
|
+
2. `Flipper::Middleware::Memoizer` will be enabled by default -- including preloading. **Note**: You may want to disable preloading (see below) if you have > 100 features.
|
97
|
+
|
98
|
+
```diff
|
99
|
+
# config/initializers/flipper.rb
|
100
|
+
- Rails.configuration.middleware.use Flipper::Middleware::Memoizer,
|
101
|
+
- preload: [:stats, :search, :some_feature]
|
102
|
+
+ Rails.application.configure do
|
103
|
+
+ # Uncomment to configure which features to preload on all requests
|
104
|
+
+ # config.flipper.preload = [:stats, :search, :some_feature]
|
105
|
+
+ #
|
106
|
+
+ # Or, you may want to disable preloading entirely:
|
107
|
+
+ # config.flipper.preload = false
|
108
|
+
+ end
|
109
|
+
```
|
110
|
+
|
111
|
+
3. `#flipper_id`, which is used to enable features for specific actors, is now defined by [Flipper::Identifier](lib/flipper/identifier.rb) on all ActiveRecord and Sequel models. You can remove your implementation if it is in the form of `ModelName;id`.
|
112
|
+
|
113
|
+
4. When using `flipper-cloud`, The `Flipper::Cloud.app` webhook receiver is now mounted at `/_flipper` by default.
|
114
|
+
|
115
|
+
```diff
|
116
|
+
# config/routes.rb
|
117
|
+
- mount Flipper::Cloud.app, at: "/_flipper"
|
118
|
+
```
|
119
|
+
|
120
|
+
## 0.20.4
|
121
|
+
|
122
|
+
### Additions/Changes
|
123
|
+
|
124
|
+
* Allow actors and time gates to deal with decimal percentages (https://github.com/jnunemaker/flipper/pull/492)
|
125
|
+
* Change Flipper::Cloud::Middleware to receive webhooks at / in addition to /webhooks.
|
126
|
+
* Add `write_through` option to ActiveSupportCacheStore adapter to support write-through caching (https://github.com/jnunemaker/flipper/pull/512)
|
127
|
+
|
128
|
+
## 0.20.3
|
129
|
+
|
130
|
+
### Additions/Changes
|
131
|
+
|
132
|
+
* Changed the internal structure of how the memory adapter stores things.
|
133
|
+
|
134
|
+
## 0.20.2
|
135
|
+
|
136
|
+
### Additions/Changes
|
137
|
+
|
138
|
+
* Http adapter now raises error when enable/disable/add/remove/clear fail.
|
139
|
+
* Cloud adapter sends some extra info like hostname, ruby version, etc. for debugging and decision making.
|
140
|
+
|
141
|
+
## 0.20.1
|
142
|
+
|
143
|
+
### Additions/Changes
|
144
|
+
|
145
|
+
* Just a minor tweak to cloud webhook middleware to provide more debugging information about why a hook wasn't successful.
|
146
|
+
|
147
|
+
## 0.20.0
|
148
|
+
|
149
|
+
### Additions/Changes
|
150
|
+
|
151
|
+
* Add support for webhooks to `Flipper::Cloud` (https://github.com/jnunemaker/flipper/pull/489).
|
152
|
+
|
153
|
+
## 0.19.1
|
154
|
+
|
155
|
+
### Additions/Changes
|
156
|
+
|
157
|
+
* Bump rack-protection version to < 2.2 (https://github.com/jnunemaker/flipper/pull/487)
|
158
|
+
* Add memoizer_options to Flipper::Api.app (https://github.com/jnunemaker/flipper/commit/174ad4bb94046a25c432d3c53fe1ff9f5a76d838)
|
159
|
+
|
160
|
+
## 0.19.0
|
161
|
+
|
162
|
+
### Additions/Changes
|
163
|
+
|
164
|
+
* 100% of actors is now considered conditional. Feature#on?, Feature#conditional?, Feature#state would all be affected. See https://github.com/jnunemaker/flipper/issues/463 for more.
|
165
|
+
* Several doc updates.
|
166
|
+
|
167
|
+
## 0.18.0
|
168
|
+
|
169
|
+
### Additions/Changes
|
170
|
+
|
171
|
+
* Add support for feature descriptions to flipper-ui (https://github.com/jnunemaker/flipper/pull/461).
|
172
|
+
* Remove rubocop (https://github.com/jnunemaker/flipper/pull/469).
|
173
|
+
* flipper-ui redesign (https://github.com/jnunemaker/flipper/pull/470).
|
174
|
+
* Removed support for ruby 2.4.
|
175
|
+
* Added support for ruby 2.7.
|
176
|
+
* Removed support for Rails 4.x.x.
|
177
|
+
* Removed support for customizing actors, groups, % of actors and % of time text in flipper-ui in favor of automatic and more descriptive text.
|
178
|
+
|
179
|
+
## 0.17.2
|
180
|
+
|
181
|
+
### Additions/Changes
|
182
|
+
|
183
|
+
* Avoid errors on import when there are no features and shared specs/tests for get all with no features (https://github.com/jnunemaker/flipper/pull/441 and https://github.com/jnunemaker/flipper/pull/442)
|
184
|
+
* ::ActiveRecord::RecordNotUnique > ActiveRecord::RecordNotUnique (https://github.com/jnunemaker/flipper/pull/444)
|
185
|
+
* Clear gate values on enable (https://github.com/jnunemaker/flipper/pull/454)
|
186
|
+
* Remove use of multi from redis adapter (https://github.com/jnunemaker/flipper/pull/451)
|
187
|
+
|
188
|
+
## 0.17.1
|
189
|
+
|
190
|
+
* Fix require in flipper-active_record (https://github.com/jnunemaker/flipper/pull/437)
|
191
|
+
|
192
|
+
## 0.17.0
|
193
|
+
|
194
|
+
### Additions/Changes
|
195
|
+
|
196
|
+
* Allow shorthand block notation on group types (https://github.com/jnunemaker/flipper/pull/406)
|
197
|
+
* Relax active record/support constraints to support Rails 6 (https://github.com/jnunemaker/flipper/pull/409)
|
198
|
+
* Allow disabling fun (https://github.com/jnunemaker/flipper/pull/413)
|
199
|
+
* Include thing_value in payload of Instrumented#enable and #disable (https://github.com/jnunemaker/flipper/pull/417)
|
200
|
+
* Replace Erubis with Erubi (https://github.com/jnunemaker/flipper/pull/407)
|
201
|
+
* Allow customizing Rack::Protection middleware list (https://github.com/jnunemaker/flipper/pull/385)
|
202
|
+
* Allow setting write_timeout for ruby 2.6+ (https://github.com/jnunemaker/flipper/pull/433)
|
203
|
+
* Drop support for Ruby 2.1, 2.2, and 2.3 (https://github.com/jnunemaker/flipper/commit/cf58982e70de5e6963b018ceced4f36a275f5b5d)
|
204
|
+
* Add support for Ruby 2.6 (https://github.com/jnunemaker/flipper/commit/57888311449ec81184d3d47ba9ae5cb1ad4a2f45)
|
205
|
+
* Remove support for Rails 3.2 (https://github.com/jnunemaker/flipper/commit/177c48c4edf51d4e411e7c673e30e06d1c66fb40)
|
206
|
+
* Add write_timeout for flipper http adapter for ruby 2.6+ (https://github.com/jnunemaker/flipper/pull/433)
|
207
|
+
* Relax moneta version to allow for < 1.2 (https://github.com/jnunemaker/flipper/pull/434).
|
208
|
+
* Improve active record idempotency (https://github.com/jnunemaker/flipper/pull/436).
|
209
|
+
* Allow customizing add actor placeholder text (https://github.com/jnunemaker/flipper/commit/5faa1e9cf66b68f8227d2f8408fb448a14676c45)
|
210
|
+
|
211
|
+
## 0.16.2
|
212
|
+
|
213
|
+
### Additions/Changes
|
214
|
+
|
215
|
+
* Bump rollout redis dependency to < 5 (https://github.com/jnunemaker/flipper/pull/403)
|
216
|
+
* Bump redis dependency to < 5 (https://github.com/jnunemaker/flipper/pull/401)
|
217
|
+
* Bump sequel dependency to < 6 (https://github.com/jnunemaker/flipper/pull/399 and https://github.com/jnunemaker/flipper/commit/edc767e69b4ce8daead9801f38e0e8bf6b238765)
|
218
|
+
|
219
|
+
## 0.16.1
|
220
|
+
|
221
|
+
### Additions/Changes
|
222
|
+
|
223
|
+
* Add actors API endpoint (https://github.com/jnunemaker/flipper/pull/372).
|
224
|
+
* Fix rack body proxy require for those using flipper without rack (https://github.com/jnunemaker/flipper/pull/376).
|
225
|
+
* Unescapes feature_name in FeatureNameFromRoute (https://github.com/jnunemaker/flipper/pull/377).
|
226
|
+
* Replace delete_all with destroy_all in ActiveRecord adapter (https://github.com/jnunemaker/flipper/pull/395)
|
227
|
+
* Target correct bootstrap breakpoints in flipper UI (https://github.com/jnunemaker/flipper/pull/396)
|
228
|
+
|
229
|
+
## 0.16.0
|
230
|
+
|
231
|
+
### Bug Fixes
|
232
|
+
|
233
|
+
* Support slashes in feature names (https://github.com/jnunemaker/flipper/pull/362).
|
234
|
+
|
235
|
+
### Additions/Changes
|
236
|
+
|
237
|
+
* Re-order gates for improved performance in some cases (https://github.com/jnunemaker/flipper/pull/370).
|
238
|
+
* Add Feature#exist?, DSL#exist? and Flipper#exist? (https://github.com/jnunemaker/flipper/pull/371).
|
239
|
+
|
240
|
+
## 0.15.0
|
241
|
+
|
242
|
+
* Move Flipper::UI configuration options to Flipper::UI::Configuration (https://github.com/jnunemaker/flipper/pull/345).
|
243
|
+
* Bug fix in adapter synchronizing and switched DSL#import to use Synchronizer (https://github.com/jnunemaker/flipper/pull/347).
|
244
|
+
* Fix AR adapter table name prefix/suffix bug (https://github.com/jnunemaker/flipper/pull/350).
|
245
|
+
* Allow feature names to end with "features" in UI (https://github.com/jnunemaker/flipper/pull/353).
|
246
|
+
|
247
|
+
## 0.14.0
|
248
|
+
|
249
|
+
* Changed sync_interval to be seconds instead of milliseconds.
|
250
|
+
|
251
|
+
## 0.13.0
|
252
|
+
|
253
|
+
### Additions/Changes
|
254
|
+
|
255
|
+
* Update PStore adapter to allow setting thread_safe option (https://github.com/jnunemaker/flipper/pull/334).
|
256
|
+
* Update Flipper::UI to Bootstrap 4 (https://github.com/jnunemaker/flipper/pull/336).
|
257
|
+
* Add Flipper::UI configuration to add a banner with customizeable text and background color (https://github.com/jnunemaker/flipper/pull/337).
|
258
|
+
* Add sync adapter (https://github.com/jnunemaker/flipper/pull/341).
|
259
|
+
* Make cloud use sync adapter (https://github.com/jnunemaker/flipper/pull/342). This makes local flipper operations resilient to cloud failures.
|
260
|
+
|
1
261
|
## 0.12.2
|
2
262
|
|
3
263
|
### Additions/Changes
|
@@ -8,7 +268,7 @@
|
|
8
268
|
|
9
269
|
### Additions/Changes
|
10
270
|
|
11
|
-
* Added rollout adapter documentation (https://github.com/jnunemaker/flipper/pull/328).
|
271
|
+
* Added rollout adapter documentation (https://github.com/jnunemaker/flipper/pull/328).
|
12
272
|
|
13
273
|
### Bug Fixes
|
14
274
|
|
@@ -142,8 +402,8 @@
|
|
142
402
|
|
143
403
|
* Added Flipper.groups and Flipper.group_names
|
144
404
|
* Changed percentage_of_random to percentage_of_time
|
145
|
-
* Added enable/disable convenience methods for all gates (
|
146
|
-
* Added value convenience methods (
|
405
|
+
* Added enable/disable convenience methods for all gates (enable_group, enable_actor, enable_percentage_of_actors, enable_percentage_of_time)
|
406
|
+
* Added value convenience methods (boolean_value, groups_value, actors_value, etc.)
|
147
407
|
* Added Feature#gate_values for getting typecast adapter gate values
|
148
408
|
* Added Feature#enabled_gates and #disabled_gates for getting the gates that are enabled/disabled for the feature
|
149
409
|
* Remove Feature#description
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
@@ -7,26 +7,23 @@ Dir['flipper-*.gemspec'].each do |gemspec|
|
|
7
7
|
end
|
8
8
|
|
9
9
|
gem 'pry'
|
10
|
-
gem 'rake', '~>
|
10
|
+
gem 'rake', '~> 12.3.3'
|
11
11
|
gem 'shotgun', '~> 0.9'
|
12
12
|
gem 'statsd-ruby', '~> 1.2.1'
|
13
13
|
gem 'rspec', '~> 3.0'
|
14
14
|
gem 'rack-test', '~> 0.6.3'
|
15
|
-
gem 'sqlite3',
|
16
|
-
gem 'rails', "~> #{ENV['RAILS_VERSION'] || '
|
17
|
-
gem 'minitest', '~> 5.8
|
18
|
-
gem '
|
19
|
-
gem '
|
20
|
-
gem '
|
21
|
-
|
22
|
-
|
23
|
-
gem 'test-unit', '~> 3.0'
|
15
|
+
gem 'sqlite3', "~> #{ENV['SQLITE3_VERSION'] || '1.4.1'}"
|
16
|
+
gem 'rails', "~> #{ENV['RAILS_VERSION'] || '7.0.0'}"
|
17
|
+
gem 'minitest', '~> 5.8'
|
18
|
+
gem 'minitest-documentation'
|
19
|
+
gem 'webmock', '~> 3.0'
|
20
|
+
gem 'ice_age'
|
21
|
+
gem 'redis-namespace'
|
22
|
+
gem 'webrick'
|
24
23
|
|
25
24
|
group(:guard) do
|
26
|
-
gem 'guard', '~> 2.
|
27
|
-
gem 'guard-rspec', '~> 4.5
|
28
|
-
gem 'guard-bundler', '~> 2.
|
29
|
-
gem '
|
30
|
-
gem 'guard-sass', '~> 1.6.0'
|
31
|
-
gem 'rb-fsevent', '~> 0.9.4'
|
25
|
+
gem 'guard', '~> 2.15'
|
26
|
+
gem 'guard-rspec', '~> 4.5'
|
27
|
+
gem 'guard-bundler', '~> 2.2'
|
28
|
+
gem 'rb-fsevent', '~> 0.9'
|
32
29
|
end
|
data/README.md
CHANGED
@@ -1,25 +1,19 @@
|
|
1
|
-
![
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
~---~~~~----~~~~ ~~
|
18
|
-
</pre>
|
19
|
-
|
20
|
-
Feature flipping is the act of enabling or disabling features or parts of your application, ideally without re-deploying or changing anything in your code base.
|
21
|
-
|
22
|
-
The goal of this gem is to make turning features on or off so easy that everyone does it. Whatever your data store, throughput, or experience, feature flipping should be easy and have minimal impact on your application.
|
1
|
+
[![Flipper Mark](docs/images/banner.jpg)](https://www.flippercloud.io)
|
2
|
+
|
3
|
+
[Website](https://flippercloud.io) | [Documentation](https://flippercloud.io/docs) | [Examples](examples) | [Twitter](https://twitter.com/flipper_cloud)
|
4
|
+
|
5
|
+
# Flipper
|
6
|
+
|
7
|
+
> Beautiful, performant feature flags for Ruby.
|
8
|
+
|
9
|
+
Flipper gives you control over who has access to features in your app.
|
10
|
+
|
11
|
+
* Enable or disable features for everyone, specific actors, groups of actors, a percentage of actors, or a percentage of time.
|
12
|
+
* Configure your feature flags from the console or a web UI.
|
13
|
+
* Regardless of what data store you are using, Flipper can performantly store your feature flags.
|
14
|
+
* Use [Flipper Cloud](#flipper-cloud) to cascade features from multiple environments, share settings with your team, control permissions, keep an audit history, and rollback.
|
15
|
+
|
16
|
+
Control your software — don't let it control you.
|
23
17
|
|
24
18
|
## Installation
|
25
19
|
|
@@ -27,6 +21,10 @@ Add this line to your application's Gemfile:
|
|
27
21
|
|
28
22
|
gem 'flipper'
|
29
23
|
|
24
|
+
You'll also want to pick a storage [adapter](https://flippercloud.io/docs/adapters), for example:
|
25
|
+
|
26
|
+
gem 'flipper-active_record'
|
27
|
+
|
30
28
|
And then execute:
|
31
29
|
|
32
30
|
$ bundle
|
@@ -35,60 +33,62 @@ Or install it yourself with:
|
|
35
33
|
|
36
34
|
$ gem install flipper
|
37
35
|
|
38
|
-
##
|
39
|
-
|
40
|
-
The goal of the API for flipper was to have everything revolve around features and what ways they can be enabled. Start with top level and dig into a feature, then dig in further and enable that feature for a given type of access, as opposed to thinking about how the feature will be accessed first (ie: `stats.enable` vs `activate_group(:stats, ...)`).
|
36
|
+
## Subscribe & Ship
|
41
37
|
|
42
|
-
|
43
|
-
require 'flipper'
|
44
|
-
require 'flipper/adapters/memory'
|
38
|
+
[💌 Subscribe](https://buttondown.email/flipper) - I'll send you short and sweet emails when we release new versions.
|
45
39
|
|
46
|
-
|
47
|
-
config.default do
|
48
|
-
# pick an adapter, this uses memory, any will do
|
49
|
-
adapter = Flipper::Adapters::Memory.new
|
40
|
+
## Getting Started
|
50
41
|
|
51
|
-
|
52
|
-
Flipper.new(adapter)
|
53
|
-
end
|
54
|
-
end
|
42
|
+
Use `Flipper#enabled?` in your app to check if a feature is enabled.
|
55
43
|
|
44
|
+
```ruby
|
56
45
|
# check if search is enabled
|
57
|
-
if Flipper.enabled?
|
46
|
+
if Flipper.enabled? :search, current_user
|
58
47
|
puts 'Search away!'
|
59
48
|
else
|
60
49
|
puts 'No search for you!'
|
61
50
|
end
|
51
|
+
```
|
62
52
|
|
63
|
-
|
64
|
-
Flipper.enable(:search)
|
53
|
+
All features are disabled by default, so you'll need to explicitly enable them.
|
65
54
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
55
|
+
```ruby
|
56
|
+
# Enable a feature for everyone
|
57
|
+
Flipper.enable :search
|
58
|
+
|
59
|
+
# Enable a feature for a specific actor
|
60
|
+
Flipper.enable_actor :search, current_user
|
61
|
+
|
62
|
+
# Enable a feature for a group of actors
|
63
|
+
Flipper.enable_group :search, :admin
|
64
|
+
|
65
|
+
# Enable a feature for a percentage of actors
|
66
|
+
Flipper.enable_percentage_of_actors :search, 2
|
72
67
|
```
|
73
68
|
|
74
|
-
|
69
|
+
Read more about [getting started with Flipper](https://flippercloud.io/docs) and [enabling features](https://flippercloud.io/docs/features).
|
70
|
+
|
71
|
+
## Flipper Cloud
|
72
|
+
|
73
|
+
Like Flipper and want more? Check out [Flipper Cloud](https://www.flippercloud.io), which comes with:
|
74
|
+
|
75
|
+
* **everything in one place** — no need to bounce around from different application UIs or IRB consoles.
|
76
|
+
* **permissions** — grant access to everyone in your organization or lockdown each project to particular people.
|
77
|
+
* **multiple environments** — production, staging, enterprise, by continent, whatever you need.
|
78
|
+
* **personal environments** — no more rake scripts or manual enable/disable to get your laptop to look like production. Every developer gets a personal environment that inherits from production that they can override as they please ([read more](https://www.johnnunemaker.com/flipper-cloud-environments/)).
|
79
|
+
* **no maintenance** — we'll keep the lights on for you. We also have handy webhooks for keeping your app in sync with Cloud, so **our availability won't affect yours**. All your feature flag reads are local to your app.
|
80
|
+
* **audit history** — every feature change and who made it.
|
81
|
+
* **rollbacks** — enable or disable a feature accidentally? No problem. You can roll back to any point in the audit history with a single click.
|
75
82
|
|
76
|
-
|
83
|
+
[![Flipper Cloud Screenshot](docs/images/flipper_cloud.png)](https://www.flippercloud.io)
|
77
84
|
|
78
|
-
|
79
|
-
* [Adapters](docs/Adapters.md) - Mongo, Redis, Cassandra, Active Record...
|
80
|
-
* [Instrumentation](docs/Instrumentation.md) - ActiveSupport::Notifications and Statsd
|
81
|
-
* [Optimization](docs/Optimization.md) - Memoization middleware and Cache adapters
|
82
|
-
* [Web Interface](docs/ui/README.md) - Point and click...
|
83
|
-
* [API](docs/api/README.md) - HTTP API interface
|
84
|
-
* [Caveats](docs/Caveats.md) - Flipper beware! (see what I did there)
|
85
|
-
* [Docker-Compose](docs/DockerCompose.md) - Using docker-compose in contributing
|
85
|
+
Cloud is super simple to integrate with Rails ([demo app](https://github.com/fewerandfaster/flipper-rails-demo)), Sinatra or any other framework.
|
86
86
|
|
87
87
|
## Contributing
|
88
88
|
|
89
89
|
1. Fork it
|
90
90
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
91
|
-
3.
|
91
|
+
3. Run the tests (`bundle exec rake`). Check out [Docker-Compose](docs/DockerCompose.md) if you need help getting all the adapters running.
|
92
92
|
4. Commit your changes (`git commit -am 'Added some feature'`)
|
93
93
|
5. Push to the branch (`git push origin my-new-feature`)
|
94
94
|
6. Create new Pull Request
|
@@ -104,5 +104,8 @@ Of course there are more [examples for you to peruse](examples/). You could also
|
|
104
104
|
| pic | @mention | area |
|
105
105
|
|---|---|---|
|
106
106
|
| ![@jnunemaker](https://avatars3.githubusercontent.com/u/235?s=64) | [@jnunemaker](https://github.com/jnunemaker) | most things |
|
107
|
+
| ![@bkeepers](https://avatars3.githubusercontent.com/u/173?s=64) | [@bkeepers](https://github.com/bkeepers) | most things |
|
108
|
+
| ![@dpep](https://avatars3.githubusercontent.com/u/918804?s=64) | [@dpep](https://github.com/dpep) | tbd |
|
107
109
|
| ![@alexwheeler](https://avatars3.githubusercontent.com/u/3260042?s=64) | [@alexwheeler](https://github.com/alexwheeler) | api |
|
110
|
+
| ![@thetimbanks](https://avatars1.githubusercontent.com/u/471801?s=64) | [@thetimbanks](https://github.com/thetimbanks) | ui |
|
108
111
|
| ![@lazebny](https://avatars1.githubusercontent.com/u/6276766?s=64) | [@lazebny](https://github.com/lazebny) | docker |
|