Pygments fails because Asciidoctor uses system gem despite brew

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Pygments fails because Asciidoctor uses system gem despite brew

Syzygies
I'm documenting an odd bug that I worked out, where Asciidoctor would claim in error that the pygments.rb gem was not installed.

Many of us on Mac OS override the system Ruby with homebrew's more recent Ruby, despite warnings that this can lead to trouble. I'm documenting the only trouble I've ever experienced, doing this:

Asciidoctor looks to the system gems in /Library/Ruby/Gems/*/gems rather that the homebrew gems in /usr/local/lib/ruby/gems/*/gems, even if one's path is correctly set to give homebrew's versions of ruby and gem in /usr/local/bin precedence.

Fix: Use `sudo /usr/bin/gem install pygments.rb` to install pygments.rb.

It would be worth fixing this behavior, however minor this issue might seem. I spent some time sorting this out, after nearly reverting to asciidoc in fear that asciidoctor harbored instabilities I would never master. I don't use Antora, for example, because I couldn't see what it adds that I need in my use cases. Asciidoctor certainly gives the initial impression of being slicker than asciidoc, but I couldn't answer a similar question: Why was I choosing a newer product with a smaller user base? I ultimately don't like leaving anything I don't understand, and I like writing in the intersection of several systems for as long as feasible. Others might have experienced my above failure to get pygments working, and simply left for asciidoc, where it works trivially.
Reply | Threaded
Open this post in threaded view
|

Re: Pygments fails because Asciidoctor uses system gem despite brew

mojavelinux
Administrator
I can assure you that Asciidoctor loads pygments.rb in the normal Ruby way (using `require 'pygments.rb'`). Just like with any gem, the gem must be on the GEM_PATH. If you have gems installed in multiple places on the system, then you must update the GEM_PATH environment variable to include those locations. Asciidoctor doesn't go looking in special places for gems so it behaves in the most portable way possible.

Frankly, I don't know what the point of the rest of the post was. Did you have a specific question?

Cheers,

-Dan

On Thu, Mar 7, 2019 at 11:23 AM Syzygies [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I'm documenting an odd bug that I worked out, where Asciidoctor would claim in error that the pygments.rb gem was not installed.

Many of us on Mac OS override the system Ruby with homebrew's more recent Ruby, despite warnings that this can lead to trouble. I'm documenting the only trouble I've ever experienced, doing this:

Asciidoctor looks to the system gems in /Library/Ruby/Gems/*/gems rather that the homebrew gems in /usr/local/lib/ruby/gems/*/gems, even if one's path is correctly set to give homebrew's versions of ruby and gem in /usr/local/bin precedence.

Fix: Use `sudo /usr/bin/gem install pygments.rb` to install pygments.rb.

It would be worth fixing this behavior, however minor this issue might seem. I spent some time sorting this out, after nearly reverting to asciidoc in fear that asciidoctor harbored instabilities I would never master. I don't use Antora, for example, because I couldn't see what it adds that I need in my use cases. Asciidoctor certainly gives the initial impression of being slicker than asciidoc, but I couldn't answer a similar question: Why was I choosing a newer product with a smaller user base? I ultimately don't like leaving anything I don't understand, and I like writing in the intersection of several systems for as long as feasible. Others might have experienced my above failure to get pygments working, and simply left for asciidoc, where it works trivially.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Pygments-fails-because-Asciidoctor-uses-system-gem-despite-brew-tp6783.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Pygments fails because Asciidoctor uses system gem despite brew

Syzygies
I have multiple machines, and I was able to trace the bug to homebrew's recipe for installing Asciidoctor.

Homebrew calls the gem command associated with the system Ruby, even if a more modern Ruby is earlier on the PATH. This then requires that one uses the full path to that gem command for Asciidoctor maintenance, such as adding Pygment support.

Clearly, one shouldn't use homebrew; just use gem, as the Asciidoctor documentation specifies. Many of us will automatically use a homebrew formula if available, so the formula should at least give a warning.

I could have worded the rest better: If one Googles issues with Asciidoctor not finding pygments.rb, one sees past problems but not past solutions. This was disconcerting enough for me to consider reverting to Asciidoc. I'm trying to help here so you don't give the wrong impression to other new users.
Reply | Threaded
Open this post in threaded view
|

Re: Pygments fails because Asciidoctor uses system gem despite brew

mojavelinux
Administrator
You got it!

Cheers,

-Dan

On Sat, Mar 9, 2019 at 9:21 PM Syzygies [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I have multiple machines, and I was able to trace the bug to homebrew's recipe for installing Asciidoctor.

Homebrew calls the gem command associated with the system Ruby, even if a more modern Ruby is earlier on the PATH. This then requires that one uses the full path to that gem command for Asciidoctor maintenance, such as adding Pygment support.

Clearly, one shouldn't use homebrew; just use gem, as the Asciidoctor documentation specifies.



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Pygments-fails-because-Asciidoctor-uses-system-gem-despite-brew-tp6783p6792.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux