Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove existing from PATH when adding Gem.bindir. #2580

Merged
merged 1 commit into from
May 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions Library/Homebrew/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,11 @@ def install_gem_setup_path!(name, version = nil, executable = name)
Gem.clear_paths
Gem::Specification.reset

# Create GEM_HOME which may not exist yet so it exists when creating PATH.
FileUtils.mkdir_p Gem.bindir

# Add Gem binary directory and (if missing) Ruby binary directory to PATH.
path = PATH.new(ENV["PATH"])
path.prepend(RUBY_BIN) if which("ruby") != RUBY_PATH
path.prepend(Gem.bindir)
ENV["PATH"] = path.existing
ENV["PATH"] = path

if Gem::Specification.find_all_by_name(name, version).empty?
ohai "Installing or updating '#{name}' gem"
Expand Down