asciidoctor / asciidoctor-pdf

:page_with_curl: Asciidoctor PDF: A native PDF converter for AsciiDoc based on Asciidoctor and Prawn, written entirely in Ruby.
https://docs.asciidoctor.org/pdf-converter/latest/
MIT License
1.14k stars 500 forks source link

Remove dependency on ostruct #2535

Closed mojavelinux closed 1 month ago

mojavelinux commented 1 month ago

The ostruct library is being repackaged as a gem and removed from Ruby's standard library (stdlib). Replace OpenStruct with an internal implementation to avoid this whole mess. The custom class should be named Asciidoctor::PDF::ThemeData since the only use of OpenStruct in Asciidoctor PDF is for the theme data. This also gives us the opportunity to optimize this object for more efficient access in the future.

mojavelinux commented 1 month ago

As part of this fix, json 2.7.2 also has to be installed (since json 2.7.1 uses ostruct). Normally, it gets added by rubocop. However, if lint is not enabled, it needs to be installed for simplecov/deep-cover. So if Ruby is > 3.3.4, add json as a coverage dependency. logger is also being removed from stdlib, so for now, it needs to be declared as a dependency in the Gemfile if Ruby > 3.3.4.

mojavelinux commented 1 month ago

To be clear, this doesn't solve the entire probably being introduced by Ruby's continued gemfication of APIs previously in stdlib. But it at least solves the direct dependency that Asciidoctor PDF has on the APIs being removed.