'#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
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I use RBENV to manage my Ruby versions, and while spelunking in the codebase, I found its
rubygems_plugin.rbfile. 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 rehashdoesn't execute. On closer inspection, I discovered that it's becauseinstaller.spec.executables.any?returnsfalseif the gem was previously installed.Note- for the purposes of this question, my concern is not with whether their
rubygems_plugin.rbuses the#executablesmethod 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::Specificationcode, and I don't yet know where theexecutablesarray 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