asciidoctor / asciidoctorj

:coffee: Java bindings for Asciidoctor. Asciidoctor on the JVM!
http://asciidoctor.org
Apache License 2.0
617 stars 172 forks source link

Fixes #1230. Add test to make sure Asciidoctor version is returned wh… #1243

Closed robertpanzer closed 7 months ago

robertpanzer commented 7 months ago

…en using --version

Thank you for opening a pull request and contributing to AsciidoctorJ!

Please take a bit of time giving some details about your pull request:

Kind of change

Description

What is the goal of this pull request?

This PR fixes #1230.

1230 mentioned that we have a fallback when returning the version of the packaged Asciidoctor version.

This PR removes that fallback and would fail hard with a NullPointerException if the generated file containing the version numbers is not available. Additionally a test makes sure that the generated file is available.

How does it achieve that?

Remove the fallback, and enhance the tests.

Are there any alternative ways to implement this?

We could search the class path for the asciidoctor gemspec and parse that, or maybe call some API exposed by JRuby to query the gems (or a Ruby-native API).

Are there any implications of this pull request? Anything a user must know?

No, everything should work as before.

Issue

If this PR fixes an open issue, please add a line of the form:

Fixes #1230

Release notes

Please add a corresponding entry to the file CHANGELOG.adoc

robertpanzer commented 7 months ago

The upstream build obviously won't work with that. I'll try to figure out a way to adapt the test accordingly. Maybe I can make the version available to the test via a system property.