From 5d3456f4856b3aa2606afd5fe3050293d6732c6b Mon Sep 17 00:00:00 2001 From: Maxim Belkin Date: Thu, 21 May 2020 17:15:14 -0500 Subject: [PATCH] utils/ruby.sh: make code more readable 1. Repurpose 'vendor_ruby_current_version' variable: now this is not a pointer to a file but actual version number 2. Introduce 'vendor_ruby_latest_version' variable: it holds the value of the latest version of portable Ruby --- Library/Homebrew/utils/ruby.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/utils/ruby.sh b/Library/Homebrew/utils/ruby.sh index 4be204309a..1792359767 100644 --- a/Library/Homebrew/utils/ruby.sh +++ b/Library/Homebrew/utils/ruby.sh @@ -7,8 +7,9 @@ test-ruby () { setup-ruby-path() { local vendor_dir - local vendor_ruby_current_version local vendor_ruby_path + local vendor_ruby_latest_version + local vendor_ruby_current_version local usable_ruby_version # When bumping check if HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH (in brew.sh) # also needs to be changed. @@ -22,8 +23,9 @@ If there's no Homebrew Portable Ruby available for your processor: " vendor_dir="$HOMEBREW_LIBRARY/Homebrew/vendor" - vendor_ruby_current_version="$vendor_dir/portable-ruby/current" - vendor_ruby_path="$vendor_ruby_current_version/bin/ruby" + vendor_ruby_path="$vendor_dir/portable-ruby/current/bin/ruby" + vendor_ruby_latest_version=$(<"$vendor_dir/portable-ruby-version") + vendor_ruby_current_version=$(readlink "$vendor_dir/portable-ruby/current") unset HOMEBREW_RUBY_PATH @@ -35,8 +37,7 @@ If there's no Homebrew Portable Ruby available for your processor: if [[ -x "$vendor_ruby_path" ]] then HOMEBREW_RUBY_PATH="$vendor_ruby_path" - - if [[ $(readlink "$vendor_ruby_current_version") != "$(<"$vendor_dir/portable-ruby-version")" ]] + if [[ $vendor_ruby_current_version != $vendor_ruby_latest_version ]] then if ! brew vendor-install ruby then