[ruby-core:121134] [Ruby master Bug#20714] Handle optional dependencies in `bundled_gems.rb`
From:
deivid via ruby-core <ruby-core@...>
Date:
2025-02-20 16:44:23 UTC
List:
ruby-core #121134
Issue #20714 has been updated by deivid (David Rodr=EDguez). @hsbt I tried my approach again, but (I think) without the defect of making= users possibly miss the bundled gems warnings completely if they jump from= one version that did not show warnings to a version where the bundled gem = is already removed. This: https://github.com/ruby/ruby/pull/11550. However, as pointed out before, it does not remove the warnings while the g= em has not yet been removed, so I'm not convinced it's worth introducing. @Earlopain's alternative seems a bit more appealing since it at least provi= des a way for users to get rid of the warnings without having to artificial= ly add a gem that's not really required as a dependency. But overall, the `require ..., optional: true` feature idea seems like the = best alternative to me. ---------------------------------------- Bug #20714: Handle optional dependencies in `bundled_gems.rb` https://bugs.ruby-lang.org/issues/20714#change-112064 * Author: Earlopain (Earlopain _) * Status: Assigned * Assignee: hsbt (Hiroshi SHIBATA) * ruby -v: 3.3.5 * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- I've encountered a few places around bundled gems where the library doesn't= care if the gem is available, but will still provide some functionallity i= f it is. The way to accomplish that right now seems to be by setting `$VERBOSE =3D n= il` and resetting it later again to not bother the user with the warning ab= out the gem. However, this has the effect of silencing the warning about ot= her gems as well, that may not be prepared about the bundling.=20 >>From `ruby/reline` for example: https://github.com/ruby/reline/blob/c90f08f= 7e308d2f1cdd7cfaf9939fe45ce546fd2/lib/reline/terminfo.rb#L1-L15 Or the `logging` gem: https://github.com/TwP/logging/blob/df41715364f7eb8c6= 5098cd3c3316677ef1f3784/lib/logging.rb#L9-L15 I propose to simply delay the warning to the next require. GitHub PR at https://github.com/ruby/ruby/pull/11545 --=20 https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.rub= y-lang.org/