flipper-redis 0.21.0 → 0.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb99d58e35c7f9ef6e7009d590b10567f892e12219d7e9932efd1fbf8738ca93
4
- data.tar.gz: 29e58a9005b46a3c5369b627c4e202900c6f26fa3a21a037ce4bad5402027281
3
+ metadata.gz: d03229764fb9f1ca1443a0e32779bc8a0d23913b57debf63513e6b55251004fa
4
+ data.tar.gz: 3ed534fc6218a2df061008e8057beaa08bd6645318ae33d2ca1cb491d1ebb683
5
5
  SHA512:
6
- metadata.gz: 993919ce04acf986020d41383393f15312366f903eefc8db7331dfbe3b3223d6c15fab41b3755ac7e480bee71bf4dc257ab1425984d5203098a03b621e18c22e
7
- data.tar.gz: eca5fc0aa2ffccd136dd5972c4e6bae7d43a28e27d5696a419e0fb3e94b6b5ac0227a1491b85f7c30e9600144033b5c4272da80c1d50330a6d35a26fce39643f
6
+ metadata.gz: d487eb67f3e4d9f3b4f5e590eb1a56c5cadd4ac24cfd95fe26f68315e595cfbb3103a9138035f511a282ad07cd7b356ed76fef669538ec6a15d5556996263b72
7
+ data.tar.gz: be0cce07afcc3dbb907928698c6c88667c5a3d652f8791936c55842c37451d4e364375e444528c6d64567003455c466fe56633c94385e49b8de18f726d0e78d8
@@ -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.21.0'.freeze
2
+ VERSION = '0.24.1'.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.21.0
4
+ version: 0.24.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-09 00:00:00.000000000 Z
11
+ date: 2022-04-13 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.21.0
19
+ version: 0.24.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
26
+ version: 0.24.1
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