tl;dr
Pry can't find several of my installed gems because the gems found by Gem::Specification are different than the gems found by gem list --local. The ruby versions are the same, and the path to the found and not-found gems seems to be the same.
I'm thinking that I must have some mix up with paths or ruby versions, but I can't find the culprit. Any ideas of how to untangle this?
Details
I'm running ruby 2.2.0 using rvm on OS X Yosemite, and I'm having an issue getting pry to find several of my installed gems (in particular, pry-doc).
Here are my versions:
lee$ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
lee$ pry -v
Pry version 0.10.1 on Ruby 2.2.0
lee$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.6
- RUBY VERSION: 2.2.0 (2014-12-25 patchlevel 0) [x86_64-darwin14]
- INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-2.2.0
- RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-2.2.0/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-2.2.0/bin
- SPEC CACHE DIRECTORY: /Users/lee/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-14
- GEM PATHS:
- /usr/local/rvm/gems/ruby-2.2.0
- /usr/local/rvm/gems/ruby-2.2.0@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--omg"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/rvm/gems/ruby-2.2.0/bin
- /usr/local/rvm/gems/ruby-2.2.0@global/bin
- /usr/local/rvm/rubies/ruby-2.2.0/bin
- /usr/local/rvm/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/git/bin
- /opt/sm/bin
- /opt/sm/pkg/active/bin
- /opt/sm/pkg/active/sbin
- /opt/sm/bin
- /opt/sm/pkg/active/bin
- /opt/sm/pkg/active/sbin
Listing gems via the command line returns what I expect:
lee$ gem list --local | grep 'pry'
pry (0.10.1)
pry-doc (0.8.0)
pry-git (0.2.3)
pry-nav (0.2.4)
pry-rails (0.3.4)
And the paths for both pry and bash seem to be the same
lee$ gem which pry
/usr/local/rvm/gems/ruby-2.2.0/gems/pry-0.10.1/lib/pry.rb
lee$ gem which pry-doc
/usr/local/rvm/gems/ruby-2.2.0/gems/pry-doc-0.8.0/lib/pry-doc.rb
pry(main)> $ pry
From: /usr/local/rvm/gems/ruby-2.2.0/gems/pry-0.10.1/lib/pry/core_extensions.rb @ line 41:
...
However, in pry, the gems available to be installed are controlled by Gem::Specification from the rubygems library. Running the following:
# I know this method is a mess, but it does the job
def prys
Gem::Specification.sort_by{ |g| [g.name.downcase, g.version] }
.select { |g| g.name =~ /pry/ }
.group_by{ |g| g.name }
.map { |name, versions|
"#{name} (#{versions.map { |v| v.version.to_s }.join(', ') })"
}
end
prys
returns:
=> ["pry (0.10.1)", "pry-rails (0.3.4)"]
I've tried uninstalling and reinstalling as well as hunting around for another copy of the found gems, but no luck. I can't figure out the pattern for what's being returned either.
Any ideas of what to try next?
Aucun commentaire:
Enregistrer un commentaire