Skip to content

Commit 02da5e2

Browse files
authored
Drop support for Ruby 2.0, 2.1, 2.2, 2.3, and 2.4 (#549)
Already, the latest version of the sshkit gem is no longer installable on Ruby 2.2 or older. See #548. Rather than add workarounds to the sshkit code to restore compatibility with old versions of Ruby, we've decided to officially drop support for them. This PR drops support for Ruby 2.0, 2.1, 2.2, 2.3, and 2.4. For reference, Ruby 2.4 was officially EOL'd 4 years and 9 months ago (31 Mar 2020), so it is not unreasonable for us to drop support in 2025. If users wish to use the sshkit gem on an old version of Ruby, they can still do so by installing an older version. For example, 1.22.0 works on Ruby 2.2. ``` gem install sshkit -v 1.22.0 ```
1 parent d8acf40 commit 02da5e2

File tree

13 files changed

+23
-74
lines changed

13 files changed

+23
-74
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
ruby:
12-
[
13-
"2.3",
14-
"2.4",
15-
"2.5",
16-
"2.6",
17-
"2.7",
18-
"3.0",
19-
"3.1",
20-
"3.2",
21-
"3.3",
22-
"3.4",
23-
"head",
24-
]
11+
ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "3.4", "head"]
2512
steps:
2613
- uses: actions/checkout@v4
2714
- name: Set up Ruby
@@ -34,24 +21,9 @@ jobs:
3421
env:
3522
RUBYOPT: ${{ startsWith(matrix.ruby, 'head') && '--enable=frozen-string-literal' || '' }}
3623

37-
test-legacy:
38-
runs-on: ubuntu-20.04
39-
strategy:
40-
matrix:
41-
ruby: ["2.0", "2.1", "2.2"]
42-
steps:
43-
- uses: actions/checkout@v4
44-
- name: Set up Ruby
45-
uses: ruby/setup-ruby@v1
46-
with:
47-
ruby-version: ${{ matrix.ruby }}
48-
bundler-cache: true
49-
- name: Run tests
50-
run: bundle exec rake test:units
51-
5224
test-all:
5325
runs-on: ubuntu-latest
54-
needs: [test, test-legacy]
26+
needs: test
5527
if: always()
5628
steps:
5729
- name: All tests ok
@@ -77,7 +49,7 @@ jobs:
7749
runs-on: ubuntu-latest
7850
strategy:
7951
matrix:
80-
ruby: ["2.0", "ruby"]
52+
ruby: ["2.5", "ruby"]
8153
steps:
8254
- uses: actions/checkout@v4
8355
- name: Set up Ruby

.rubocop.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ inherit_from: .rubocop_todo.yml
33
AllCops:
44
DisplayCopNames: true
55
DisplayStyleGuide: true
6-
TargetRubyVersion: 2.0
6+
TargetRubyVersion: 2.5
77

88
Lint/AmbiguousBlockAssociation:
99
Enabled: false
@@ -18,12 +18,12 @@ Style/ClassAndModuleChildren:
1818
Enabled: false
1919
Style/DoubleNegation:
2020
Enabled: false
21-
Style/FileName:
21+
Naming/FileName:
2222
Exclude:
2323
- "Dangerfile"
24-
Style/IndentHeredoc:
24+
Layout/IndentHeredoc:
2525
Enabled: false
26-
Style/SpaceAroundEqualsInParameterDefault:
26+
Layout/SpaceAroundEqualsInParameterDefault:
2727
EnforcedStyle: no_space
2828
Style/StringLiterals:
2929
EnforcedStyle: double_quotes
@@ -47,7 +47,7 @@ Metrics/CyclomaticComplexity:
4747
Enabled: false
4848
Metrics/MethodLength:
4949
Enabled: false
50-
Style/PredicateName:
50+
Naming/PredicateName:
5151
Enabled: false
5252
Metrics/LineLength:
5353
Enabled: false
@@ -59,5 +59,5 @@ Metrics/ClassLength:
5959
Enabled: false
6060
Metrics/ModuleLength:
6161
Enabled: false
62-
Style/AccessorMethodName:
62+
Naming/AccessorMethodName:
6363
Enabled: false

.rubocop_todo.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ Style/MethodDefParentheses:
439439
# Offense count: 3
440440
# Configuration parameters: SupportedStyles.
441441
# SupportedStyles: snake_case, camelCase
442-
Style/MethodName:
442+
Naming/MethodName:
443443
EnforcedStyle: snake_case
444444
Exclude:
445445
- 'test/unit/test_color.rb'
@@ -460,7 +460,7 @@ Style/NumericPredicate:
460460
- 'lib/sshkit/command.rb'
461461

462462
# Offense count: 1
463-
Style/OpMethod:
463+
Naming/BinaryOperatorParameterName:
464464
Exclude:
465465
- 'lib/sshkit/host.rb'
466466

@@ -611,7 +611,7 @@ Style/UnneededPercentQ:
611611
# Offense count: 1
612612
# Configuration parameters: EnforcedStyle, SupportedStyles.
613613
# SupportedStyles: snake_case, normalcase, non_integer
614-
Style/VariableNumber:
614+
Naming/VariableNumber:
615615
Exclude:
616616
- 'test/unit/backends/test_connection_pool.rb'
617617

Gemfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
source 'https://rubygems.org'
22

33
gemspec
4-
5-
# public_suffix 3+ requires ruby 2.1+
6-
if Gem::Requirement.new('< 2.1').satisfied_by?(Gem::Version.new(RUBY_VERSION))
7-
gem 'public_suffix', '< 3'
8-
end

RELEASING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
* You must have commit rights to the SSHKit repository.
66
* You must have push rights for the sshkit gem on rubygems.org.
7-
* You must be using Ruby >= 2.1.0.
7+
* You must be using Ruby >= 2.5.0.
88

99
## How to release
1010

lib/sshkit/backends/abstract.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ def configure
135135
# Backends which extend the Abstract backend should implement the following methods:
136136
def upload!(_local, _remote, _options = {}) raise MethodUnavailableError end
137137
def download!(_remote, _local=nil, _options = {}) raise MethodUnavailableError end
138-
def execute_command(_cmd) raise MethodUnavailableError end
139-
private :execute_command # Can inline after Ruby 2.1
138+
private def execute_command(_cmd) raise MethodUnavailableError end
140139

141140
private
142141

lib/sshkit/backends/connection_pool.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require "monitor"
2-
require "thread"
32

43
# Since we call to_s on new connection arguments and use that as a cache key, we
54
# need to make sure the memory address of the object is not used as part of the

lib/sshkit/runners/parallel.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require 'thread'
2-
31
module SSHKit
42

53
module Runner

sshkit.gemspec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,20 @@ Gem::Specification.new do |gem|
1919
gem.name = "sshkit"
2020
gem.require_paths = ["lib"]
2121
gem.version = SSHKit::VERSION
22+
gem.required_ruby_version = ">= 2.5"
2223

23-
gem.add_runtime_dependency('base64') if RUBY_VERSION >= "2.4"
24+
gem.add_runtime_dependency('base64')
2425
gem.add_runtime_dependency('net-ssh', '>= 2.8.0')
2526
gem.add_runtime_dependency('net-scp', '>= 1.1.2')
2627
gem.add_runtime_dependency('net-sftp', '>= 2.1.2')
27-
gem.add_runtime_dependency('ostruct') if RUBY_VERSION >= "2.5"
28+
gem.add_runtime_dependency('ostruct')
2829

2930
gem.add_development_dependency('danger')
3031
gem.add_development_dependency('minitest', '>= 5.0.0')
3132
gem.add_development_dependency('minitest-reporters')
3233
gem.add_development_dependency('rainbow', '~> 2.2.2')
3334
gem.add_development_dependency('rake')
34-
gem.add_development_dependency('rubocop', "~> 0.49.1")
35+
gem.add_development_dependency('rubocop', "~> 0.52.0")
3536
gem.add_development_dependency('mocha')
3637

3738
gem.add_development_dependency('bcrypt_pbkdf')

test/functional/backends/test_netssh.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def test_execute_raises_on_non_zero_exit_status_and_captures_stdout_and_stderr
131131

132132
def test_test_does_not_raise_on_non_zero_exit_status
133133
Netssh.new(a_host) do |_host|
134-
test :false
134+
test :false # rubocop:disable Lint/BooleanSymbol
135135
end.run
136136
end
137137

@@ -151,7 +151,7 @@ def test_connection_pool_keepalive
151151
# ensure we enable connection pool
152152
SSHKit::Backend::Netssh.pool.idle_timeout = 10
153153
Netssh.new(a_host) do |_host|
154-
test :false
154+
test :false # rubocop:disable Lint/BooleanSymbol
155155
end.run
156156
sleep 2.5
157157
captured_command_result = nil

0 commit comments

Comments
 (0)