From 027cc685348b65b601b45898dbce8ad171579dde Mon Sep 17 00:00:00 2001 From: emreerhan Date: Thu, 30 Jan 2020 15:01:26 -0800 Subject: [PATCH] Add condition to check if ruby version is < 2.7 --- Library/Homebrew/utils/ruby.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/ruby.sh b/Library/Homebrew/utils/ruby.sh index 822ddd2789..266ec2c877 100644 --- a/Library/Homebrew/utils/ruby.sh +++ b/Library/Homebrew/utils/ruby.sh @@ -6,6 +6,7 @@ setup-ruby-path() { # When bumping check if HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH (in brew.sh) # also needs to be changed. local minimum_ruby_version="2.6.3" + local maximum_ruby_version="2.7.0" vendor_dir="$HOMEBREW_LIBRARY/Homebrew/vendor" vendor_ruby_current_version="$vendor_dir/portable-ruby/current" @@ -45,7 +46,15 @@ setup-ruby-path() { ruby_version_new_enough="$("$HOMEBREW_RUBY_PATH" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt -rrubygems -e "puts Gem::Version.new(RUBY_VERSION.to_s.dup) >= Gem::Version.new('$minimum_ruby_version')")" fi - if [[ -z "$HOMEBREW_RUBY_PATH" || -n "$HOMEBREW_FORCE_VENDOR_RUBY" || "$ruby_version_new_enough" != "true" ]] + if [[ -n"$HOMEBREW_MACOS_SYSTEM_RUBY_OLD_ENOUGH" ]] + then + ruby_version_old_enough="true" + elif [[ -n "$HOMEBREW_RUBY_PATH" && -z "$HOMEBREW_FORCE_VENDOR_RUBY" ]] + then + ruby_version_old_enough="$("$HOMEBREW_RUBY_PATH" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt -rrubygems -e "puts Gem::Version.new(RUBY_VERSION.to_s.dup) < Gem::Version.new('$maximum_ruby_version')")" + fi + + if [[ -z "$HOMEBREW_RUBY_PATH" || -n "$HOMEBREW_FORCE_VENDOR_RUBY" || "$ruby_version_new_enough" != "true" || "$ruby_version_old_enough" != "true" ]] then brew vendor-install ruby if [[ ! -x "$vendor_ruby_path" ]]