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
Exit from the 'setup-ruby' function when user issued
`vendor-install` command.
We do so instead of wrapping everything in
```sh
if [[ "$HOMEBREW_COMMAND" != "vendor-install" ]]
```
`git diff` when whitespaces are ignored:
$ git diff -w
diff --git a/Library/Homebrew/utils/ruby.sh b/Library/Homebrew/utils/ruby.sh
index 7974e909c..4be204309 100644
--- a/Library/Homebrew/utils/ruby.sh
+++ b/Library/Homebrew/utils/ruby.sh
@@ -27,8 +27,11 @@ If there's no Homebrew Portable Ruby available for your processor:
unset HOMEBREW_RUBY_PATH
- if [[ "$HOMEBREW_COMMAND" != "vendor-install" ]]
+ if [[ "$HOMEBREW_COMMAND" == "vendor-install" ]]
then
+ return 0
+ fi
+
if [[ -x "$vendor_ruby_path" ]]
then
HOMEBREW_RUBY_PATH="$vendor_ruby_path"
@@ -85,7 +88,6 @@ If there's no Homebrew Portable Ruby available for your processor:
HOMEBREW_RUBY_PATH="$vendor_ruby_path"
fi
fi
- fi
export HOMEBREW_RUBY_PATH
}
As-of https://github.com/Homebrew/homebrew-portable-ruby/pull/100 we've
removed ARM builds for Portable Ruby due to months of breakage.
Similarly, when we last bumped Portable Ruby the ARM build was much
delayed but, despite Homebrew/brew being completely unusable to anyone
using it on ARM in that case, no-one complained or filed issues.
Instead of attempting to maintain and update a Portable Ruby on niche
(Homebrew) platforms like ARM (or, in past/future PPC) improve the
messaging to provide users with a workaround.
Now we allow only a major/minor version match it should be pretty
doable for those users to install e.g. a prebuilt Ruby binary from a PPA
or built it from source if needed using `ruby-build` and `rbenv`.
The messaging could be improved further but we're somewhat limited by
`ruby.sh` and `vendor-install.sh` being separate. I'm tempted to combine
them (or at least have `vendor-install.sh` not be so generic as to not
be able to give Ruby-specific advice).
Combined with https://github.com/Homebrew/homebrew-test-bot/pull/247
this will test Homebrew's use of frozen strings in CI. After this we
will then enable it for Homebrew developers and eventually all Homebrew
users.
When the DBM database cannot be read by the current version of Ruby's
DBM library (due to corruption or another incompatibility) it segfaults
or freezes which takes down the entire Homebrew Ruby process.
This isn't desirable so instead perform a shell out with the Homebrew
Ruby to see if it can read the DBM database before we try to use the
information. If this hangs or crashes: silently delete the database and
recreate it.
This avoids `brew style` and friends from getting upset when they
attempt to use the native gem extensions from a previous portable Ruby
or a system Ruby.
ABI? What's that?
- 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).
Not quite a mass replacement as I've used OS X and Mac OS X where
describing specific older versions and added compatibility methods
for things in the DSL.