'#executables' method inside Gem::Specification
appears to be non-idempotent. Is this intentional?
#6806
Replies: 1 comment
-
Update- this was user error on my part. I neglected to check the value of |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I use RBENV to manage my Ruby versions, and while spelunking in the codebase, I found its
rubygems_plugin.rb
file. In RBENV's case, the goal of the file appears to be to rebuild RBENV's shims whenever a gem is installed or uninstalled.This works fine when I'm doing a fresh install of a new gem, but when I run it again,
rbenv rehash
doesn't execute. On closer inspection, I discovered that it's becauseinstaller.spec.executables.any?
returnsfalse
if the gem was previously installed.Note- for the purposes of this question, my concern is not with whether their
rubygems_plugin.rb
uses the#executables
method in its intended fashion. I don't believe their usage is incorrect, but I know that if I did, I'd need to post my comments in their repo (not here). I simply mention RBENV as context for how I discovered the behavior of#executables
.I'm still getting familiar with the
Gem::Specification
code, and I don't yet know where theexecutables
array gets populated. For now, I'm just wondering if this is expected behavior or not. If so, I'd be genuinely curious to learn about the purpose of leaving it empty on subsequent installations.Thanks, I love RubyGems and I appreciate the core team's hard work. 👍
EDIT- I'm using RubyGems v3.1.6.
Beta Was this translation helpful? Give feedback.
All reactions