utils/ruby.sh: unset HOMEBREW_RUBY_PATH unconditionally

This commit is contained in:
Maxim Belkin 2020-05-15 14:21:51 -05:00
parent d21ecffae6
commit ec6e449f4f
No known key found for this signature in database
GPG Key ID: AC71560D4C5F2338

View File

@ -14,6 +14,12 @@ setup-ruby-path() {
local required_ruby_version="2.6" local required_ruby_version="2.6"
local old_ruby_path local old_ruby_path
local old_ruby_usable local old_ruby_usable
local advice="
If there's no Homebrew Portable Ruby available for your processor:
- install Ruby $required_ruby_version with your system package manager (or rbenv/ruby-build)
- make it first in your PATH
- try again
"
vendor_dir="$HOMEBREW_LIBRARY/Homebrew/vendor" vendor_dir="$HOMEBREW_LIBRARY/Homebrew/vendor"
vendor_ruby_current_version="$vendor_dir/portable-ruby/current" vendor_ruby_current_version="$vendor_dir/portable-ruby/current"
@ -25,12 +31,9 @@ setup-ruby-path() {
old_ruby_usable=$(test-ruby "$HOMEBREW_RUBY_PATH") old_ruby_usable=$(test-ruby "$HOMEBREW_RUBY_PATH")
fi fi
if [[ -z "$HOMEBREW_DEVELOPER" ]]
then
unset HOMEBREW_RUBY_PATH unset HOMEBREW_RUBY_PATH
fi
if [[ -z "$HOMEBREW_RUBY_PATH" && "$HOMEBREW_COMMAND" != "vendor-install" ]] if [[ "$HOMEBREW_COMMAND" != "vendor-install" ]]
then then
if [[ -x "$vendor_ruby_path" ]] if [[ -x "$vendor_ruby_path" ]]
then then
@ -44,13 +47,7 @@ setup-ruby-path() {
then then
odie "Failed to upgrade Homebrew Portable Ruby!" odie "Failed to upgrade Homebrew Portable Ruby!"
else else
odie <<-EOS odie "Failed to upgrade Homebrew Portable Ruby!$advice"
Failed to upgrade Homebrew Portable Ruby!
If there's no Homebrew Portable Ruby available for your processor:
- install Ruby $required_ruby_version with your system package manager (or rbenv/ruby-build)
- make it first in your PATH
- try again
EOS
fi fi
fi fi
fi fi
@ -67,13 +64,7 @@ EOS
then then
if [[ $old_ruby_usable != true ]] if [[ $old_ruby_usable != true ]]
then then
odie <<-EOS odie "Failed to find usable Ruby $required_ruby_version!$advice"
Failed to find usable Ruby $required_ruby_version!
If there's no Homebrew Portable Ruby available for your processor:
- install $required_ruby_version with your system package manager (or rbenv/ruby-build)
- make it first in your PATH
- try again
EOS
else else
HOMEBREW_RUBY_PATH="$old_ruby_path" HOMEBREW_RUBY_PATH="$old_ruby_path"
fi fi
@ -98,13 +89,7 @@ EOS
then then
odie "Failed to install Homebrew Portable Ruby (and your system version is too old)!" odie "Failed to install Homebrew Portable Ruby (and your system version is too old)!"
else else
odie <<-EOS odie "Failed to install Homebrew Portable Ruby and cannot find another Ruby $required_ruby_version!$advice"
Failed to install Homebrew Portable Ruby and cannot find another Ruby $required_ruby_version!
If there's no Homebrew Portable Ruby available for your processor:
- install $required_ruby_version with your system package manager (or rbenv/ruby-build)
- make it first in your PATH
- try again
EOS
fi fi
fi fi
HOMEBREW_RUBY_PATH="$vendor_ruby_path" HOMEBREW_RUBY_PATH="$vendor_ruby_path"