Skip to content

Commit bba7ffc

Browse files
authored
Merge pull request #1017 from gromgit/check-ruby
2 parents 7e3a520 + 700c9a1 commit bba7ffc

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

install.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ MACOS_NEWEST_UNSUPPORTED="16.0"
220220
MACOS_OLDEST_SUPPORTED="13.0"
221221

222222
# For Homebrew on Linux
223-
REQUIRED_RUBY_VERSION=2.6 # https://github.com/Homebrew/brew/pull/6556
223+
REQUIRED_RUBY_VERSION=3.4 # https://github.com/Homebrew/brew/pull/19779
224224
REQUIRED_GLIBC_VERSION=2.13 # https://docs.brew.sh/Homebrew-on-Linux#requirements
225225
REQUIRED_CURL_VERSION=7.41.0 # HOMEBREW_MINIMUM_CURL_VERSION in brew.sh in Homebrew/brew
226226
REQUIRED_GIT_VERSION=2.7.0 # HOMEBREW_MINIMUM_GIT_VERSION in brew.sh in Homebrew/brew
@@ -421,8 +421,8 @@ test_ruby() {
421421
fi
422422

423423
"$1" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt -rrubygems -e \
424-
"abort if Gem::Version.new(RUBY_VERSION.to_s.dup).to_s.split('.').first(2) != \
425-
Gem::Version.new('${REQUIRED_RUBY_VERSION}').to_s.split('.').first(2)" 2>/dev/null
424+
"abort if Gem::Version.new(RUBY_VERSION) < \
425+
Gem::Version.new('${REQUIRED_RUBY_VERSION}')" 2>/dev/null
426426
}
427427

428428
test_curl() {
@@ -489,7 +489,7 @@ find_tool() {
489489
}
490490

491491
no_usable_ruby() {
492-
[[ -z "$(find_tool ruby)" ]]
492+
[[ -z "$(find_tool ruby)" ]] || ! ruby -e "require 'erb'"
493493
}
494494

495495
outdated_glibc() {
@@ -498,17 +498,22 @@ outdated_glibc() {
498498
version_lt "${glibc_version}" "${REQUIRED_GLIBC_VERSION}"
499499
}
500500

501-
if [[ -n "${HOMEBREW_ON_LINUX-}" ]] && no_usable_ruby && outdated_glibc
501+
if [[ -n "${HOMEBREW_ON_LINUX-}" ]] && no_usable_ruby
502502
then
503-
abort "$(
504-
cat <<EOABORT
503+
if outdated_glibc
504+
then
505+
abort "$(
506+
cat <<EOABORT
505507
Homebrew requires Ruby ${REQUIRED_RUBY_VERSION} which was not found on your system.
506508
Homebrew portable Ruby requires Glibc version ${REQUIRED_GLIBC_VERSION} or newer,
507509
and your Glibc version is too old. See:
508510
${tty_underline}https://docs.brew.sh/Homebrew-on-Linux#requirements${tty_reset}
509511
Please install Ruby ${REQUIRED_RUBY_VERSION} and add its location to your PATH.
510512
EOABORT
511-
)"
513+
)"
514+
else
515+
export HOMEBREW_FORCE_VENDOR_RUBY=1
516+
fi
512517
fi
513518

514519
# Invalidate sudo timestamp before exiting (if it wasn't active before).

0 commit comments

Comments
 (0)