mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Fix requiring of rubygems
The Rubygem documentation here http://guides.rubygems.org/name-your-gem/ suggests the naming of rubygems. If the name contains dashes (-) the require statements should include forward slashes that replace the dashes. For example, the 'net-ssh' rubygem should have the require statement of ```ruby require 'net/ssh' ``` This simple fix tries to address this problem and falls back to the original require statement if there is a `LoadError`. This will handle cases where some gem author didn't follow the naming convention suggested in the documentation.
This commit is contained in:
parent
41ecfbcba8
commit
a00bb7e51c
1 changed files with 3 additions and 0 deletions
|
@ -21,6 +21,9 @@ class Pry
|
|||
def process(gem)
|
||||
Rubygem.install(gem)
|
||||
output.puts "Gem `#{ text.green(gem) }` installed."
|
||||
require_path = gem.split('-').join('/')
|
||||
require require_path
|
||||
rescue LoadError
|
||||
require gem
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue