Skip to content

Commit fba954d

Browse files
committed
Bump minimum Ruby version to 2.5.0
1 parent 23a1888 commit fba954d

File tree

20 files changed

+118
-158
lines changed

20 files changed

+118
-158
lines changed

.github/workflows/test.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set up Ruby
1919
uses: ruby/setup-ruby@v1
2020
with:
21-
ruby-version: "2.4"
21+
ruby-version: "2.5"
2222
- name: Set up Gems
2323
run: |
2424
gem update --system --no-document
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
fail-fast: false
3535
matrix:
36-
ruby: ["3.1", "3.0", "2.7", "2.6", "2.5", "2.4", "jruby-9.3.6.0"]
36+
ruby: ["3.1", "3.0", "2.7", "2.6", "2.5", "jruby-9.3.6.0"]
3737
runs-on: ubuntu-latest
3838
env:
3939
VERBOSE: "true"
@@ -93,7 +93,7 @@ jobs:
9393
- name: Set up Ruby
9494
uses: ruby/setup-ruby@v1
9595
with:
96-
ruby-version: "2.4"
96+
ruby-version: "2.5"
9797
bundler-cache: true
9898
- name: Cache local temporary directory
9999
uses: actions/cache@v3
@@ -133,7 +133,7 @@ jobs:
133133
- name: Set up Ruby
134134
uses: ruby/setup-ruby@v1
135135
with:
136-
ruby-version: "2.4"
136+
ruby-version: "2.5"
137137
bundler-cache: true
138138
- name: Cache local temporary directory
139139
uses: actions/cache@v3
@@ -171,7 +171,7 @@ jobs:
171171
- name: Set up Ruby
172172
uses: ruby/setup-ruby@v1
173173
with:
174-
ruby-version: "2.4"
174+
ruby-version: "2.5"
175175
bundler-cache: true
176176
- name: Cache local temporary directory
177177
uses: actions/cache@v3
@@ -209,7 +209,7 @@ jobs:
209209
- name: Set up Ruby
210210
uses: ruby/setup-ruby@v1
211211
with:
212-
ruby-version: "2.4"
212+
ruby-version: "2.5"
213213
bundler-cache: true
214214
- name: Cache local temporary directory
215215
uses: actions/cache@v3

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
inherit_from: .rubocop_todo.yml
22

33
AllCops:
4-
TargetRubyVersion: 2.4
4+
TargetRubyVersion: 2.5
55

66
Layout/LineLength:
77
Max: 120

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Unreleased 5.0.0
44

5+
- Require Ruby 2.5+.
56
- Removed the deprecated `queue` and `commit` methods. Use `pipelined` instead.
67
- Removed the deprecated `pipelined` and `multi` signature. Commands now MUST be called on the block argument, not the original redis instance.
78
- Removed `Redis.current`. You shouldn't assume there is a single global Redis connection, use a connection pool instead,

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ gemspec
66

77
gem 'minitest'
88
gem 'rake'
9-
gem 'rubocop', '~> 1.0', '< 1.12'
9+
gem 'rubocop', '~> 1.25.1'

examples/sentinel/start

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ pids = []
1313

1414
at_exit do
1515
pids.each do |pid|
16-
begin
17-
Process.kill(:INT, pid)
18-
rescue Errno::ESRCH
19-
end
16+
Process.kill(:INT, pid)
17+
rescue Errno::ESRCH
2018
end
2119

2220
Process.waitall

lib/redis/client.rb

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,18 +196,16 @@ def call_pipeline(pipeline)
196196
return [] if pipeline.futures.empty?
197197

198198
with_reconnect pipeline.with_reconnect? do
199-
begin
200-
pipeline.finish(call_pipelined(pipeline)).tap do
201-
self.db = pipeline.db if pipeline.db
202-
end
203-
rescue ConnectionError => e
204-
return nil if pipeline.shutdown?
205-
206-
# Assume the pipeline was sent in one piece, but execution of
207-
# SHUTDOWN caused none of the replies for commands that were executed
208-
# prior to it from coming back around.
209-
raise e
199+
pipeline.finish(call_pipelined(pipeline)).tap do
200+
self.db = pipeline.db if pipeline.db
210201
end
202+
rescue ConnectionError => e
203+
return nil if pipeline.shutdown?
204+
205+
# Assume the pipeline was sent in one piece, but execution of
206+
# SHUTDOWN caused none of the replies for commands that were executed
207+
# prior to it from coming back around.
208+
raise e
211209
end
212210
end
213211

lib/redis/cluster/command_loader.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ module CommandLoader
1111

1212
def load(nodes)
1313
errors = nodes.map do |node|
14-
begin
15-
return fetch_command_details(node)
16-
rescue CannotConnectError, ConnectionError, CommandError => error
17-
error
18-
end
14+
return fetch_command_details(node)
15+
rescue CannotConnectError, ConnectionError, CommandError => error
16+
error
1917
end
2018

2119
raise InitialSetupError, errors

lib/redis/cluster/node.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,11 @@ def try_map
102102
results = {}
103103

104104
@clients.each do |node_key, client|
105-
begin
106-
reply = yield(node_key, client)
107-
results[node_key] = reply unless reply.nil?
108-
rescue CommandError => err
109-
errors[node_key] = err
110-
next
111-
end
105+
reply = yield(node_key, client)
106+
results[node_key] = reply unless reply.nil?
107+
rescue CommandError => err
108+
errors[node_key] = err
109+
next
112110
end
113111

114112
return results if errors.empty?

lib/redis/cluster/node_loader.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ module NodeLoader
1010

1111
def load_flags(nodes)
1212
errors = nodes.map do |node|
13-
begin
14-
return fetch_node_info(node)
15-
rescue CannotConnectError, ConnectionError, CommandError => error
16-
error
17-
end
13+
return fetch_node_info(node)
14+
rescue CannotConnectError, ConnectionError, CommandError => error
15+
error
1816
end
1917

2018
raise InitialSetupError, errors

lib/redis/cluster/option.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def parse_node_url(addr)
7979
end
8080

8181
def parse_node_option(addr)
82-
addr = addr.map { |k, v| [k.to_sym, v] }.to_h
82+
addr = addr.to_h { |k, v| [k.to_sym, v] }
8383
if addr.values_at(:host, :port).any?(&:nil?)
8484
raise InvalidClientOptionError, 'Redis option of `cluster` must includes `:host` and `:port` keys'
8585
end

0 commit comments

Comments
 (0)