asciidoctor / asciidoctor-kroki

Asciidoctor.js extension to convert diagrams to images using Kroki!
https://kroki.io/
MIT License
146 stars 47 forks source link

asciidoctor: FAILED: 'asciidoctor-kroki' could not be loaded #144

Closed demagnevalCegelec closed 3 years ago

demagnevalCegelec commented 3 years ago

I have a project where I want to render asciidoc inline svgbob using Kroki. I added gem 'asciidoctor-kroki' to my Gemfile. I have done bundle install successfully but when I run my project with the following command :

asciidoctor -r asciidoctor-kroki *.adoc -D public --trace

I have this result :

LoadError: no such file to load -- asciidoctor-kroki
     require at org/jruby/RubyKernel.java:974
     require at /opt/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
      parse! at /usr/local/bundle/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/options.rb:276
        each at org/jruby/RubyArray.java:1809
      parse! at /usr/local/bundle/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/options.rb:274
      parse! at /usr/local/bundle/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/options.rb:34
  initialize at /usr/local/bundle/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:24
      <main> at /usr/local/bundle/gems/asciidoctor-2.0.10/bin/asciidoctor:13
        load at org/jruby/RubyKernel.java:1009
      <main> at /usr/local/bundle/bin/asciidoctor:23
demagnevalCegelec commented 3 years ago

If I launch it with the directory path it's work asciidoctor -r /usr/local/bundle/gems/asciidoctor-kroki-0.1.1/lib/asciidoctor/extensions/asciidoctor_kroki *.adoc -D public

ggrossetie commented 3 years ago

Hello @demagnevalCegelec I can see jruby in the stacktrace. Are you using Asciidoctor Ruby with MRI or Asciidoctor Ruby with JRuby?

Looks like JRuby cannot resolve the gem. Is it working with other gems? For instance with https://github.com/asciidoctor/asciidoctor-diagram?

demagnevalCegelec commented 3 years ago

Hello Mogztter, Yes I'am using JRuby to generate RevealJs Slides show becaus I was having some issue generating PlantUML diagram with Ruby images I use Gitlab-CI to create my slides with bundle exec asciidoctor-revealjs my command was bundle exec asciidoctor-revealjs -r asciidoctor-diagram *.adoc -D public with Jruby witch work perfectly with asciidoctor-diagram but not with svgbob that's why I decide to switch to asciidoctor_kroki

ggrossetie commented 3 years ago

I see. To be honest, I didn't try to load this Gem using JRuby. I thought it would just work as expected but maybe I need to adjust the Gem a bit to comply with the JRuby gem loader.

Could you please tell me more about your JRuby install? Are you using rvm to install JRuby? May I ask why are using JRuby instead of MRI? JRuby is great but I believe that you will get better performance with Asciidoctor using MRI especially if you are running short-lived processes.

demagnevalCegelec commented 3 years ago

I use the standard jruby docker image. I have the following Gemfile :

source 'https://rubygems.org'

gem 'asciidoctor', '~> 2.0', '>= 2.0.10'
gem 'asciidoctor-revealjs', '~> 4.0', '>= 4.0.1'
gem 'asciidoctor-diagram'
gem 'asciidoctor-kroki'
gem 'graphviz'

I do:

- bundle install
- bundle exec asciidoctor-revealjs -r asciidoctor-diagram -r asciidoctor-kroki *.adoc -D public
> asciidoctor: FAILED: 'asciidoctor-kroki' could not be loaded
>  Use --trace for backtrace

The following is working:

bundle exec asciidoctor-revealjs -r asciidoctor-diagram -r /usr/local/bundle/gems/asciidoctor-kroki-0.1.1/lib/asciidoctor/extensions/asciidoctor_kroki *.adoc -D public
demagnevalCegelec commented 3 years ago

I have try to do the same with the ruby docker image, and I had the same issue

ggrossetie commented 3 years ago

I think I need to add a file named asciidoctor-kroki.rb in lib otherwise it won't get resolved automatically. I will do some testing and publish a new version shortly.

ggrossetie commented 3 years ago

@demagnevalCegelec I've released version 0.1.2. Could you please confirm that this issue is resolved?

demagnevalCegelec commented 3 years ago

Yes, bundle exec asciidoctor-revealjs -r asciidoctor-diagram -r asciidoctor-kroki *.adoc -D public is working fine with version 0.1.2 Thank's

ggrossetie commented 3 years ago

Awesome, thanks for your feedback :+1: