utils/ruby.sh: move 'advice' var to Linux.
Also change 'usable_ruby()' to 'unusable_ruby()' Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
parent
50f47e88ec
commit
cfbc09f3c1
@ -26,15 +26,15 @@ find_ruby() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
usable_ruby() {
|
unusable_ruby() {
|
||||||
if [[ -n "$HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH" ]]
|
if [[ -n "$HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH" ]]
|
||||||
then
|
then
|
||||||
return 0
|
return 1
|
||||||
elif [[ -n "$HOMEBREW_RUBY_PATH" && -z "$HOMEBREW_FORCE_VENDOR_RUBY" ]] && test_ruby "$HOMEBREW_RUBY_PATH"
|
elif [[ -n "$HOMEBREW_RUBY_PATH" && -z "$HOMEBREW_FORCE_VENDOR_RUBY" ]] && test_ruby "$HOMEBREW_RUBY_PATH"
|
||||||
then
|
then
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
return 1
|
||||||
|
else
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,19 +49,20 @@ setup-ruby-path() {
|
|||||||
# also needs to be changed.
|
# also needs to be changed.
|
||||||
local required_ruby_version="2.6"
|
local required_ruby_version="2.6"
|
||||||
local ruby_exec
|
local ruby_exec
|
||||||
|
local upgrade_fail
|
||||||
|
local install_fail
|
||||||
|
|
||||||
|
if [[ -n $HOMEBREW_MACOS ]]
|
||||||
|
then
|
||||||
|
upgrade_fail="Failed to upgrade Homebrew Portable Ruby!"
|
||||||
|
install_fail="Failed to install Homebrew Portable Ruby (and your system version is too old)!"
|
||||||
|
else
|
||||||
local advice="
|
local advice="
|
||||||
If there's no Homebrew Portable Ruby available for your processor:
|
If there's no Homebrew Portable Ruby available for your processor:
|
||||||
- install Ruby $required_ruby_version with your system package manager (or rbenv/ruby-build)
|
- install Ruby $required_ruby_version with your system package manager (or rbenv/ruby-build)
|
||||||
- make it first in your PATH
|
- make it first in your PATH
|
||||||
- try again
|
- try again
|
||||||
"
|
"
|
||||||
local upgrade_fail
|
|
||||||
local install_fail
|
|
||||||
if [[ -n $HOMEBREW_MACOS ]]
|
|
||||||
then
|
|
||||||
upgrade_fail="Failed to upgrade Homebrew Portable Ruby!"
|
|
||||||
install_fail="Failed to install Homebrew Portable Ruby (and your system version is too old)!"
|
|
||||||
else
|
|
||||||
upgrade_fail="Failed to upgrade Homebrew Portable Ruby!$advice"
|
upgrade_fail="Failed to upgrade Homebrew Portable Ruby!$advice"
|
||||||
install_fail="Failed to install Homebrew Portable Ruby and cannot find another Ruby $required_ruby_version!$advice"
|
install_fail="Failed to install Homebrew Portable Ruby and cannot find another Ruby $required_ruby_version!$advice"
|
||||||
fi
|
fi
|
||||||
@ -75,7 +76,10 @@ If there's no Homebrew Portable Ruby available for your processor:
|
|||||||
|
|
||||||
unset HOMEBREW_RUBY_PATH
|
unset HOMEBREW_RUBY_PATH
|
||||||
|
|
||||||
[[ "$HOMEBREW_COMMAND" == "vendor-install" ]] && return 0
|
if [[ "$HOMEBREW_COMMAND" == "vendor-install" ]]
|
||||||
|
then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -x "$vendor_ruby_path" ]]
|
if [[ -x "$vendor_ruby_path" ]]
|
||||||
then
|
then
|
||||||
@ -87,8 +91,7 @@ If there's no Homebrew Portable Ruby available for your processor:
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
HOMEBREW_RUBY_PATH=$(find_ruby)
|
HOMEBREW_RUBY_PATH=$(find_ruby)
|
||||||
|
if [[ -z "$HOMEBREW_RUBY_PATH" || -n "$HOMEBREW_FORCE_VENDOR_RUBY" ]] || unusable_ruby
|
||||||
if [[ -z "$HOMEBREW_RUBY_PATH" || -n "$HOMEBREW_FORCE_VENDOR_RUBY" ]] || ! usable_ruby
|
|
||||||
then
|
then
|
||||||
brew vendor-install ruby || odie "$install_fail"
|
brew vendor-install ruby || odie "$install_fail"
|
||||||
HOMEBREW_RUBY_PATH="$vendor_ruby_path"
|
HOMEBREW_RUBY_PATH="$vendor_ruby_path"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user