Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby 3.2.0 compatibility #170

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 13 additions & 43 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,22 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: ['3.1']
node-version: ['10']
puppeteer-version: [
'1.20.0',
'2.1.1',
'3.3.0',
'4.0.1',
'5.5.0',
'6.0.0',
'7.1.0',
'8.0.0',
'9.1.1',
'10.4.0',
'11.0.0',
'12.0.1',
'13.7.0',
'14.4.1',
'15.5.0',
'16.2.0',
'17.1.3'
]
ruby-version: ['3.2']
node-version: ['14', '16', '18']
puppeteer-version: ['14.4.1', '15.5.0', '16.2.0', '17.1.3', '18.2.1', '19.4.1']
include:
- ruby-version: '2.6'
node-version: '10'
puppeteer-version: '17.1.3'
- ruby-version: '2.7'
node-version: '10'
puppeteer-version: '17.1.3'
- ruby-version: '3.0'
node-version: '10'
puppeteer-version: '17.1.3'
- ruby-version: '3.1'
node-version: '12'
puppeteer-version: '17.1.3'
- ruby-version: '3.1'
node-version: '14'
puppeteer-version: '17.1.3'
- ruby-version: '3.1'
node-version: '16'
puppeteer-version: '17.1.3'
- ruby-version: '3.1'
node-version: '18'
puppeteer-version: '17.1.3'
puppeteer-version: '19.4.1'
- ruby-version: '3.0'
node-version: '14'
puppeteer-version: '19.4.1'
- ruby-version: '2.7'
node-version: '14'
puppeteer-version: '19.4.1'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -66,7 +36,7 @@ jobs:
bundler-cache: true

- name: Set up Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -82,6 +52,6 @@ jobs:
PUPPETEER_VERSION: ${{ matrix.puppeteer-version }}

- name: Test & publish code coverage
uses: paambaati/codeclimate-action@v3.0.0
uses: paambaati/codeclimate-action@v3.2.0
env:
CC_TEST_REPORTER_ID: 5cfed40102c670b5c9e509730782b751939ddbe53fc57c317b718f635bab1ce8
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require: rubocop-rspec

AllCops:
NewCops: enable
TargetRubyVersion: 2.6
TargetRubyVersion: 2.7

Layout/DotPosition:
EnforcedStyle: trailing
Expand Down
11 changes: 5 additions & 6 deletions grover.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require 'grover/version'

Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
Gem::Specification.new do |spec|
spec.name = 'grover'
spec.version = Grover::VERSION
spec.authors = ['Andrew Bromwich']
Expand All @@ -16,7 +16,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
SUMMARY
spec.homepage = 'https://github.com/Studiosity/grover'
spec.license = 'MIT'
spec.required_ruby_version = ['>= 2.6.0', '< 3.2.0']
spec.required_ruby_version = ['>= 2.7.0', '< 3.3.0']

# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
# delete this section to allow pushing this gem to any host.
Expand All @@ -27,7 +27,6 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength

spec.files = `git ls-files lib`.split("\n") + ['LICENSE']
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^spec/})
spec.require_paths = ['lib']

spec.add_dependency 'combine_pdf', '~> 1.0'
Expand All @@ -36,10 +35,10 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
spec.add_development_dependency 'mini_magick', '~> 4.9'
spec.add_development_dependency 'pdf-reader', '~> 2.2'
spec.add_development_dependency 'rack-test', '~> 1.1'
spec.add_development_dependency 'rake', '~> 12.3'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '~> 3.8'
spec.add_development_dependency 'rubocop', '~> 0.72'
spec.add_development_dependency 'rubocop-rspec', '~> 1.33'
spec.add_development_dependency 'rubocop', '~> 1.41'
spec.add_development_dependency 'rubocop-rspec', '~> 2.16'
# Limit simplecov to 0.17.x due to https://github.com/codeclimate/test-reporter/issues/413
spec.add_development_dependency 'simplecov', '~> 0.17', '< 0.18'
end
121 changes: 16 additions & 105 deletions lib/active_support_ext/object/duplicable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,122 +31,33 @@ def duplicable?
end
end

class NilClass
begin
nil.dup
rescue TypeError
# +nil+ is not duplicable:
#
# nil.duplicable? # => false
# nil.dup # => TypeError: can't dup NilClass
def duplicable?
false
end
end
end

class FalseClass
begin
false.dup
rescue TypeError
# +false+ is not duplicable:
#
# false.duplicable? # => false
# false.dup # => TypeError: can't dup FalseClass
def duplicable?
false
end
end
end

class TrueClass
begin
true.dup
rescue TypeError
# +true+ is not duplicable:
#
# true.duplicable? # => false
# true.dup # => TypeError: can't dup TrueClass
def duplicable?
false
end
end
end

class Symbol
begin
:symbol.dup # Ruby 2.4.x.
'symbol_from_string'.to_sym.dup # Some symbols can't `dup` in Ruby 2.4.0.
rescue TypeError
# Symbols are not duplicable:
#
# :my_symbol.duplicable? # => false
# :my_symbol.dup # => TypeError: can't dup Symbol
def duplicable?
false
end
end
end

class Numeric
begin
1.dup
rescue TypeError
# Numbers are not duplicable:
#
# 3.duplicable? # => false
# 3.dup # => TypeError: can't dup Integer
def duplicable?
false
end
end
end

require 'bigdecimal'
class BigDecimal
# BigDecimals are duplicable:
class Method
# Methods are not duplicable:
#
# BigDecimal("1.2").duplicable? # => true
# BigDecimal("1.2").dup # => #<BigDecimal:...,'0.12E1',18(18)>
# method(:puts).duplicable? # => false
# method(:puts).dup # => TypeError: allocator undefined for Method
def duplicable?
true
false
end
end

class Method
# Methods are not duplicable:
class UnboundMethod
# Unbound methods are not duplicable:
#
# method(:puts).duplicable? # => false
# method(:puts).dup # => TypeError: allocator undefined for Method
# method(:puts).unbind.duplicable? # => false
# method(:puts).unbind.dup # => TypeError: allocator undefined for UnboundMethod
def duplicable?
false
end
end

class Complex
begin
Complex(1).dup
rescue TypeError
# Complexes are not duplicable:
#
# Complex(1).duplicable? # => false
# Complex(1).dup # => TypeError: can't copy Complex
def duplicable?
false
end
end
end
require 'singleton'

class Rational
begin
Rational(1).dup
rescue TypeError
# Rationals are not duplicable:
#
# Rational(1).duplicable? # => false
# Rational(1).dup # => TypeError: can't copy Rational
def duplicable?
false
end
module Singleton
# Singleton instances are not duplicable:
#
# Class.new.include(Singleton).instance.dup # TypeError (can't dup instance of singleton
def duplicable?
false
end
end
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
},
"homepage": "https://github.com/Studiosity/grover#readme",
"devDependencies": {
"puppeteer": "^17.1.3"
"puppeteer": "^19.4.1"
}
}
4 changes: 2 additions & 2 deletions spec/active_support_ext/object/deep_dup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
object = Object.new
dup = object.deep_dup
dup.instance_variable_set(:@a, 1)
expect(object.instance_variable_defined?(:@a)).to eq false
expect(dup.instance_variable_defined?(:@a)).to eq true
expect(object.instance_variable_defined?(:@a)).to be false
expect(dup.instance_variable_defined?(:@a)).to be true
end
end

Expand Down
Loading