utils/ruby.sh: don't _require_ 3.1 in HOMEBREW_RUBY3 mode

This commit is contained in:
Bo Anderson 2023-11-21 15:03:22 +00:00
parent 559336c771
commit 7a9f3eb800
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65

View File

@ -10,16 +10,24 @@ test_ruby() {
return 1
fi
supported_ruby_versions=()
if [[ -n "${HOMEBREW_RUBY3}" && -z "${HOMEBREW_USE_RUBY_FROM_PATH}" ]]
then
required_ruby_version="3.1.0"
else
required_ruby_version="${HOMEBREW_REQUIRED_RUBY_VERSION}"
supported_ruby_versions+=("3.1.0")
fi
supported_ruby_versions+=("${HOMEBREW_REQUIRED_RUBY_VERSION}")
"$1" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt \
"${HOMEBREW_LIBRARY}/Homebrew/utils/ruby_check_version_script.rb" \
"${required_ruby_version}" 2>/dev/null
for ruby_version in "${supported_ruby_versions[@]}"
do
if "$1" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt \
"${HOMEBREW_LIBRARY}/Homebrew/utils/ruby_check_version_script.rb" \
"${ruby_version}" 2>/dev/null
then
return 0
fi
done
return 1
}
can_use_ruby_from_path() {