flipper 0.21.0 → 0.22.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/.github/workflows/ci.yml +15 -14
- data/Changelog.md +9 -0
- data/Gemfile +1 -0
- data/README.md +1 -0
- data/docs/api/README.md +5 -5
- data/examples/api/basic.ru +19 -0
- data/examples/api/custom_memoized.ru +37 -0
- data/examples/api/memoized.ru +43 -0
- data/lib/flipper/middleware/memoizer.rb +1 -1
- data/lib/flipper/railtie.rb +9 -1
- data/lib/flipper/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5ccee45a49e10626a3168f1d4ac5b833a7a353be908044a9e056a8a38977e11
|
4
|
+
data.tar.gz: e4835d28c5db82466369bd78a002454c882e1c731ff171e352bbee3b53df1102
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efc365c24401b44a56f0c3818dd3d85868b89859ec22ee9119e3ac2764043a90d966d5a4a079e3aab231f07df017017cea09ab1f351edcdaa90a97837ee38614
|
7
|
+
data.tar.gz: 42e748dfb24633faca15dde30f1062b349e29c72bbf014382a22a9ad06cea214ea4fa679fc5e69d4e4b8e259a1c98863e9a29bf1f302fcee319a3729f8ee85a5
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
name: CI
|
2
|
-
on:
|
3
|
-
push:
|
4
|
-
branches: [master]
|
5
|
-
pull_request:
|
2
|
+
on: [push, pull_request]
|
6
3
|
jobs:
|
7
|
-
|
4
|
+
test:
|
5
|
+
name: Test on ruby ${{ matrix.ruby }} and rails ${{ matrix.rails }}
|
8
6
|
runs-on: ubuntu-latest
|
9
7
|
services:
|
10
8
|
redis:
|
@@ -18,8 +16,8 @@ jobs:
|
|
18
16
|
strategy:
|
19
17
|
matrix:
|
20
18
|
ruby: ['2.5', '2.6', '2.7']
|
19
|
+
rails: ['5.2', '6.0.0', '6.1.0']
|
21
20
|
env:
|
22
|
-
RAILS_VERSION: 6.0.0
|
23
21
|
SQLITE3_VERSION: 1.4.1
|
24
22
|
REDIS_URL: redis://localhost:6379/0
|
25
23
|
CI: true
|
@@ -36,10 +34,10 @@ jobs:
|
|
36
34
|
uses: actions/cache@v1
|
37
35
|
with:
|
38
36
|
path: vendor/bundle
|
39
|
-
key: ${{ runner.os }}-
|
37
|
+
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ hashFiles('**/Gemfile.lock') }}
|
40
38
|
restore-keys: |
|
41
|
-
${{ runner.os }}-
|
42
|
-
- name: Set up Ruby
|
39
|
+
${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-
|
40
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
43
41
|
uses: actions/setup-ruby@v1
|
44
42
|
with:
|
45
43
|
ruby-version: ${{ matrix.ruby }}
|
@@ -47,11 +45,14 @@ jobs:
|
|
47
45
|
run: sudo apt-get -yqq install libpq-dev
|
48
46
|
- name: Install bundler
|
49
47
|
run: gem install bundler
|
50
|
-
- name: Run
|
51
|
-
|
52
|
-
|
53
|
-
run:
|
54
|
-
|
48
|
+
- name: Run Rake with Rails ${{ matrix.rails }}
|
49
|
+
env:
|
50
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
51
|
+
run: |
|
52
|
+
bundle install --jobs 4 --retry 3
|
53
|
+
bundle exec rake
|
54
|
+
- name: Run Examples with Rails ${{ matrix.rails }}
|
55
55
|
env:
|
56
56
|
FLIPPER_CLOUD_TOKEN: ${{ secrets.FLIPPER_CLOUD_TOKEN }}
|
57
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
57
58
|
run: script/examples
|
data/Changelog.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 0.22.0
|
2
|
+
|
3
|
+
## Additions/Changes
|
4
|
+
|
5
|
+
* Enable log subscriber by default in Rails (https://github.com/jnunemaker/flipper/pull/525)
|
6
|
+
* 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.
|
7
|
+
* Fix SQL reserved word use in get_all for ActiveRecord and Sequel (https://github.com/jnunemaker/flipper/pull/536).
|
8
|
+
* Handle spaces in names gracefully in UI (https://github.com/jnunemaker/flipper/pull/541).
|
9
|
+
|
1
10
|
## 0.21.0
|
2
11
|
|
3
12
|
### Additions/Changes
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -157,6 +157,7 @@ A few miscellaneous docs with more info for the hungry.
|
|
157
157
|
| pic | @mention | area |
|
158
158
|
|---|---|---|
|
159
159
|
|  | [@jnunemaker](https://github.com/jnunemaker) | most things |
|
160
|
+
|  | [@bkeepers](https://github.com/bkeepers) | most things |
|
160
161
|
|  | [@alexwheeler](https://github.com/alexwheeler) | api |
|
161
162
|
|  | [@thetimbanks](https://github.com/thetimbanks) | ui |
|
162
163
|
|  | [@lazebny](https://github.com/lazebny) | docker |
|
data/docs/api/README.md
CHANGED
@@ -23,7 +23,7 @@ Or install it yourself as:
|
|
23
23
|
```ruby
|
24
24
|
# config/routes.rb
|
25
25
|
YourRailsApp::Application.routes.draw do
|
26
|
-
mount Flipper::Api.app(
|
26
|
+
mount Flipper::Api.app(Flipper) => '/flipper/api'
|
27
27
|
end
|
28
28
|
```
|
29
29
|
|
@@ -34,8 +34,8 @@ There can be more than one router in your application. Make sure if you choose a
|
|
34
34
|
*bad:*
|
35
35
|
```ruby
|
36
36
|
YourRailsApp::Application.routes.draw do
|
37
|
-
mount Flipper::UI.app(
|
38
|
-
mount Flipper::Api.app(
|
37
|
+
mount Flipper::UI.app(Flipper) => '/flipper'
|
38
|
+
mount Flipper::Api.app(Flipper) => '/flipper/api'
|
39
39
|
end
|
40
40
|
```
|
41
41
|
|
@@ -44,8 +44,8 @@ In this case any requests to /flipper\* will be routed to Flipper::UI - includin
|
|
44
44
|
*good:*
|
45
45
|
```ruby
|
46
46
|
YourRailsApp::Application.routes.draw do
|
47
|
-
mount Flipper::Api.app(
|
48
|
-
mount Flipper::UI.app(
|
47
|
+
mount Flipper::Api.app(Flipper) => '/flipper/api'
|
48
|
+
mount Flipper::UI.app(Flipper) => '/flipper'
|
49
49
|
end
|
50
50
|
````
|
51
51
|
For more advanced mounting techniques and for suggestions on how to mount in a non-Rails application, it is recommend that you review the [`Flipper::UI` usage documentation](https://github.com/jnunemaker/flipper/blob/master/docs/ui/README.md#usage) as the same approaches apply to `Flipper::Api`.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Usage:
|
3
|
+
# # if you want it to not reload and be really fast
|
4
|
+
# bin/rackup examples/api/basic.ru -p 9999
|
5
|
+
#
|
6
|
+
# # if you want reloading
|
7
|
+
# bin/shotgun examples/api/basic.ru -p 9999
|
8
|
+
#
|
9
|
+
# http://localhost:9999/
|
10
|
+
#
|
11
|
+
|
12
|
+
require 'bundler/setup'
|
13
|
+
require "flipper/api"
|
14
|
+
require "flipper/adapters/pstore"
|
15
|
+
|
16
|
+
# You can uncomment this to get some default data:
|
17
|
+
# Flipper.enable :logging
|
18
|
+
|
19
|
+
run Flipper::Api.app
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#
|
2
|
+
# Usage:
|
3
|
+
# # if you want it to not reload and be really fast
|
4
|
+
# bin/rackup examples/api/custom_memoized.ru -p 9999
|
5
|
+
#
|
6
|
+
# # if you want reloading
|
7
|
+
# bin/shotgun examples/api/custom_memoized.ru -p 9999
|
8
|
+
#
|
9
|
+
# http://localhost:9999/
|
10
|
+
#
|
11
|
+
|
12
|
+
require 'bundler/setup'
|
13
|
+
require "active_support/notifications"
|
14
|
+
require "flipper/api"
|
15
|
+
require "flipper/adapters/pstore"
|
16
|
+
|
17
|
+
adapter = Flipper::Adapters::Instrumented.new(
|
18
|
+
Flipper::Adapters::PStore.new,
|
19
|
+
instrumenter: ActiveSupport::Notifications,
|
20
|
+
)
|
21
|
+
flipper = Flipper.new(adapter)
|
22
|
+
|
23
|
+
ActiveSupport::Notifications.subscribe(/.*/, ->(*args) {
|
24
|
+
name, start, finish, id, data = args
|
25
|
+
case name
|
26
|
+
when "adapter_operation.flipper"
|
27
|
+
p data[:adapter_name] => data[:operation]
|
28
|
+
end
|
29
|
+
})
|
30
|
+
|
31
|
+
# You can uncomment this to get some default data:
|
32
|
+
# flipper[:logging].enable_percentage_of_time 5
|
33
|
+
|
34
|
+
run Flipper::Api.app(flipper) { |builder|
|
35
|
+
builder.use Flipper::Middleware::SetupEnv, flipper
|
36
|
+
builder.use Flipper::Middleware::Memoizer, preload: true
|
37
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#
|
2
|
+
# Usage:
|
3
|
+
# # if you want it to not reload and be really fast
|
4
|
+
# bin/rackup examples/api/memoized.ru -p 9999
|
5
|
+
#
|
6
|
+
# # if you want reloading
|
7
|
+
# bin/shotgun examples/api/memoized.ru -p 9999
|
8
|
+
#
|
9
|
+
# http://localhost:9999/
|
10
|
+
#
|
11
|
+
|
12
|
+
require 'bundler/setup'
|
13
|
+
require "active_support/notifications"
|
14
|
+
require "flipper/api"
|
15
|
+
require "flipper/adapters/pstore"
|
16
|
+
|
17
|
+
Flipper.configure do |config|
|
18
|
+
config.adapter {
|
19
|
+
Flipper::Adapters::Instrumented.new(
|
20
|
+
Flipper::Adapters::PStore.new,
|
21
|
+
instrumenter: ActiveSupport::Notifications,
|
22
|
+
)
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
ActiveSupport::Notifications.subscribe(/.*/, ->(*args) {
|
27
|
+
name, start, finish, id, data = args
|
28
|
+
case name
|
29
|
+
when "adapter_operation.flipper"
|
30
|
+
p data[:adapter_name] => data[:operation]
|
31
|
+
end
|
32
|
+
})
|
33
|
+
|
34
|
+
Flipper.register(:admins) { |actor|
|
35
|
+
actor.respond_to?(:admin?) && actor.admin?
|
36
|
+
}
|
37
|
+
|
38
|
+
# You can uncomment this to get some default data:
|
39
|
+
# Flipper.enable :logging
|
40
|
+
|
41
|
+
run Flipper::Api.app { |builder|
|
42
|
+
builder.use Flipper::Middleware::Memoizer, preload: true
|
43
|
+
}
|
@@ -15,7 +15,7 @@ module Flipper
|
|
15
15
|
# use Flipper::Middleware::Memoizer
|
16
16
|
#
|
17
17
|
# # using with preload_all features
|
18
|
-
# use Flipper::Middleware::Memoizer,
|
18
|
+
# use Flipper::Middleware::Memoizer, preload: true
|
19
19
|
#
|
20
20
|
# # using with preload specific features
|
21
21
|
# use Flipper::Middleware::Memoizer, preload: [:stats, :search, :some_feature]
|
data/lib/flipper/railtie.rb
CHANGED
@@ -5,7 +5,8 @@ module Flipper
|
|
5
5
|
env_key: "flipper",
|
6
6
|
memoize: true,
|
7
7
|
preload: true,
|
8
|
-
instrumenter: ActiveSupport::Notifications
|
8
|
+
instrumenter: ActiveSupport::Notifications,
|
9
|
+
log: true
|
9
10
|
)
|
10
11
|
end
|
11
12
|
|
@@ -29,6 +30,13 @@ module Flipper
|
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
33
|
+
initializer "flipper.log", after: :load_config_initializers do |app|
|
34
|
+
config = app.config.flipper
|
35
|
+
if config.log && config.instrumenter == ActiveSupport::Notifications
|
36
|
+
require "flipper/instrumentation/log_subscriber"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
32
40
|
initializer "flipper.identifier" do
|
33
41
|
ActiveSupport.on_load(:active_record) do
|
34
42
|
ActiveRecord::Base.include Flipper::Identifier
|
data/lib/flipper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -37,6 +37,9 @@ files:
|
|
37
37
|
- docs/http/README.md
|
38
38
|
- docs/images/banner.jpg
|
39
39
|
- docs/read-only/README.md
|
40
|
+
- examples/api/basic.ru
|
41
|
+
- examples/api/custom_memoized.ru
|
42
|
+
- examples/api/memoized.ru
|
40
43
|
- examples/basic.rb
|
41
44
|
- examples/configuring_default.rb
|
42
45
|
- examples/dsl.rb
|