asciidoctorj icon indicating copy to clipboard operation
asciidoctorj copied to clipboard

Consider documenting how to work with local gems

Open lread opened this issue 5 years ago • 3 comments

My confusion might be due to me being new to JRuby and AsciidoctorJ, but I expect I a tip or link would be helpful here (apologies if I missed something that exists).

I'm trying to do a little println (or should I say puts?) debugging for a referenced gem, namely asciidoctor.

I am finding myself spinning my wheels trying to figure out how to reference a local version of the asciidoctor gem from AsciidoctorJ.

Is there an easy way to achieve this?

I see GEM_PATH mentioned in current docs. Is it relevant?

Or is this the path?

lread avatar Oct 14 '20 13:10 lread

I am also not that proficient with Ruby Gems ;) What I usually do is

  1. run the build
  2. Update the Ruby code under asciidoctorj/build/preparedGems (The combo IntelliJ/Gradle can surprise you with sometimes using out/ instead of build/ for the classpath)
  3. Run the test or program from IntelliJ.

robertpanzer avatar Oct 14 '20 13:10 robertpanzer

Thanks @robertpanzer, your tip helped me to come up with a workflow that seems to work for my current experiments.

I expect this is naive, but here's what I'm doing to test with a modified asciidoctor gem:

From asciidoctor (after making some local changes):

bundle exec rake build
rm -rf /tmp/gemtest
gem install --install-dir /tmp/gemtest --local ./pkg/asciidoctor-*.gem

Then from asciidoctorj:

./gradlew clean
./gradlew assemble
rm -rf asciidoctorj-core/build/preparedGems/gems/asciidoctor-* \
       asciidoctorj-core/build/preparedGems/specifications/asciidoctor-*.gemspec
cp -rv /tmp/gemtest/gems/* asciidoctorj-core/build/preparedGems/gems
cp -v /tmp/gemtest/specifications/* asciidoctorj-core/build/preparedGems/specifications

And if I want to reference AsciidoctorJ from yet another Java project:

./gradlew -Pskip.signing publishToMavenLocal

lread avatar Oct 14 '20 17:10 lread

@lread your instructions served me well to build a jar with an asciidoctor hotfix from a branch 👍

Also, mention the repo contains the script "test-asciidoctor-upstream.sh" which can also be used to install especific versions of asciidoctor.

abelsromero avatar Oct 16 '20 19:10 abelsromero