summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2020-05-02 12:22:42 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-05-08 14:13:29 +0900
commitde57d3895ef6eb681c12a27720e7c185a22023d7 (patch)
treea110505911bfbf01ee2aac542471cdc9b77d9bef
parentc58d69e6982b2261f0533e846de4c54d04a1f293 (diff)
[rubygems/rubygems] Shortcuit method earlier
If the class variable is set, we can skip the whole thing from the beginning. Co-authored-by: MSP-Greg <MSP-Greg@users.noreply.github.com> https://github.com/rubygems/rubygems/commit/83abf3a3d4
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3092
-rw-r--r--lib/rubygems/installer.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index cb212e9ae3..343037ebf5 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -706,6 +706,8 @@ class Gem::Installer
end
def check_that_user_bin_dir_is_in_path # :nodoc:
+ return if self.class.path_warning
+
user_bin_dir = @bin_dir || Gem.bindir(gem_home)
user_bin_dir = user_bin_dir.gsub(File::SEPARATOR, File::ALT_SEPARATOR) if
File::ALT_SEPARATOR
@@ -720,10 +722,8 @@ class Gem::Installer
unless path.include? user_bin_dir
unless !Gem.win_platform? && (path.include? user_bin_dir.sub(ENV['HOME'], '~'))
- unless self.class.path_warning
- alert_warning "You don't have #{user_bin_dir} in your PATH,\n\t gem executables will not run."
- self.class.path_warning = true
- end
+ alert_warning "You don't have #{user_bin_dir} in your PATH,\n\t gem executables will not run."
+ self.class.path_warning = true
end
end
end