summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyrylo Silin <silin@kyrylo.org>2018-10-03 21:10:50 +0800
committerKyrylo Silin <silin@kyrylo.org>2018-10-03 21:13:53 +0800
commit69945d90fd8d143fbed7d8440823a6cecac0b507 (patch)
treef20fbf57492c342eea38f535f70175d193777c33
parent943a964c648b9343f4755142ca42fcf34174e928 (diff)
downloadpry-require-relative-cli.tar.gz
plugins: use require_relative instead of requirerequire-relative-cli
I've stumbled upon the following commit: https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/63046/diff/spec/ruby/core/file/ftype_spec.rb It looks like `require_relative` resolves symlinks for us, so there's no need to use `realpath` introduced in https://github.com/pry/pry/pull/1762. One caveat is that `require_relative` is not a thing in Ruby 1.9, however the plan is to drop support for it for v1.0.0 (https://github.com/pry/pry/issues/1371). This is more of a proof of concept for now since we *still* support 1.9.3, so it cannot be merged immediately.
-rw-r--r--lib/pry/plugins.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/pry/plugins.rb b/lib/pry/plugins.rb
index 8e0e9776..6015b8b3 100644
--- a/lib/pry/plugins.rb
+++ b/lib/pry/plugins.rb
@@ -36,9 +36,7 @@ class Pry
def load_cli_options
cli_options_file = File.join(spec.full_gem_path, "lib/#{spec.name}/cli.rb")
return unless File.exist?(cli_options_file)
-
- cli_options_file = File.realpath(cli_options_file) if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.4.4")
- require cli_options_file
+ require_relative cli_options_file
end
# Activate the plugin (require the gem - enables/loads the
# plugin immediately at point of call, even if plugin is