aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2018-01-26 16:59:35 +0000
committerMike McQuaid2018-01-26 21:47:33 +0000
commit78933b3ee91a9bfd71128bd7e7e46b9af9ef30e2 (patch)
tree9a400d3a660345980af7a60b23b5dd76ca513125
parent65e940f833ef90b9111055f8772f601ad3b53b8c (diff)
downloadbrew-78933b3ee91a9bfd71128bd7e7e46b9af9ef30e2.tar.bz2
ruby.sh: fix version check.
- Rather than checking for the absence of a failure check for an actual success in the check - Fix the check to work on Ruby 1.9 (where `RUBY_VERSION.to_s.dup` is required to avoid modifying a frozen string).
-rw-r--r--Library/Homebrew/utils/ruby.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/Library/Homebrew/utils/ruby.sh b/Library/Homebrew/utils/ruby.sh
index b16531e9f..2fb780c65 100644
--- a/Library/Homebrew/utils/ruby.sh
+++ b/Library/Homebrew/utils/ruby.sh
@@ -2,7 +2,7 @@ setup-ruby-path() {
local vendor_dir
local vendor_ruby_current_version
local vendor_ruby_path
- local ruby_old_version
+ local ruby_version_new_enough
local minimum_ruby_version="2.3.3"
vendor_dir="$HOMEBREW_LIBRARY/Homebrew/vendor"
@@ -35,12 +35,12 @@ setup-ruby-path() {
HOMEBREW_RUBY_PATH="$(which ruby)"
fi
- if [[ -n "$HOMEBREW_RUBY_PATH" ]]
+ if [[ -n "$HOMEBREW_RUBY_PATH" && -z "$HOMEBREW_FORCE_VENDOR_RUBY" ]]
then
- ruby_old_version="$("$HOMEBREW_RUBY_PATH" -rrubygems -e "puts Gem::Version.new('$minimum_ruby_version') > Gem::Version.new(RUBY_VERSION)")"
+ ruby_version_new_enough="$("$HOMEBREW_RUBY_PATH" -rrubygems -e "puts Gem::Version.new(RUBY_VERSION.to_s.dup) >= Gem::Version.new('$minimum_ruby_version')")"
fi
- if [[ -z "$HOMEBREW_RUBY_PATH" || "$ruby_old_version" == "true" || -n "$HOMEBREW_FORCE_VENDOR_RUBY" ]]
+ if [[ -z "$HOMEBREW_RUBY_PATH" || -n "$HOMEBREW_FORCE_VENDOR_RUBY" || "$ruby_version_new_enough" != "true" ]]
then
brew vendor-install ruby
if [[ ! -x "$vendor_ruby_path" ]]