aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
authorMike McQuaid2017-11-04 16:31:18 +0000
committerMike McQuaid2017-11-05 14:45:36 +0000
commitb369593cbdecd9e065adc9b553cc4d7530c90c0c (patch)
tree9e62378d9b3482d37dea24a0478a7961f668f0c9 /Library/Homebrew/utils.rb
parentf999a57620d761065415bcd2d2a4141208a96eb9 (diff)
downloadbrew-b369593cbdecd9e065adc9b553cc4d7530c90c0c.tar.bz2
utils: correctly handle empty user gem env.
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 0c875a8ab..1d16044da 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -189,8 +189,11 @@ module Homebrew
def install_gem_setup_path!(name, version = nil, executable = name)
# Respect user's preferences for where gems should be installed.
- ENV["GEM_HOME"] = ENV["HOMEBREW_GEM_HOME"].to_s
- ENV["GEM_HOME"] = Gem.user_dir if ENV["GEM_HOME"].empty?
+ ENV["GEM_HOME"] = if ENV["HOMEBREW_GEM_HOME"].to_s.empty?
+ Gem.user_dir
+ else
+ ENV["HOMEBREW_GEM_HOME"]
+ end
unless ENV["HOMEBREW_GEM_PATH"].to_s.empty?
ENV["GEM_PATH"] = ENV["HOMEBREW_GEM_PATH"]
end