mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
975fd746db
* PluginManager#load_cli_options: use the realpath Since ruby 2.5, `require 'foo'` will use the realpath of the file corresponding to foo.rb. However `require '/absolute/path/to/foo.rb'` won't use the realpath. So when $GEM_HOME contains a symlink (ie it is not the realpath), when a pry plugin is loaded, by `activate!`: require gem_name if !active? the real_path of `gem_name` is used. But then in load_cli_options: cli_options_file = File.join(spec.full_gem_path, "lib/#{spec.name}/cli.rb") require cli_options_file if File.exist?(cli_options_file) since the path given is absolute, it will be used directly without realpath. This means that cli.rb may potentially be required twice (once via its realpath if the plugin requires it, the other via its $GEM_HOME path when required by `load_cli_options`), which could raise some errors. Fix this by using the realpath in load_cli_options too. Revision r59984 in ruby 2.5 introduced the use of realpath for load paths, and it was backported to version 2.4 in the minor revision 2.4.4. So only use the realpath ourselves for ruby versions above or equal to 2.4.4. |
||
---|---|---|
.. | ||
pry | ||
pry.rb |