utils/ruby.sh: rename test-ruby to test_ruby. Cosmetic changes
This commit is contained in:
parent
4c49224193
commit
58f3e49c0b
@ -1,8 +1,15 @@
|
||||
test-ruby () {
|
||||
[[ ! -x $1 ]] && { echo "false"; return 1; }
|
||||
"$1" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt -rrubygems -e \
|
||||
test_ruby () {
|
||||
if [[ ! -x $1 ]]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
|
||||
local ruby_status
|
||||
ruby_status=$("$1" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt -rrubygems -e \
|
||||
"puts Gem::Version.new(RUBY_VERSION.to_s.dup).to_s.split('.').first(2) == \
|
||||
Gem::Version.new('$required_ruby_version').to_s.split('.').first(2)" 2>/dev/null
|
||||
Gem::Version.new('$required_ruby_version').to_s.split('.').first(2)" 2>/dev/null)
|
||||
|
||||
test "$ruby_status" = true
|
||||
}
|
||||
|
||||
setup-ruby-path() {
|
||||
@ -57,7 +64,7 @@ If there's no Homebrew Portable Ruby available for your processor:
|
||||
IFS=$'\n' # Do word splitting on new lines only
|
||||
for ruby_exec in $(which -a ruby) $(PATH=$HOMEBREW_PATH which -a ruby)
|
||||
do
|
||||
if [[ $(test-ruby "$ruby_exec") == "true" ]]; then
|
||||
if [[ $(test_ruby "$ruby_exec") == "true" ]]; then
|
||||
HOMEBREW_RUBY_PATH=$ruby_exec
|
||||
break
|
||||
fi
|
||||
@ -71,7 +78,7 @@ If there's no Homebrew Portable Ruby available for your processor:
|
||||
usable_ruby_version="true"
|
||||
elif [[ -n "$HOMEBREW_RUBY_PATH" && -z "$HOMEBREW_FORCE_VENDOR_RUBY" ]]
|
||||
then
|
||||
usable_ruby_version=$(test-ruby "$HOMEBREW_RUBY_PATH")
|
||||
usable_ruby_version=$(test_ruby "$HOMEBREW_RUBY_PATH")
|
||||
fi
|
||||
|
||||
if [[ -z "$HOMEBREW_RUBY_PATH" || -n "$HOMEBREW_FORCE_VENDOR_RUBY" || "$usable_ruby_version" != "true" ]]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user