Skip to content

Commit

Permalink
fix: Deprecate Ruby 2.6 and Drop support for Ruby 2.5 (#132)
Browse files Browse the repository at this point in the history
* fix: print deprecation warning if using ruby < 2.7

* chore: continue testing 2.5 and 2.6

* drop support for 2.5 and deprecate 2.6
  • Loading branch information
jim80net authored Aug 11, 2022
1 parent ae4ebfc commit 432cb2c
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rspec_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest]
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
ruby: [2.7, '3.0', '3.1']
ruby: [2.6, 2.7, '3.0', '3.1']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ PATH
remote: .
specs:
datadog_backup (2.0.1)
amazing_print (= 1.4.0)
concurrent-ruby (= 1.1.10)
deepsort (= 0.4.5)
diffy (= 3.4.2)
dogapi (= 1.45.0)
amazing_print (~> 1.4.0)
concurrent-ruby (~> 1.1.10)
deepsort (~> 0.4.5)
diffy (~> 3.4.2)
dogapi (~> 1.45.0)

GEM
remote: https://rubygems.org/
Expand Down
12 changes: 6 additions & 6 deletions datadog_backup.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^spec/})
spec.require_paths = ['lib']

spec.required_ruby_version = ['>= 2.5']
spec.required_ruby_version = ['>= 2.6']

spec.add_dependency 'amazing_print', '1.4.0'
spec.add_dependency 'concurrent-ruby', '1.1.10'
spec.add_dependency 'deepsort', '0.4.5'
spec.add_dependency 'diffy', '3.4.2'
spec.add_dependency 'dogapi', '1.45.0'
spec.add_dependency 'amazing_print', '~> 1.4.0'
spec.add_dependency 'concurrent-ruby', '~> 1.1.10'
spec.add_dependency 'deepsort', '~> 0.4.5'
spec.add_dependency 'diffy', '~> 3.4.2'
spec.add_dependency 'dogapi', '~> 1.45.0'

spec.add_development_dependency 'bundler'
spec.add_development_dependency 'pry'
Expand Down
5 changes: 4 additions & 1 deletion lib/datadog_backup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@

require_relative 'datadog_backup/local_filesystem'
require_relative 'datadog_backup/options'

require_relative 'datadog_backup/cli'
require_relative 'datadog_backup/core'
require_relative 'datadog_backup/dashboards'
require_relative 'datadog_backup/monitors'
require_relative 'datadog_backup/thread_pool'
require_relative 'datadog_backup/version'
require_relative 'datadog_backup/deprecations'
DatadogBackup::Deprecations.check


module DatadogBackup
end

11 changes: 11 additions & 0 deletions lib/datadog_backup/deprecations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@


module DatadogBackup
module Deprecations
def self.check
if RUBY_VERSION < '2.7'
LOGGER.warn "ruby-#{RUBY_VERSION} is deprecated. Ruby 2.7 or higher will be required to use this gem after datadog_backup@v3"
end
end
end
end
36 changes: 36 additions & 0 deletions spec/datadog_backup/deprecations_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# frozen_string_literal: true

require 'spec_helper'

describe DatadogBackup::Deprecations do
let(:logger) { double }

before do
stub_const('LOGGER', logger)
allow(logger).to receive(:warn)
end

%w[2.4.10 2.5.9 2.6.8].each do |ruby_version|
describe "#check#{ruby_version}" do
subject { described_class.check }

it 'does warn' do
stub_const('RUBY_VERSION', ruby_version)
expect(logger).to receive(:warn).with(/ruby-#{ruby_version} is deprecated./)
subject
end
end
end

%w[2.7.4 3.0.4 3.1.2 3.2.0-preview1].each do |ruby_version|
describe "#check#{ruby_version}" do
subject { described_class.check }

it 'does not warn' do
stub_const('RUBY_VERSION', ruby_version)
expect(logger).to_not receive(:warn).with(/ruby-#{ruby_version} is deprecated./)
subject
end
end
end
end

0 comments on commit 432cb2c

Please sign in to comment.