From 0b1ec2a41483d5d554eaa9110d47067685f3dc8e Mon Sep 17 00:00:00 2001 From: Claudia Date: Tue, 8 Jan 2019 10:30:53 +0100 Subject: [PATCH 1/2] Fix deprecated Rubygems options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- Library/Homebrew/utils.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index ff69087139..8f37e830bb 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -221,7 +221,7 @@ module Homebrew return unless Gem::Specification.find_all_by_name(name, version).empty? ohai "Installing or updating '#{name}' gem" - install_args = %W[--no-ri --no-rdoc #{name}] + install_args = %W[--no-document #{name}] install_args << "--version" << version if version # Do `gem install [...]` without having to spawn a separate process or From 92cb62dace2d4e9480b2e9cac27239798dc89d95 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 8 Jan 2019 16:29:27 +0000 Subject: [PATCH 2/2] utils: fix bad parameters. --- Library/Homebrew/utils.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 93bd518043..81ce462e05 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -230,7 +230,7 @@ module Homebrew # having to find the right `gem` binary for the running Ruby interpreter. require "rubygems/commands/install_command" install_cmd = Gem::Commands::InstallCommand.new - install_cmd.handle_options("--no-document", name) + install_cmd.handle_options(["--no-document", name]) exit_code = 1 # Should not matter as `install_cmd.execute` always throws. begin install_cmd.execute