tapioca icon indicating copy to clipboard operation
tapioca copied to clipboard

Rubygems 3.4.12 "silence_warnings: uninitialized constant `Gem::DefaultUserInteraction` (`NameError`)"

Open tadman opened this issue 2 years ago • 3 comments

There might be a compatibility issue with Rubygems where Gem::DefaultUserInteraction is not automatically loaded, as in:

$ tapioca dsl

.../.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/tapioca-0.11.5/lib/tapioca.rb:22:in `silence_warnings': uninitialized constant Gem::DefaultUserInteraction (NameError)

Likely because of this:

require 'rubygems'

Gem::DefaultUserInteraction
# =>  uninitialized constant Gem::DefaultUserInteraction (NameError)

For what it's worth, force-requiring it does make that visible:

require 'rubygems/user_interaction'

Though silence_warnings doesn't do this currently, and doesn't check that it's loaded before exercising the use_ui method.

This is with Rubygems 3.4.12 and Tapioca v0.11.5 on macOS 13.3.1.

tadman avatar Apr 18 '23 20:04 tadman

Yes looks like in since v3.3.4 it's not loaded by default. We can manually load it in tapioca.

However, it's recommended that you use the binstubs tapioca generates instead which resolves the issue as well: bin/tapioca dsl or even bundle exec tapioca dsl.

KaanOzkan avatar Apr 19 '23 15:04 KaanOzkan

The binstub version does work, so that's good, but it's inconvenient that the globally installed one does not.

Should be an easy fix.

tadman avatar Apr 20 '23 15:04 tadman

If I understand this thread correctly, the fix is to require 'rubygems/user_interaction' in lib/tapioca.rb. If so, I'll create a small PR to fix this.

JamieMagee avatar Sep 11 '23 20:09 JamieMagee

I confirmed that this was solved with the merge of #1650. This bug will be gone in the next release :)

amomchilov avatar Jul 10 '24 17:07 amomchilov