flipper-redis 0.22.1 → 0.24.0

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: 68c78e51e5bbb6b4adace25db68a043e2c2df856afef1b5e86cc1bde3f8ad6c6
4
- data.tar.gz: 19230b0eb105730f67a4f1aa2a00a2bdb33003ab4e1ec97dbf2df525c84c86c3
3
+ metadata.gz: 5dfd7a85f2a17ef2eeec28024d54f4a77549fce6c99502b9f2149788137367a7
4
+ data.tar.gz: ea6fd76d477edaf615f63ee8c78d9358c3f91e1ab1cd49d6f1694a7aa1439b25
5
5
  SHA512:
6
- metadata.gz: d33e8d63345a5900bbcfe9163b34f0faf2ac4df395c14fc0e6c47ca4964d0be46964a648e8b1da0347b18df1355a89d38de91efd8ba8a83862254e79db5c6120
7
- data.tar.gz: 2bbe3fbfc580b04da09488764a61e0410d36db14ac964339fe30c75fd8f1a083c692870278080840b85c8b33c2c2ed8786ffe2bf45e0d140fcd0a4f165bfe1e2
6
+ metadata.gz: 675c0df977e88f03c2d5801ccc2dcdd916147c497052feb7f3169aa2b8b0b23415afbfefadc7d10240d2621a70748dad9215b5f654e33a376ec15b6d797b23f8
7
+ data.tar.gz: cc7f3ffaa6b8e513b71ace6cbc71938c29ab9811a21eb59dba4e50c85b6a95202bc2293000763daf8e9addfe0fbdff1defb331a31e2ed1477e7e02a7c31a3176
@@ -21,5 +21,5 @@ Gem::Specification.new do |gem|
21
21
  gem.metadata = Flipper::METADATA
22
22
 
23
23
  gem.add_dependency 'flipper', "~> #{Flipper::VERSION}"
24
- gem.add_dependency 'redis', '>= 2.2', '< 5'
24
+ gem.add_dependency 'redis', '>= 3.0', '< 5'
25
25
  end
@@ -125,14 +125,14 @@ module Flipper
125
125
  # Private: Gets a hash of fields => values for the given feature.
126
126
  #
127
127
  # Returns a Hash of fields => values.
128
- def doc_for(feature)
129
- @client.hgetall(feature.key)
128
+ def doc_for(feature, pipeline: @client)
129
+ pipeline.hgetall(feature.key)
130
130
  end
131
131
 
132
132
  def docs_for(features)
133
- @client.pipelined do
133
+ @client.pipelined do |pipeline|
134
134
  features.each do |feature|
135
- doc_for(feature)
135
+ doc_for(feature, pipeline: pipeline)
136
136
  end
137
137
  end
138
138
  end
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.22.1'.freeze
2
+ VERSION = '0.24.0'.freeze
3
3
  end
@@ -1,7 +1,5 @@
1
- require 'helper'
2
1
  require 'flipper/adapters/operation_logger'
3
2
  require 'flipper/adapters/redis_cache'
4
- require 'flipper/spec/shared_adapter_specs'
5
3
 
6
4
  RSpec.describe Flipper::Adapters::RedisCache do
7
5
  let(:client) do
@@ -1,6 +1,4 @@
1
- require 'helper'
2
1
  require 'flipper/adapters/redis'
3
- require 'flipper/spec/shared_adapter_specs'
4
2
 
5
3
  RSpec.describe Flipper::Adapters::Redis do
6
4
  let(:client) do
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.22.1
4
+ version: 0.24.0
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-08-23 00:00:00.000000000 Z
11
+ date: 2022-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: flipper
@@ -16,21 +16,21 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.22.1
19
+ version: 0.24.0
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.22.1
26
+ version: 0.24.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: redis
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.2'
33
+ version: '3.0'
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
36
  version: '5'
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: '2.2'
43
+ version: '3.0'
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '5'
@@ -51,7 +51,6 @@ executables: []
51
51
  extensions: []
52
52
  extra_rdoc_files: []
53
53
  files:
54
- - docs/redis/README.md
55
54
  - examples/redis/basic.rb
56
55
  - examples/redis/internals.rb
57
56
  - examples/redis/namespaced.rb
@@ -84,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
83
  - !ruby/object:Gem::Version
85
84
  version: '0'
86
85
  requirements: []
87
- rubygems_version: 3.0.3
86
+ rubygems_version: 3.1.2
88
87
  signing_key:
89
88
  specification_version: 4
90
89
  summary: Redis adapter for Flipper
data/docs/redis/README.md DELETED
@@ -1,109 +0,0 @@
1
- # Flipper Redis
2
-
3
- A [Redis](https://github.com/redis/redis-rb) adapter for [Flipper](https://github.com/jnunemaker/flipper).
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'flipper-redis'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself with:
16
-
17
- $ gem install flipper-redis
18
-
19
- ## Usage
20
-
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
-
23
- ```ruby
24
- require 'flipper/adapters/redis'
25
- ```
26
-
27
- **If you need to customize the adapter**, you can add this to an initializer:
28
-
29
- ```ruby
30
- Flipper.configure do |config|
31
- config.adapter { Flipper::Adapters::Redis.new(Redis.new) }
32
- end
33
- ```
34
-
35
- ## Internals
36
-
37
- Each feature is stored in a redis hash, which means getting a feature is single query.
38
-
39
- ```ruby
40
- require 'flipper/adapters/redis'
41
-
42
- client = Redis.new
43
- adapter = Flipper::Adapters::Redis.new(client)
44
- flipper = Flipper.new(adapter)
45
-
46
- # Register a few groups.
47
- Flipper.register(:admins) { |thing| thing.admin? }
48
- Flipper.register(:early_access) { |thing| thing.early_access? }
49
-
50
- # Create a user class that has flipper_id instance method.
51
- User = Struct.new(:flipper_id)
52
-
53
- flipper[:stats].enable
54
- flipper[:stats].enable_group :admins
55
- flipper[:stats].enable_group :early_access
56
- flipper[:stats].enable_actor User.new('25')
57
- flipper[:stats].enable_actor User.new('90')
58
- flipper[:stats].enable_actor User.new('180')
59
- flipper[:stats].enable_percentage_of_time 15
60
- flipper[:stats].enable_percentage_of_actors 45
61
-
62
- flipper[:search].enable
63
-
64
- print 'all keys: '
65
- pp client.keys
66
- # all keys: ["stats", "flipper_features", "search"]
67
- puts
68
-
69
- print "known flipper features: "
70
- pp client.smembers("flipper_features")
71
- # known flipper features: ["stats", "search"]
72
- puts
73
-
74
- puts 'stats keys'
75
- pp client.hgetall('stats')
76
- # stats keys
77
- # {"boolean"=>"true",
78
- # "groups/admins"=>"1",
79
- # "actors/25"=>"1",
80
- # "percentage_of_time"=>"15",
81
- # "percentage_of_actors"=>"45",
82
- # "groups/early_access"=>"1",
83
- # "actors/90"=>"1",
84
- # "actors/180"=>"1"}
85
- puts
86
-
87
- puts 'search keys'
88
- pp client.hgetall('search')
89
- # search keys
90
- # {"boolean"=>"true"}
91
- puts
92
-
93
- puts 'flipper get of feature'
94
- pp adapter.get(flipper[:stats])
95
- # flipper get of feature
96
- # {:boolean=>"true",
97
- # :groups=>#<Set: {"admins", "early_access"}>,
98
- # :actors=>#<Set: {"25", "90", "180"}>,
99
- # :percentage_of_actors=>"45",
100
- # :percentage_of_time=>"15"}
101
- ```
102
-
103
- ## Contributing
104
-
105
- 1. Fork it
106
- 2. Create your feature branch (`git checkout -b my-new-feature`)
107
- 3. Commit your changes (`git commit -am 'Added some feature'`)
108
- 4. Push to the branch (`git push origin my-new-feature`)
109
- 5. Create new Pull Request