I tried to install a gem by using gem-install
command in pry, but it failed.
% pry
pry(main) > gem-install pry-doc
NoMethodError: undefined method `split' for nil:NilClass
from /Users/ironsand/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/pry-0.10.1/lib/pry/rubygem.rb:60:in `install'
I could install the gem by using gem
command from bash.
Is there something I must configure to use gem-install
command in pry
?
I hadn't used PRY for a while.
Looking through the source code found the gem-install command code.
Look at your Gem.configuration['gem']
and you will find that it is nil.
It looks like this comes from your ~/.gemrc
settings or default values.
In your ~/.gemrc file, if you place the line gem: ''
This solved the issue for me as it is no longer doing the split on nil, but on the assigned value for gem:
key in the .gemrc
file.