From 83e1db1a0141a218a045233acde630319e98c48a Mon Sep 17 00:00:00 2001 From: Pascal Zumkehr Date: Wed, 22 Apr 2026 08:03:34 +0200 Subject: [PATCH 1/2] Add support for ruby 4.0 --- .github/workflows/build.yml | 6 +-- Gemfile.lock | 70 ++++++++++++++++------------ lib/prawn/markup/processor/images.rb | 1 + prawn-markup.gemspec | 2 + 4 files changed, 46 insertions(+), 33 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be43607..aed7fb0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ["3.1", "3.2", "3.3"] + ruby-version: ["3.3", "3.4", "4.0"] steps: - uses: actions/checkout@v4 @@ -32,7 +32,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3.2 + ruby-version: 4.0 bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run rubocop run: bundle exec rubocop @@ -46,7 +46,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3.2 + ruby-version: 4.0 bundler-cache: true # runs 'bundle install' and caches installed gems automatically - uses: paambaati/codeclimate-action@v9.0.0 env: diff --git a/Gemfile.lock b/Gemfile.lock index 8f0d1f3..da6c5a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,6 +2,7 @@ PATH remote: . specs: prawn-markup (1.1.0) + base64 nokogiri prawn prawn-table @@ -10,29 +11,33 @@ GEM remote: https://rubygems.org/ specs: Ascii85 (2.0.1) - afm (0.2.2) - ast (2.4.2) - bigdecimal (3.1.9) - byebug (11.1.3) - diff-lcs (1.6.0) + afm (1.0.0) + ast (2.4.3) + base64 (0.3.0) + bigdecimal (3.3.1) + byebug (13.0.0) + reline (>= 0.6.0) + diff-lcs (1.6.2) docile (1.4.1) hashery (2.1.2) - json (2.10.2) - language_server-protocol (3.17.0.4) + io-console (0.8.2) + json (2.19.4) + language_server-protocol (3.17.0.5) lint_roller (1.1.0) - matrix (0.4.2) - nokogiri (1.18.9-x86_64-linux-gnu) + logger (1.7.0) + matrix (0.4.3) + nokogiri (1.19.2-x86_64-linux-gnu) racc (~> 1.4) - parallel (1.26.3) - parser (3.3.7.1) + parallel (1.28.0) + parser (3.3.11.1) ast (~> 2.4.1) racc pdf-core (0.10.0) pdf-inspector (1.3.0) pdf-reader (>= 1.0, < 3.0.a) - pdf-reader (2.14.1) + pdf-reader (2.15.1) Ascii85 (>= 1.0, < 3.0, != 2.0.0) - afm (~> 0.2.1) + afm (>= 0.2.1, < 2) hashery (~> 2.0) ruby-rc4 ttfunk @@ -42,49 +47,53 @@ GEM ttfunk (~> 1.8) prawn-table (0.2.2) prawn (>= 1.3.0, < 3.0.0) + prism (1.9.0) racc (1.8.1) rainbow (3.1.1) - rake (13.2.1) - regexp_parser (2.10.0) - rspec (3.13.0) + rake (13.4.2) + regexp_parser (2.12.0) + reline (0.6.3) + io-console (~> 0.5) + rspec (3.13.2) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.3) + rspec-core (3.13.6) rspec-support (~> 3.13.0) - rspec-expectations (3.13.3) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.2) + rspec-mocks (3.13.8) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-support (3.13.2) - rubocop (1.72.2) + rspec-support (3.13.7) + rubocop (1.86.1) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) - parallel (~> 1.10) + parallel (>= 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.38.0, < 2.0) + rubocop-ast (>= 1.49.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.38.0) - parser (>= 3.3.1.0) + rubocop-ast (1.49.1) + parser (>= 3.3.7.2) + prism (~> 1.7) ruby-progressbar (1.13.0) ruby-rc4 (0.1.5) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.13.1) + simplecov-html (0.13.2) simplecov_json_formatter (0.1.4) ttfunk (1.8.0) bigdecimal (~> 3.1) - unicode-display_width (3.1.4) - unicode-emoji (~> 4.0, >= 4.0.4) - unicode-emoji (4.0.4) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.2.0) PLATFORMS x86_64-linux @@ -92,6 +101,7 @@ PLATFORMS DEPENDENCIES bundler byebug + logger matrix pdf-inspector prawn-markup! @@ -101,4 +111,4 @@ DEPENDENCIES simplecov BUNDLED WITH - 2.2.31 + 2.7.1 diff --git a/lib/prawn/markup/processor/images.rb b/lib/prawn/markup/processor/images.rb index 209f0eb..b084a36 100644 --- a/lib/prawn/markup/processor/images.rb +++ b/lib/prawn/markup/processor/images.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'base64' require 'open-uri' module Prawn diff --git a/prawn-markup.gemspec b/prawn-markup.gemspec index b601b27..138c264 100644 --- a/prawn-markup.gemspec +++ b/prawn-markup.gemspec @@ -23,12 +23,14 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] + spec.add_dependency 'base64' spec.add_dependency 'nokogiri' spec.add_dependency 'prawn' spec.add_dependency 'prawn-table' spec.add_development_dependency 'bundler' spec.add_development_dependency 'byebug' + spec.add_development_dependency 'logger' spec.add_development_dependency 'matrix' spec.add_development_dependency 'pdf-inspector' spec.add_development_dependency 'rake' From 9a368d0cc6d52a78d7ac2eca12a94e7396f1fd57 Mon Sep 17 00:00:00 2001 From: Pascal Zumkehr Date: Wed, 22 Apr 2026 08:18:36 +0200 Subject: [PATCH 2/2] Remove dead code climate integration --- .github/workflows/build.yml | 19 ------------------- README.md | 2 -- lib/prawn/markup/builders/nestable_builder.rb | 2 +- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aed7fb0..5a91915 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,22 +36,3 @@ jobs: bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run rubocop run: bundle exec rubocop - - coverage: - name: Coverage - runs-on: ubuntu-latest - if: ${{ !github.event.pull_request.head.repo.fork }} - steps: - - uses: actions/checkout@v4 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 4.0 - bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - uses: paambaati/codeclimate-action@v9.0.0 - env: - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - with: - coverageCommand: bundle exec rake - coverageLocations: | - ${{github.workspace}}/spec/coverage/coverage.json:simplecov diff --git a/README.md b/README.md index 84558c4..12e351a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # Prawn::Markup [![Build Status](https://github.com/puzzle/prawn-markup/actions/workflows/build.yml/badge.svg)](https://github.com/puzzle/prawn-markup/actions/workflows/build.yml) -[![Maintainability](https://api.codeclimate.com/v1/badges/52a462f9d65e33352d4e/maintainability)](https://codeclimate.com/github/puzzle/prawn-markup/maintainability) -[![Test Coverage](https://api.codeclimate.com/v1/badges/52a462f9d65e33352d4e/test_coverage)](https://codeclimate.com/github/puzzle/prawn-markup/test_coverage) Adds simple HTML snippets into [Prawn](http://prawnpdf.org)-generated PDFs. All elements are layouted vertically using Prawn's formatting options. A major use case for this gem is to include WYSIWYG-generated HTML parts into server-generated PDF documents. diff --git a/lib/prawn/markup/builders/nestable_builder.rb b/lib/prawn/markup/builders/nestable_builder.rb index 04ba4d7..d9463bb 100644 --- a/lib/prawn/markup/builders/nestable_builder.rb +++ b/lib/prawn/markup/builders/nestable_builder.rb @@ -50,7 +50,7 @@ def natural_image_dimensions(hash) def extract_text_cell_style(hash) TEXT_STYLE_OPTIONS - .each_with_object({}) { |key, h| h[key] = hash[key] } + .to_h { |key| [key, hash[key]] } .tap { |options| convert_style_options(options) } end