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

Consider documenting how to work with local gems #966

Open
lread opened this issue Oct 14, 2020 · 3 comments
Open

Consider documenting how to work with local gems #966

lread opened this issue Oct 14, 2020 · 3 comments

Comments

@lread
Copy link
Contributor

lread commented Oct 14, 2020

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?

@robertpanzer
Copy link
Member

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.

@lread
Copy link
Contributor Author

lread commented Oct 14, 2020

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

@abelsromero
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants