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

Remove Ruby 2.7 from supported versions (EOL) #267

Merged
merged 2 commits into from
Nov 26, 2024
Merged
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
15 changes: 6 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,24 @@ jobs:
'20.9.0',
'21.9.0',
'22.15.0',
'23.2.1',
'23.8.0',
]
include:
- ruby-version: '2.7'
node-version: '18'
puppeteer-version: '23.2.1'
- ruby-version: '3.0'
node-version: '18'
puppeteer-version: '23.2.1'
puppeteer-version: '23.8.0'
- ruby-version: '3.1'
node-version: '18'
puppeteer-version: '23.2.1'
puppeteer-version: '23.8.0'
- ruby-version: '3.2'
node-version: '18'
puppeteer-version: '23.2.1'
puppeteer-version: '23.8.0'
- ruby-version: '3.3'
node-version: '20'
puppeteer-version: '23.2.1'
puppeteer-version: '23.8.0'
- ruby-version: '3.3'
node-version: '22'
puppeteer-version: '23.2.1'
puppeteer-version: '23.8.0'

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require:

AllCops:
NewCops: enable
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0

Layout/DotPosition:
EnforcedStyle: trailing
Expand Down
2 changes: 1 addition & 1 deletion grover.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
SUMMARY
spec.homepage = 'https://github.com/Studiosity/grover'
spec.license = 'MIT'
spec.required_ruby_version = ['>= 2.7.0', '< 3.4.0']
spec.required_ruby_version = ['>= 3.0.0', '< 3.4.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 Down
6 changes: 3 additions & 3 deletions lib/grover/middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def _call(env) # rubocop:disable Metrics/MethodLength

private

PDF_REGEX = /\.pdf$/i.freeze
PNG_REGEX = /\.png$/i.freeze
JPEG_REGEX = /\.jpe?g$/i.freeze
PDF_REGEX = /\.pdf$/i
PNG_REGEX = /\.png$/i
JPEG_REGEX = /\.jpe?g$/i

attr_reader :pdf_request, :png_request, :jpeg_request

Expand Down
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": "^23.2.1"
"puppeteer": "^23.8.0"
}
}
8 changes: 7 additions & 1 deletion spec/grover/processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,13 @@
context 'when options includes A4 page format' do
let(:options) { { format: 'A4' } }
let(:media_box) do
puppeteer_version_on_or_after?('21') ? [0, 0, 595.91998, 842.88] : [0, 0, 594.95996, 841.91998]
if puppeteer_version_on_or_after?('23.3.1')
[0, 0, 595.91998, 841.91998]
elsif puppeteer_version_on_or_after?('21')
[0, 0, 595.91998, 842.88]
else
[0, 0, 594.95996, 841.91998]
end
end

it { expect(pdf_reader.pages.first.attributes).to include(MediaBox: media_box) }
Expand Down
7 changes: 5 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,18 @@ def fixture_path(file)
end

def puppeteer_version_on_or_after?(version)
puppeteer_version = ENV.fetch('PUPPETEER_VERSION', '')
puppeteer_version.empty? || Gem::Version.new(puppeteer_version) >= Gem::Version.new(version)
end

def puppeteer_version_on_or_before?(version)
puppeteer_version = ENV.fetch('PUPPETEER_VERSION', '')
puppeteer_version.empty? || Gem::Version.new(puppeteer_version) <= Gem::Version.new(version)
end

def puppeteer_version
@puppeteer_version ||=
ENV.fetch('PUPPETEER_VERSION', nil) || `npm list puppeteer`[/puppeteer@(\d{1,3}(.\d{1,3}){0,2})\n/, 1]
end

def linux_system?
uname = `uname -s`
uname.start_with? 'Linux'
Expand Down
Loading