Merge pull request #9472 from maxim-belkin/simpler-unusable-ruby-logic

utils/ruby.sh: simplify and fix Ruby-related logic
This commit is contained in:
Maxim Belkin 2020-12-09 21:21:14 -06:00 committed by GitHub
commit 822988794e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,12 +28,14 @@ find_ruby() {
fi
}
unusable_ruby() {
if [[ -n "$HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH" ]]
need_vendored_ruby() {
if [[ -n "$HOMEBREW_FORCE_VENDOR_RUBY" ]]
then
return 0
elif [[ -n "$HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH" ]]
then
return 1
elif [[ -z "$HOMEBREW_MACOS" && -n "$HOMEBREW_RUBY_PATH" && -z "$HOMEBREW_FORCE_VENDOR_RUBY" ]] &&
test_ruby "$HOMEBREW_RUBY_PATH"
elif [[ -z "$HOMEBREW_MACOS" ]] && test_ruby "$HOMEBREW_RUBY_PATH"
then
return 1
else
@ -93,7 +95,7 @@ If there's no Homebrew Portable Ruby available for your processor:
fi
else
HOMEBREW_RUBY_PATH=$(find_ruby)
if [[ -z "$HOMEBREW_RUBY_PATH" || -n "$HOMEBREW_FORCE_VENDOR_RUBY" ]] || unusable_ruby
if need_vendored_ruby
then
brew vendor-install ruby || odie "$install_fail"
HOMEBREW_RUBY_PATH="$vendor_ruby_path"