Skip to content

Commit

Permalink
Drop support for Ruby < 3x (#154)
Browse files Browse the repository at this point in the history
* Unlock and upgrade all development dependencies. Remove Ruby 2.6 specific code. Upgrade Rubocop target version to 3x.  Update ruby matrix in specs. Update readme and gemspec with required ruby versions.

* Remove rubocop-rspec for now since there are lots of violations
  • Loading branch information
vipulnsward authored Mar 9, 2024
1 parent 990071c commit fc50f5d
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 29 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ jobs:
strategy:
matrix:
ruby-version:
- 2.7
- 3.0
- 3.1
- 3.2
- 3.3

steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler: 2.4
bundler: latest
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Run tests
Expand All @@ -41,8 +41,7 @@ jobs:
strategy:
matrix:
ruby-version:
- 2.7
- 3.2
- 3.3
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
Expand Down
6 changes: 1 addition & 5 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AllCops:
NewCops: enable
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0

Layout/LineLength:
Max: 120
Expand All @@ -14,10 +14,6 @@ Style/HashTransformKeys:
- 'lib/uploadcare/client/conversion/video_conversion_client.rb'
- 'lib/uploadcare/entity/file.rb'

Gemspec/RequiredRubyVersion:
Exclude:
- 'uploadcare-ruby.gemspec'

Metrics/BlockLength:
Exclude:
- 'bin/'
Expand Down
12 changes: 6 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

source 'https://rubygems.org'

gem 'byebug', '~> 11.1'
gem 'rake', '~> 13.0'
gem 'rspec', '~> 3.0'
gem 'rubocop', '~> 1.48'
gem 'vcr', '~> 6.1'
gem 'webmock', '~> 3.18'
gem 'byebug'
gem 'rake'
gem 'rspec'
gem 'rubocop'
gem 'vcr'
gem 'webmock'

# Specify your gem's dependencies in uploadcare-ruby.gemspec
gemspec
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ wrapping Upload and REST APIs.
* [Useful links](#useful-links)

## Requirements
* ruby 2.7+
* ruby 3.0+

## Compatibility

Expand Down
12 changes: 0 additions & 12 deletions lib/uploadcare.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,6 @@
module Uploadcare
extend Dry::Configurable

# NOTE: The dry-configurable gem has introduced the `default` keyword argument
# and deprecated the positional default argument in v0.13.0, which requires
# Ruby >= 2.6.0. In order to provide backwards compatibility and not disable
# deprecation warnings, we override the dry-configurable's `setting` DSL method.
def self.setting(name, default:, **options, &block)
if RUBY_VERSION < '2.6'
super(name, default, &block)
else
super
end
end

setting :public_key, default: ENV.fetch('UPLOADCARE_PUBLIC_KEY', '')
setting :secret_key, default: ENV.fetch('UPLOADCARE_SECRET_KEY', '')
setting :auth_type, default: 'Uploadcare'
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require 'byebug'
require 'webmock/rspec'
require 'uploadcare'
Dir[File.expand_path(File.join(File.dirname(__FILE__), 'support', '**', '*.rb'))].sort.each { |f| require f }
Dir[File.expand_path(File.join(File.dirname(__FILE__), 'support', '**', '*.rb'))].each { |f| require f }

RSpec.configure do |config|
include Uploadcare::Exception
Expand Down
2 changes: 2 additions & 0 deletions uploadcare-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib', 'lib/uploadcare', 'lib/uploadcare/rest']

spec.required_ruby_version = '>= 3.0'

spec.add_dependency 'mimemagic', '~> 0.4'
spec.add_dependency 'parallel', '~> 1.22'
spec.add_dependency 'retries', '~> 0.0'
Expand Down

0 comments on commit fc50f5d

Please sign in to comment.