flipper-redis 0.21.0.rc1 → 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/docs/redis/README.md +2 -5
- data/examples/redis/basic.rb +4 -11
- data/examples/redis/internals.rb +11 -18
- 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/lib/flipper-redis.rb +0 -7
- data/spec/flipper/adapters/redis_spec.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68c78e51e5bbb6b4adace25db68a043e2c2df856afef1b5e86cc1bde3f8ad6c6
|
4
|
+
data.tar.gz: 19230b0eb105730f67a4f1aa2a00a2bdb33003ab4e1ec97dbf2df525c84c86c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d33e8d63345a5900bbcfe9163b34f0faf2ac4df395c14fc0e6c47ca4964d0be46964a648e8b1da0347b18df1355a89d38de91efd8ba8a83862254e79db5c6120
|
7
|
+
data.tar.gz: 2bbe3fbfc580b04da09488764a61e0410d36db14ac964339fe30c75fd8f1a083c692870278080840b85c8b33c2c2ed8786ffe2bf45e0d140fcd0a4f165bfe1e2
|
data/docs/redis/README.md
CHANGED
@@ -21,17 +21,14 @@ Or install it yourself with:
|
|
21
21
|
In most cases, all you need to do is require the adapter. It will connect to the Redis instance specified in the `REDIS_URL` or `FLIPPER_REDIS_URL` environment vairable, or localhost by default.
|
22
22
|
|
23
23
|
```ruby
|
24
|
-
require 'flipper
|
24
|
+
require 'flipper/adapters/redis'
|
25
25
|
```
|
26
26
|
|
27
27
|
**If you need to customize the adapter**, you can add this to an initializer:
|
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/version.rb
CHANGED
data/lib/flipper-redis.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.
|
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
|
- !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.
|
19
|
+
version: 0.22.1
|
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.
|
26
|
+
version: 0.22.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redis
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,9 +80,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
|
-
- - "
|
83
|
+
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
85
|
+
version: '0'
|
86
86
|
requirements: []
|
87
87
|
rubygems_version: 3.0.3
|
88
88
|
signing_key:
|