mtgrosser / nodo

Call node.js from Ruby
MIT License
27 stars 1 forks source link

Running inside .asciidoctor folder #5

Closed RayOffiah closed 9 months ago

RayOffiah commented 9 months ago

Hi there.

I've written an Asciidoctor extension in Javascript, and I'm calling it inside a Ruby script using Nodo. It seems to work, unless I move inside the .asciidoctor folder (needed to run extensions inside the Asciiidoctor IntelliJ plugin.

Nodo runs okay from the lib folder, but if I run it from .asciidoctor/lb, then it complains that it can't find the nodo file.

I'm a bit stumped because inodo shows up on $GEM_PATH correctly, but it cannot see it inside .asciidoctor/lb. I'm wondering if the problem is that the folder might appear hidden to JRuby, but I think it's more likely that it's something I'm doing, though I'm not sure what it is.

mtgrosser commented 9 months ago

How are you installing the gem? How is your code invoked?

RayOffiah commented 9 months ago

I installed with gem install nodo Installed the gem in the .asciidoctor/lib folder. The gem path is:

/projects/asciidoctor-grammkit-wrapper/.asciidoctor/lib/::/projects/asciidoctor-grammkit-wrapper/.asciidoctor/lib/gem

I'm also running a test script in

~/projects/asciidoctor-grammkit-wrapper/test/

which calls the extension and works okay.

image
mtgrosser commented 9 months ago

Can you post an actual error message?

RayOffiah commented 9 months ago
unable to render AsciiDoc document

org.jruby.exceptions.LoadError: (LoadError) no such file to load -- nodo

(the full exception stack trace is available in the IDE's log file. Visit menu item 'Help | Show Log in Explorer' to see the log)

And from the idea.log file:

org.jruby.exceptions.LoadError: (LoadError) no such file to load -- nodo
    at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1057)
    at RUBY.require(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:85)
    at RUBY.<main>(/Users/rayoffiah/projects/asciidoctor-grammkit-wrapper/.asciidoctor/lib/asciidoctor-grammkit-wrapper.rb:1)
    at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1057)
    at RUBY.require(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:85)
    at RUBY.<main>(<script>:1)
mtgrosser commented 9 months ago

Looks like your Gem.path has been messed with somehow. You could try requiring the gem manually, e.g. instead of require 'nodo'

require_relative 'gem/gems/nodo-1.6.4/lib/nodo'

Regarding JRuby, I just released 1.6.5 which should fix an error with the UNIX socket.

RayOffiah commented 9 months ago

Thanks for that.

I tried the require_relative and a few other things, but it still refuses to see the installation directory.

Rather than take any more of your time with it, I'm going to close this issue, as it's clearly an environment problem rather than something wrong at your end. 👍🏾