redis-store 1.10.0 → 1.11.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: 90b9775d198eedd8f7fbfbf48548ea825bf888a80bf430be0b7124d9092b6f7a
4
- data.tar.gz: bfa57fa72dafc2bf60885da2501cd377eaceb45892a5e21ca9515d378556f95a
3
+ metadata.gz: b56845874e768c8ec1357c19affb5e7cdb3914d4839cd18d0e443f03b0e843e8
4
+ data.tar.gz: ab3b3872974e7e6fef5992701227397dbc00e8a905d532ab031da57eb2a7ed83
5
5
  SHA512:
6
- metadata.gz: c4c0e067c7e20907158913fa39dbc86abc5c5b3a8120f966e2f311dcb3ae380596c824d0bfcb9385ca77681e8fb98d06ff63f45c289dfb51a1916d5448fe7ab4
7
- data.tar.gz: d6e2d2bc963b99870f4a4abe0e20ede46dc3177f214685922aa0313e8baa9f2879d1fadd1d7786b5ce6d7dc9b736ee7a1ee74664041bbf4479347e96c44b0421
6
+ metadata.gz: 96808f1f4a574c79e2e322825e1d7c0f89265ca06db21de1d277e6d519a5c4698b495b9f9c81c3d72811280d400de8b043f15c57bb7f1a02fdf08023b3dcd673
7
+ data.tar.gz: 5f6a9ca80e5c7166c003421a6942bed21996b8daa09f134e1646f47942ae086246655068b7f0108e8a710622ec96f4bf4649812d44c2c8538b484bb401a38d60
@@ -19,6 +19,8 @@ jobs:
19
19
  - "2.7"
20
20
  - "3.0"
21
21
  - "3.1"
22
+ - "3.2"
23
+ - "3.3"
22
24
  # - 'head'
23
25
  - "jruby"
24
26
  # - 'jruby-head'
@@ -45,7 +47,7 @@ jobs:
45
47
  ports:
46
48
  - 6381:6381
47
49
  steps:
48
- - uses: actions/checkout@v3
50
+ - uses: actions/checkout@v4
49
51
  - uses: ruby/setup-ruby@v1
50
52
  with:
51
53
  ruby-version: ${{ matrix.ruby }}
@@ -54,11 +56,11 @@ jobs:
54
56
  lint:
55
57
  runs-on: ubuntu-latest
56
58
  steps:
57
- - uses: actions/checkout@v3
59
+ - uses: actions/checkout@v4
58
60
  with:
59
61
  fetch-depth: 0
60
62
  - uses: ruby/setup-ruby@v1
61
63
  with:
62
- ruby-version: 3.1
64
+ ruby-version: 3.3
63
65
  bundler-cache: true
64
66
  - run: bundle exec rake lint
@@ -11,11 +11,11 @@ jobs:
11
11
  release:
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
- - uses: actions/checkout@v3
14
+ - uses: actions/checkout@v4
15
15
  - uses: ruby/setup-ruby@v1
16
16
  with:
17
- ruby-version: "3.1"
18
- bundle-cache: true
17
+ ruby-version: "3.3"
18
+ bundler-cache: true
19
19
  - run: |
20
20
  mkdir -p ~/.gem
21
21
  cat << EOF > ~/.gem/credentials
@@ -78,12 +78,19 @@ class Redis
78
78
  :scheme => uri.scheme,
79
79
  :host => uri.hostname,
80
80
  :port => uri.port || DEFAULT_PORT,
81
- :password => uri.password.nil? ? nil : CGI.unescape(uri.password.to_s)
81
+ :ssl => uri.scheme == 'rediss'
82
82
  }
83
83
 
84
84
  options[:db] = db.to_i if db
85
85
  options[:namespace] = namespace if namespace
86
86
  end
87
+
88
+ if uri.user && !uri.user.empty?
89
+ options[:username] = uri.user
90
+ end
91
+
92
+ options[:password] = CGI.unescape(uri.password.to_s) if uri.password
93
+
87
94
  if uri.query
88
95
  query = Hash[URI.decode_www_form(uri.query)]
89
96
  query.each do |(key, value)|
@@ -1,6 +1,6 @@
1
1
  class Redis
2
2
  class Store < self
3
- VERSION = '1.10.0'
3
+ VERSION = '1.11.0'
4
4
 
5
5
  def self.redis_client_defined?
6
6
  # Doesn't work if declared as constant
data/lib/redis/store.rb CHANGED
@@ -71,6 +71,8 @@ class Redis
71
71
  options.delete(:marshalling)
72
72
  options.delete(:namespace)
73
73
  options.delete(:scheme)
74
+ # Redis ACL support added in https://github.com/redis/redis-rb/pull/967
75
+ options.delete(:username) unless Gem::Version.new(Redis::VERSION) >= Gem::Version.new("4.3.0")
74
76
  end
75
77
 
76
78
  def _extend_marshalling
@@ -147,6 +147,13 @@ describe "Redis::Store::Factory" do
147
147
  it "uses specified host" do
148
148
  store = Redis::Store::Factory.create "redis://127.0.0.1"
149
149
  _(store.to_s).must_equal("Redis Client connected to 127.0.0.1:6379 against DB 0")
150
+ client = store.instance_variable_get(:@client)
151
+
152
+ if Gem::Version.new(Redis::VERSION) >= Gem::Version.new('5.0.0')
153
+ assert_equal(false, client.instance_variable_get(:@config).instance_variable_get(:@ssl))
154
+ else
155
+ assert_equal(false, client.options[:ssl])
156
+ end
150
157
  end
151
158
 
152
159
  it "uses specified port" do
@@ -159,6 +166,13 @@ describe "Redis::Store::Factory" do
159
166
  client = store.instance_variable_get(:@client)
160
167
  # `redis-client` does NOT have `scheme`
161
168
  client.respond_to?(:scheme) && _(client.scheme).must_equal('rediss')
169
+
170
+ if Gem::Version.new(Redis::VERSION) >= Gem::Version.new('5.0.0')
171
+ # binding.irb
172
+ assert_equal(true, client.instance_variable_get(:@config).instance_variable_get(:@ssl))
173
+ else
174
+ assert_equal(true, client.options[:ssl])
175
+ end
162
176
  end
163
177
 
164
178
  it "correctly defaults to redis:// when relative scheme specified" do
@@ -198,6 +212,28 @@ describe "Redis::Store::Factory" do
198
212
  _(store.instance_variable_get(:@client).password).must_equal("secret")
199
213
  end
200
214
 
215
+ if Gem::Version.new(Redis::VERSION) >= Gem::Version.new("4.3.0")
216
+ it "uses specified path with username and password" do
217
+ store = Redis::Store::Factory.create "unix://test-user:secret@/var/run/redis.sock"
218
+ _(store.instance_variable_get(:@client).username).must_equal("test-user")
219
+ _(store.instance_variable_get(:@client).password).must_equal("secret")
220
+ end
221
+
222
+ it "uses specified username and password" do
223
+ store = Redis::Store::Factory.create "redis://test-user:secret@127.0.0.1:6379/0/theplaylist"
224
+ _(store.instance_variable_get(:@client).username).must_equal("test-user")
225
+ _(store.instance_variable_get(:@client).password).must_equal("secret")
226
+ end
227
+
228
+ it "uses a default username" do
229
+ store = Redis::Store::Factory.create "redis://:secret@127.0.0.1:6379/0/theplaylist"
230
+ username = Gem::Version.new(Redis::VERSION) >= Gem::Version.new("5.0") ? "default" : nil
231
+
232
+ _(store.instance_variable_get(:@client).username).must_equal(username)
233
+ _(store.instance_variable_get(:@client).password).must_equal("secret")
234
+ end
235
+ end
236
+
201
237
  it 'uses specified password with special characters' do
202
238
  store = Redis::Store::Factory.create 'redis://:pwd%40123@127.0.0.1:6379/0/theplaylist'
203
239
  _(store.instance_variable_get(:@client).password).must_equal('pwd@123')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-store
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-11 00:00:00.000000000 Z
11
+ date: 2024-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -222,7 +222,7 @@ homepage: http://redis-store.org/redis-store
222
222
  licenses:
223
223
  - MIT
224
224
  metadata: {}
225
- post_install_message:
225
+ post_install_message:
226
226
  rdoc_options: []
227
227
  require_paths:
228
228
  - lib
@@ -237,8 +237,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
237
  - !ruby/object:Gem::Version
238
238
  version: '0'
239
239
  requirements: []
240
- rubygems_version: 3.3.16
241
- signing_key:
240
+ rubygems_version: 3.5.11
241
+ signing_key:
242
242
  specification_version: 4
243
243
  summary: Redis stores for Ruby frameworks
244
244
  test_files: []