flipper-redis 0.21.0.rc1 → 0.21.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/redis/README.md +1 -4
- data/examples/redis/basic.rb +4 -11
- data/examples/redis/internals.rb +11 -18
- data/lib/flipper-redis.rb +0 -7
- data/lib/flipper/adapters/redis.rb +7 -0
- data/lib/flipper/adapters/redis_cache.rb +1 -1
- data/lib/flipper/version.rb +1 -1
- data/spec/flipper/adapters/redis_spec.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f330ff243bc49a8be8bdde5c6cec038ba51455be2485761aa932b413452da38
|
4
|
+
data.tar.gz: 1bd8ab5fa3e78eaea921869dcb75260c927b7b40f4ecebfe06ef4e470fb2fb3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c8013c8d6cdee7e45fa25a0b808306e896c41d8853751ddddb7be50b04acc7fe5204992bcf93274812896ea40fff015d1f9828020829876bc480411e52df06f
|
7
|
+
data.tar.gz: efd9816875f4ea3a18947a0721fd9628c92c64956a1e1cc636347fd89d70d0523016791438a6348749116cc5f1b2ba60a4d76d86867a37ead3a3646ef69799f6
|
data/docs/redis/README.md
CHANGED
@@ -28,10 +28,7 @@ require 'flipper-redis'
|
|
28
28
|
|
29
29
|
```ruby
|
30
30
|
Flipper.configure do |config|
|
31
|
-
config.
|
32
|
-
client = Redis.new(url: ENV["FLIPPER_REDIS_URL"] || ENV["REDIS_URL"])
|
33
|
-
Flipper.new(Flipper::Adapters::Redis.new(client))
|
34
|
-
end
|
31
|
+
config.adapter { Flipper::Adapters::Redis.new(Redis.new) }
|
35
32
|
end
|
36
33
|
```
|
37
34
|
|
data/examples/redis/basic.rb
CHANGED
@@ -2,25 +2,18 @@ require 'bundler/setup'
|
|
2
2
|
require 'logger'
|
3
3
|
|
4
4
|
require 'flipper/adapters/redis'
|
5
|
-
options = {}
|
6
|
-
if ENV['REDIS_URL']
|
7
|
-
options[:url] = ENV['REDIS_URL']
|
8
|
-
end
|
9
|
-
client = Redis.new(options)
|
10
|
-
adapter = Flipper::Adapters::Redis.new(client)
|
11
|
-
flipper = Flipper.new(adapter)
|
12
5
|
|
13
|
-
|
6
|
+
Flipper[:stats].enable
|
14
7
|
|
15
|
-
if
|
8
|
+
if Flipper[:stats].enabled?
|
16
9
|
puts "Enabled!"
|
17
10
|
else
|
18
11
|
puts "Disabled!"
|
19
12
|
end
|
20
13
|
|
21
|
-
|
14
|
+
Flipper[:stats].disable
|
22
15
|
|
23
|
-
if
|
16
|
+
if Flipper[:stats].enabled?
|
24
17
|
puts "Enabled!"
|
25
18
|
else
|
26
19
|
puts "Disabled!"
|
data/examples/redis/internals.rb
CHANGED
@@ -1,16 +1,9 @@
|
|
1
1
|
require 'bundler/setup'
|
2
2
|
require 'pp'
|
3
3
|
require 'logger'
|
4
|
-
|
5
4
|
require 'flipper/adapters/redis'
|
6
5
|
|
7
|
-
|
8
|
-
if ENV['REDIS_URL']
|
9
|
-
options[:url] = ENV['REDIS_URL']
|
10
|
-
end
|
11
|
-
client = Redis.new(options)
|
12
|
-
adapter = Flipper::Adapters::Redis.new(client)
|
13
|
-
flipper = Flipper.new(adapter)
|
6
|
+
client = Redis.new
|
14
7
|
|
15
8
|
# Register a few groups.
|
16
9
|
Flipper.register(:admins) { |thing| thing.admin? }
|
@@ -19,16 +12,16 @@ Flipper.register(:early_access) { |thing| thing.early_access? }
|
|
19
12
|
# Create a user class that has flipper_id instance method.
|
20
13
|
User = Struct.new(:flipper_id)
|
21
14
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
15
|
+
Flipper[:stats].enable
|
16
|
+
Flipper[:stats].enable_group :admins
|
17
|
+
Flipper[:stats].enable_group :early_access
|
18
|
+
Flipper[:stats].enable_actor User.new('25')
|
19
|
+
Flipper[:stats].enable_actor User.new('90')
|
20
|
+
Flipper[:stats].enable_actor User.new('180')
|
21
|
+
Flipper[:stats].enable_percentage_of_time 15
|
22
|
+
Flipper[:stats].enable_percentage_of_actors 45
|
30
23
|
|
31
|
-
|
24
|
+
Flipper[:search].enable
|
32
25
|
|
33
26
|
print 'all keys: '
|
34
27
|
pp client.keys
|
@@ -60,7 +53,7 @@ pp client.hgetall('search')
|
|
60
53
|
puts
|
61
54
|
|
62
55
|
puts 'flipper get of feature'
|
63
|
-
pp adapter.get(
|
56
|
+
pp Flipper.adapter.get(Flipper[:stats])
|
64
57
|
# flipper get of feature
|
65
58
|
# {:boolean=>"true",
|
66
59
|
# :groups=>#<Set: {"admins", "early_access"}>,
|
data/lib/flipper-redis.rb
CHANGED
data/lib/flipper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipper-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.21.0.
|
4
|
+
version: 0.21.0.rc2
|
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-05-
|
11
|
+
date: 2021-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: flipper
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.21.0.
|
19
|
+
version: 0.21.0.rc2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.21.0.
|
26
|
+
version: 0.21.0.rc2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redis
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|