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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9fbd6aff802f007a9bd178485743a95ee7b44d536490c46d882eae42c3c64c36
4
- data.tar.gz: d909399cc8b412d826bf09eb984e5a9800212cb0fcec8bfcc03a42c6159f7cc6
3
+ metadata.gz: 68c78e51e5bbb6b4adace25db68a043e2c2df856afef1b5e86cc1bde3f8ad6c6
4
+ data.tar.gz: 19230b0eb105730f67a4f1aa2a00a2bdb33003ab4e1ec97dbf2df525c84c86c3
5
5
  SHA512:
6
- metadata.gz: 9a2d731225227ffda4d4f2262dde5ac7b3a93ab871acf9e71b8c7ed8d4fb4eba395f5e28200b396023ab7bb1b869304617b867305b763ed45408e2fb1f2c9be0
7
- data.tar.gz: 55610c15c3d080c2f7894d896664518a594ad60ea0c80ac47ca8ff515332cef5f6796ad0fdff5404903b5470b79dd78a29862225198e459ff6ef06d493d2f9ad
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-redis'
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.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"}>,
@@ -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.22.1'.freeze
3
3
  end
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
@@ -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.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-05-01 00:00:00.000000000 Z
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.21.0.rc1
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.21.0.rc1
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: 1.3.1
85
+ version: '0'
86
86
  requirements: []
87
87
  rubygems_version: 3.0.3
88
88
  signing_key: