We don’t really have a better solution than this because of how the auto-updater’s Bash code worked on the version they are updating from. Users will never hit this more than once.
Fixes#5513
In February 2013, Rubygems 2.0.0 deprecated [1] the `--[no-]ri` and `--[no-]rdoc` options, replacing them with the new `--[no-]document` option.
Almost five years later, Rubygems finally dropped support [2] for the long-deprecated `--[no-]ri` and `--[no-]rdoc` options.
This removal causes `bundle install` to **fail for fresh Homebrew checkouts** if Rubygems 3.0.x or newer is installed, which will happen if the user runs `gem update --system` on Ruby 2.3.0 or later. [3]
This also affects the system Ruby built into macOS 10.13 and 10.14.
Steps to reproduce:
```
$ sudo /usr/bin/gem update -N --system
[…]
Installing RubyGems 3.0.2
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem
$ gem --version 2>/dev/null
3.0.2
$ cd "$(mktemp -d)"
$ git clone --depth=1 https://github.com/Homebrew/brew.git
[…]
$ cd brew
$ export HOMEBREW_PATH=bin # in case shellcheck is not installed
$ bin/brew style Library/Homebrew/extend/ENV/std.rb
==> Installing or updating 'rubocop' gem
Error: invalid option: --no-ri
```
(Note: The above steps will not touch an existing Homebrew installation, and won’t even require Homebrew to be installed.)
This commit replaces the deprecated options with the new `--no-document` option, which has been around since Rubygems 2.0.0. It is therefore safe for use on all supported platforms.
[1]: https://blog.rubygems.org/2013/02/24/2.0.0-released.html
[2]: https://github.com/rubygems/rubygems/pull/2354
[3]: https://rubygems.org/gems/rubygems-update/versions
This provides a more consistent version for `rubocop` than relying on
`Homebrew.install_gem_setup_path!` (and we really want `brew style` to
provide consistent output).
Some SDKs return a number higher than the hard-coded `latest_version`
in this file. With the current `==` check, those higher version numbers
are treated as "not the latest". This prevents machines with
higher-versioned SDKs from being able to use Homebrew.
To resolve that problem, this PR changes the check to `>=`, which allows
machines with higher-versioned SDKs to also use Homebrew to install
packages.
In `extend/ENV/std.rb`, the methods `set_cpu_flags` and
`set_cpu_cflags` have been violating the `Naming/AccessorMethodName`
cop.
A recent modification in #7e13b3749 woke up the cop. That means we’re
likely dealing with legacy code here, predating the introduction of
RuboCop into Homebrew.
This commit disables the cop for either method. I believe refactoring
wouldn’t currently be worth the effort, especially given that
`#set_cpu_cflags` is mostly called without arguments.
This reduces the deviation in compilation flags on a given OS between
users and between bottling/not bottling to provide a consistent
behaviour for debugging and support.
Symlink 2.3.0 to 2.4.0, 2.5.0, and 2.6.0.
When using Ruby 2.4 or newer, fix the error:
/usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require':
cannot load such file -- active_support/core_ext/object/blank (LoadError)