Skip to content

Commit

Permalink
utils/ruby.sh: don't _require_ 3.1 in HOMEBREW_RUBY3 mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo98 committed Nov 21, 2023
1 parent 559336c commit 7a9f3eb
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions Library/Homebrew/utils/ruby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 7a9f3eb

Please sign in to comment.