diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 204d20f3..62d6373a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,20 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: - [ - "2.3", - "2.4", - "2.5", - "2.6", - "2.7", - "3.0", - "3.1", - "3.2", - "3.3", - "3.4", - "head", - ] + ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "3.4", "head"] steps: - uses: actions/checkout@v4 - name: Set up Ruby @@ -34,24 +21,9 @@ jobs: env: RUBYOPT: ${{ startsWith(matrix.ruby, 'head') && '--enable=frozen-string-literal' || '' }} - test-legacy: - runs-on: ubuntu-20.04 - strategy: - matrix: - ruby: ["2.0", "2.1", "2.2"] - steps: - - uses: actions/checkout@v4 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Run tests - run: bundle exec rake test:units - test-all: runs-on: ubuntu-latest - needs: [test, test-legacy] + needs: test if: always() steps: - name: All tests ok @@ -77,7 +49,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: ["2.0", "ruby"] + ruby: ["2.5", "ruby"] steps: - uses: actions/checkout@v4 - name: Set up Ruby diff --git a/.rubocop.yml b/.rubocop.yml index c1cc5f8a..66d39714 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,7 +3,7 @@ inherit_from: .rubocop_todo.yml AllCops: DisplayCopNames: true DisplayStyleGuide: true - TargetRubyVersion: 2.0 + TargetRubyVersion: 2.5 Lint/AmbiguousBlockAssociation: Enabled: false @@ -18,12 +18,12 @@ Style/ClassAndModuleChildren: Enabled: false Style/DoubleNegation: Enabled: false -Style/FileName: +Naming/FileName: Exclude: - "Dangerfile" -Style/IndentHeredoc: +Layout/IndentHeredoc: Enabled: false -Style/SpaceAroundEqualsInParameterDefault: +Layout/SpaceAroundEqualsInParameterDefault: EnforcedStyle: no_space Style/StringLiterals: EnforcedStyle: double_quotes @@ -47,7 +47,7 @@ Metrics/CyclomaticComplexity: Enabled: false Metrics/MethodLength: Enabled: false -Style/PredicateName: +Naming/PredicateName: Enabled: false Metrics/LineLength: Enabled: false @@ -59,5 +59,5 @@ Metrics/ClassLength: Enabled: false Metrics/ModuleLength: Enabled: false -Style/AccessorMethodName: +Naming/AccessorMethodName: Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a680666f..ee5ab901 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -439,7 +439,7 @@ Style/MethodDefParentheses: # Offense count: 3 # Configuration parameters: SupportedStyles. # SupportedStyles: snake_case, camelCase -Style/MethodName: +Naming/MethodName: EnforcedStyle: snake_case Exclude: - 'test/unit/test_color.rb' @@ -460,7 +460,7 @@ Style/NumericPredicate: - 'lib/sshkit/command.rb' # Offense count: 1 -Style/OpMethod: +Naming/BinaryOperatorParameterName: Exclude: - 'lib/sshkit/host.rb' @@ -611,7 +611,7 @@ Style/UnneededPercentQ: # Offense count: 1 # Configuration parameters: EnforcedStyle, SupportedStyles. # SupportedStyles: snake_case, normalcase, non_integer -Style/VariableNumber: +Naming/VariableNumber: Exclude: - 'test/unit/backends/test_connection_pool.rb' diff --git a/Gemfile b/Gemfile index 40d01c95..fa75df15 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,3 @@ source 'https://rubygems.org' gemspec - -# public_suffix 3+ requires ruby 2.1+ -if Gem::Requirement.new('< 2.1').satisfied_by?(Gem::Version.new(RUBY_VERSION)) - gem 'public_suffix', '< 3' -end diff --git a/RELEASING.md b/RELEASING.md index 348d879d..05073cf3 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -4,7 +4,7 @@ * You must have commit rights to the SSHKit repository. * You must have push rights for the sshkit gem on rubygems.org. -* You must be using Ruby >= 2.1.0. +* You must be using Ruby >= 2.5.0. ## How to release diff --git a/lib/sshkit/backends/abstract.rb b/lib/sshkit/backends/abstract.rb index dc13e43d..592f7b08 100644 --- a/lib/sshkit/backends/abstract.rb +++ b/lib/sshkit/backends/abstract.rb @@ -135,8 +135,7 @@ def configure # Backends which extend the Abstract backend should implement the following methods: def upload!(_local, _remote, _options = {}) raise MethodUnavailableError end def download!(_remote, _local=nil, _options = {}) raise MethodUnavailableError end - def execute_command(_cmd) raise MethodUnavailableError end - private :execute_command # Can inline after Ruby 2.1 + private def execute_command(_cmd) raise MethodUnavailableError end private diff --git a/lib/sshkit/backends/connection_pool.rb b/lib/sshkit/backends/connection_pool.rb index 9df0dfe6..dcd27d5d 100644 --- a/lib/sshkit/backends/connection_pool.rb +++ b/lib/sshkit/backends/connection_pool.rb @@ -1,5 +1,4 @@ require "monitor" -require "thread" # Since we call to_s on new connection arguments and use that as a cache key, we # need to make sure the memory address of the object is not used as part of the diff --git a/lib/sshkit/runners/parallel.rb b/lib/sshkit/runners/parallel.rb index fd5d018a..3f14bd6c 100644 --- a/lib/sshkit/runners/parallel.rb +++ b/lib/sshkit/runners/parallel.rb @@ -1,5 +1,3 @@ -require 'thread' - module SSHKit module Runner diff --git a/sshkit.gemspec b/sshkit.gemspec index e6e2f330..acda77e8 100644 --- a/sshkit.gemspec +++ b/sshkit.gemspec @@ -19,19 +19,20 @@ Gem::Specification.new do |gem| gem.name = "sshkit" gem.require_paths = ["lib"] gem.version = SSHKit::VERSION + gem.required_ruby_version = ">= 2.5" - gem.add_runtime_dependency('base64') if RUBY_VERSION >= "2.4" + gem.add_runtime_dependency('base64') gem.add_runtime_dependency('net-ssh', '>= 2.8.0') gem.add_runtime_dependency('net-scp', '>= 1.1.2') gem.add_runtime_dependency('net-sftp', '>= 2.1.2') - gem.add_runtime_dependency('ostruct') if RUBY_VERSION >= "2.5" + gem.add_runtime_dependency('ostruct') gem.add_development_dependency('danger') gem.add_development_dependency('minitest', '>= 5.0.0') gem.add_development_dependency('minitest-reporters') gem.add_development_dependency('rainbow', '~> 2.2.2') gem.add_development_dependency('rake') - gem.add_development_dependency('rubocop', "~> 0.49.1") + gem.add_development_dependency('rubocop', "~> 0.52.0") gem.add_development_dependency('mocha') gem.add_development_dependency('bcrypt_pbkdf') diff --git a/test/functional/backends/test_netssh.rb b/test/functional/backends/test_netssh.rb index ee7000ad..58901336 100644 --- a/test/functional/backends/test_netssh.rb +++ b/test/functional/backends/test_netssh.rb @@ -131,7 +131,7 @@ def test_execute_raises_on_non_zero_exit_status_and_captures_stdout_and_stderr def test_test_does_not_raise_on_non_zero_exit_status Netssh.new(a_host) do |_host| - test :false + test :false # rubocop:disable Lint/BooleanSymbol end.run end @@ -151,7 +151,7 @@ def test_connection_pool_keepalive # ensure we enable connection pool SSHKit::Backend::Netssh.pool.idle_timeout = 10 Netssh.new(a_host) do |_host| - test :false + test :false # rubocop:disable Lint/BooleanSymbol end.run sleep 2.5 captured_command_result = nil diff --git a/test/unit/backends/test_abstract.rb b/test/unit/backends/test_abstract.rb index 79a82350..e7afac83 100644 --- a/test/unit/backends/test_abstract.rb +++ b/test/unit/backends/test_abstract.rb @@ -112,12 +112,7 @@ def test_within_home end def test_background_logs_deprecation_warnings - deprecation_out = - if RUBY_VERSION < "2.3" - '' - else - +'' - end + deprecation_out = +'' SSHKit.config.deprecation_output = deprecation_out ExampleBackend.new do diff --git a/test/unit/test_command.rb b/test/unit/test_command.rb index 249de39e..030bc633 100644 --- a/test/unit/test_command.rb +++ b/test/unit/test_command.rb @@ -211,12 +211,7 @@ def test_on_stderr end def test_deprecated_stdtream_accessors - deprecation_out = - if RUBY_VERSION < "2.3" - '' - else - +'' - end + deprecation_out = +'' SSHKit.config.deprecation_output = deprecation_out diff --git a/test/unit/test_configuration.rb b/test/unit/test_configuration.rb index e4cc216a..9ec79470 100644 --- a/test/unit/test_configuration.rb +++ b/test/unit/test_configuration.rb @@ -11,12 +11,7 @@ def setup end def test_deprecation_output - output = - if RUBY_VERSION < "2.3" - '' - else - +'' - end + output = +'' SSHKit.config.deprecation_output = output SSHKit.config.deprecation_logger.log('Test')