flipper 0.22.0 → 0.22.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +0 -5
- data/.github/workflows/examples.yml +56 -0
- data/Changelog.md +9 -0
- data/docker-compose.yml +37 -34
- data/examples/instrumentation_last_accessed_at.rb +37 -0
- data/lib/flipper/adapters/sync/synchronizer.rb +2 -1
- data/lib/flipper/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14514238ff1ea823df0cefeb2e1048816b86995d582e6c3dda037d36db344078
|
4
|
+
data.tar.gz: 285650a29a45623ed0468a08736621ccf88a6453eeadd8f42a29740a4a2955bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3af99a75cafb349025fd03a6c2bab4bb224f76acd2a0ac820bf6306ded28235b615fc0f891ce8d3df7612eca26d631fc7a51fb6ee738fdfdb614a561b121af04
|
7
|
+
data.tar.gz: bbaa9c0da5be73f4d1ab4ebc284919585878162e2c0151e346d77ad6909fddff7d0da7eff823ad29281d645e521d53e21f1de9184efda072e90e919d465a2c48
|
data/.github/workflows/ci.yml
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
name: Examples
|
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.5', '2.6', '2.7']
|
19
|
+
rails: ['5.2', '6.0.0', '6.1.0']
|
20
|
+
env:
|
21
|
+
SQLITE3_VERSION: 1.4.1
|
22
|
+
REDIS_URL: redis://localhost:6379/0
|
23
|
+
CI: true
|
24
|
+
steps:
|
25
|
+
- name: Setup memcached
|
26
|
+
uses: KeisukeYamashita/memcached-actions@v1
|
27
|
+
- name: Start MongoDB
|
28
|
+
uses: supercharge/mongodb-github-action@1.3.0
|
29
|
+
with:
|
30
|
+
mongodb-version: 4.0
|
31
|
+
- name: Check out repository code
|
32
|
+
uses: actions/checkout@v2
|
33
|
+
- name: Do some action caching
|
34
|
+
uses: actions/cache@v1
|
35
|
+
with:
|
36
|
+
path: vendor/bundle
|
37
|
+
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ hashFiles('**/Gemfile.lock') }}
|
38
|
+
restore-keys: |
|
39
|
+
${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-
|
40
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
41
|
+
uses: actions/setup-ruby@v1
|
42
|
+
with:
|
43
|
+
ruby-version: ${{ matrix.ruby }}
|
44
|
+
- name: Install libpq-dev
|
45
|
+
run: sudo apt-get -yqq install libpq-dev
|
46
|
+
- name: Install bundler
|
47
|
+
run: gem install bundler
|
48
|
+
- name: Bundle install with Rails ${{ matrix.rails }}
|
49
|
+
env:
|
50
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
51
|
+
run: bundle install --jobs 4 --retry 3
|
52
|
+
- name: Run Examples with Rails ${{ matrix.rails }}
|
53
|
+
env:
|
54
|
+
FLIPPER_CLOUD_TOKEN: ${{ secrets.FLIPPER_CLOUD_TOKEN }}
|
55
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
56
|
+
run: script/examples
|
data/Changelog.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 0.22.1
|
2
|
+
|
3
|
+
## Additions/Changes
|
4
|
+
|
5
|
+
* Remove Octicons and replace with a pure CSS status circle (https://github.com/jnunemaker/flipper/pull/547)
|
6
|
+
* Rescue unique errors in AR and Sequel when setting value (https://github.com/jnunemaker/flipper/commit/87f5a98bce7baad7a27b75b5bce3256967769f27)
|
7
|
+
* Add a Content-Security-Policy to flipper-ui (https://github.com/jnunemaker/flipper/pull/552)
|
8
|
+
* Fix Synchronizer issue that occurs for ActiveRecord adapter (https://github.com/jnunemaker/flipper/pull/554)
|
9
|
+
|
1
10
|
## 0.22.0
|
2
11
|
|
3
12
|
## Additions/Changes
|
data/docker-compose.yml
CHANGED
@@ -1,34 +1,37 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
1
|
+
version: "2.4"
|
2
|
+
services:
|
3
|
+
# postgres:
|
4
|
+
# container_name: flipper_postgres
|
5
|
+
# image: postgres:9.4
|
6
|
+
redis:
|
7
|
+
container_name: flipper_redis
|
8
|
+
image: redis:6.2.5
|
9
|
+
mongo:
|
10
|
+
container_name: flipper_mongo
|
11
|
+
image: mongo:4.4.8
|
12
|
+
memcached:
|
13
|
+
container_name: flipper_memcached
|
14
|
+
image: memcached:1.4.33
|
15
|
+
app:
|
16
|
+
container_name: flipper_app
|
17
|
+
build:
|
18
|
+
context: .
|
19
|
+
dockerfile: Dockerfile
|
20
|
+
volumes:
|
21
|
+
- .:/srv/app
|
22
|
+
volumes_from:
|
23
|
+
- bundle_cache
|
24
|
+
links:
|
25
|
+
# - postgres
|
26
|
+
- redis
|
27
|
+
- mongo
|
28
|
+
- memcached
|
29
|
+
environment:
|
30
|
+
- REDIS_URL=redis://redis:6379
|
31
|
+
- MONGODB_HOST=mongo
|
32
|
+
- MEMCACHED_URL=memcached:11211
|
33
|
+
bundle_cache:
|
34
|
+
container_name: flipper_bundle_cache
|
35
|
+
image: busybox
|
36
|
+
volumes:
|
37
|
+
- /bundle_cache
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Quick example of how to keep track of when a feature was last checked.
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'securerandom'
|
4
|
+
require 'active_support/notifications'
|
5
|
+
require 'flipper'
|
6
|
+
|
7
|
+
class FlipperSubscriber
|
8
|
+
def self.stats
|
9
|
+
@stats ||= {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(name, start, finish, id, payload)
|
13
|
+
if payload[:operation] == :enabled?
|
14
|
+
feature_name = payload.fetch(:feature_name)
|
15
|
+
self.class.stats[feature_name] = Time.now
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
ActiveSupport::Notifications.subscribe(/feature_operation.flipper/, new)
|
20
|
+
end
|
21
|
+
|
22
|
+
Flipper.configure do |config|
|
23
|
+
config.default {
|
24
|
+
Flipper.new(config.adapter, instrumenter: ActiveSupport::Notifications)
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
Flipper.enabled?(:search)
|
29
|
+
Flipper.enabled?(:booyeah)
|
30
|
+
Flipper.enabled?(:hooray)
|
31
|
+
sleep 1
|
32
|
+
Flipper.enabled?(:booyeah)
|
33
|
+
Flipper.enabled?(:hooray)
|
34
|
+
sleep 1
|
35
|
+
Flipper.enabled?(:hooray)
|
36
|
+
|
37
|
+
pp FlipperSubscriber.stats
|
@@ -37,7 +37,8 @@ module Flipper
|
|
37
37
|
# Sync all the gate values.
|
38
38
|
remote_get_all.each do |feature_key, remote_gates_hash|
|
39
39
|
feature = Feature.new(feature_key, @local)
|
40
|
-
|
40
|
+
# Check if feature_key is in hash before accessing to prevent unintended hash modification
|
41
|
+
local_gates_hash = local_get_all.key?(feature_key) ? local_get_all[feature_key] : @local.default_config
|
41
42
|
local_gate_values = GateValues.new(local_gates_hash)
|
42
43
|
remote_gate_values = GateValues.new(remote_gates_hash)
|
43
44
|
FeatureSynchronizer.new(feature, local_gate_values, remote_gate_values).call
|
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.22.
|
4
|
+
version: 0.22.1
|
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-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -19,6 +19,7 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- ".codeclimate.yml"
|
21
21
|
- ".github/workflows/ci.yml"
|
22
|
+
- ".github/workflows/examples.yml"
|
22
23
|
- CODE_OF_CONDUCT.md
|
23
24
|
- Changelog.md
|
24
25
|
- Dockerfile
|
@@ -50,6 +51,7 @@ files:
|
|
50
51
|
- examples/importing.rb
|
51
52
|
- examples/individual_actor.rb
|
52
53
|
- examples/instrumentation.rb
|
54
|
+
- examples/instrumentation_last_accessed_at.rb
|
53
55
|
- examples/memoizing.rb
|
54
56
|
- examples/percentage_of_actors.rb
|
55
57
|
- examples/percentage_of_actors_enabled_check.rb
|