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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9fbd6aff802f007a9bd178485743a95ee7b44d536490c46d882eae42c3c64c36
4
- data.tar.gz: d909399cc8b412d826bf09eb984e5a9800212cb0fcec8bfcc03a42c6159f7cc6
3
+ metadata.gz: 2f330ff243bc49a8be8bdde5c6cec038ba51455be2485761aa932b413452da38
4
+ data.tar.gz: 1bd8ab5fa3e78eaea921869dcb75260c927b7b40f4ecebfe06ef4e470fb2fb3c
5
5
  SHA512:
6
- metadata.gz: 9a2d731225227ffda4d4f2262dde5ac7b3a93ab871acf9e71b8c7ed8d4fb4eba395f5e28200b396023ab7bb1b869304617b867305b763ed45408e2fb1f2c9be0
7
- data.tar.gz: 55610c15c3d080c2f7894d896664518a594ad60ea0c80ac47ca8ff515332cef5f6796ad0fdff5404903b5470b79dd78a29862225198e459ff6ef06d493d2f9ad
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.default do
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
 
@@ -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
- flipper[:stats].enable
6
+ Flipper[:stats].enable
14
7
 
15
- if flipper[:stats].enabled?
8
+ if Flipper[:stats].enabled?
16
9
  puts "Enabled!"
17
10
  else
18
11
  puts "Disabled!"
19
12
  end
20
13
 
21
- flipper[:stats].disable
14
+ Flipper[:stats].disable
22
15
 
23
- if flipper[:stats].enabled?
16
+ if Flipper[:stats].enabled?
24
17
  puts "Enabled!"
25
18
  else
26
19
  puts "Disabled!"
@@ -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
- options = {}
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
- flipper[:stats].enable
23
- flipper[:stats].enable_group :admins
24
- flipper[:stats].enable_group :early_access
25
- flipper[:stats].enable_actor User.new('25')
26
- flipper[:stats].enable_actor User.new('90')
27
- flipper[:stats].enable_actor User.new('180')
28
- flipper[:stats].enable_percentage_of_time 15
29
- flipper[:stats].enable_percentage_of_actors 45
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
- flipper[:search].enable
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(flipper[:stats])
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
@@ -1,8 +1 @@
1
1
  require 'flipper/adapters/redis'
2
-
3
- Flipper.configure do |config|
4
- config.default do
5
- client = Redis.new(url: ENV["FLIPPER_REDIS_URL"] || ENV["REDIS_URL"])
6
- Flipper.new(Flipper::Adapters::Redis.new(client))
7
- end
8
- end
@@ -178,3 +178,10 @@ module Flipper
178
178
  end
179
179
  end
180
180
  end
181
+
182
+ Flipper.configure do |config|
183
+ config.adapter do
184
+ client = Redis.new(url: ENV["FLIPPER_REDIS_URL"] || ENV["REDIS_URL"])
185
+ Flipper::Adapters::Redis.new(client)
186
+ end
187
+ end
@@ -148,7 +148,7 @@ module Flipper
148
148
  return [] if keys.empty?
149
149
 
150
150
  cache_keys = keys.map { |key| key_for(key) }
151
- @cache.mget(cache_keys).map do |value|
151
+ @cache.mget(*cache_keys).map do |value|
152
152
  value ? Marshal.load(value) : nil
153
153
  end
154
154
  end
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.21.0.rc1'.freeze
2
+ VERSION = '0.21.0.rc2'.freeze
3
3
  end
@@ -27,7 +27,7 @@ RSpec.describe Flipper::Adapters::Redis do
27
27
  Flipper.configuration = nil
28
28
  Flipper.instance = nil
29
29
 
30
- load 'flipper-redis.rb'
30
+ load 'flipper/adapters/redis.rb'
31
31
 
32
32
  expect(Flipper.adapter.adapter).to be_a(Flipper::Adapters::Redis)
33
33
  end
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.rc1
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-01 00:00:00.000000000 Z
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.rc1
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.rc1
26
+ version: 0.21.0.rc2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: redis
29
29
  requirement: !ruby/object:Gem::Requirement