508 Commits

Author SHA1 Message Date
Claudia
0b1ec2a414
Fix deprecated Rubygems options
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
2019-01-08 17:04:30 +01:00
Mike McQuaid
efc3c0c4c0
Use bundle install in more places.
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).
2019-01-08 15:08:21 +00:00
William Woodruff
b7d84f2d9e
build: Propagate entire ErrorDuringExecution
Fixes https://github.com/Homebrew/brew/issues/5427.
2018-12-23 11:26:12 -05:00
EricFromCanada
20167e5f1b Adjust comments to tidy API docs output. 2018-10-18 21:42:43 -04:00
Markus Reiter
16618d0fc7 Use ActiveSupport’s #pluralize and #to_sentence. 2018-10-07 23:10:56 +02:00
Markus Reiter
7a991985a4 Run tests with HOMEBREW_DEVELOPER unset. 2018-09-19 19:43:45 +02:00
Mike McQuaid
4d1de3334c
Merge pull request #4912 from MikeMcQuaid/activesupport-hash-deep-merge
Use ActiveSupport Hash#deep_merge
2018-09-18 09:19:24 +01:00
Mike McQuaid
0c6331878f
Use ActiveSupport Hash#deep_merge
And delete our own implementation.
2018-09-17 14:53:01 +01:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Mike McQuaid
80d75bc0d8
Homebrew/.rubocop: tweak rules.
Adjust the rules based on the current codebase. Remove various enable,
disables and default values that are unnecessary. Add more comments
explaining why. Make minor changes needed to enable a few more rules.
2018-09-02 20:15:09 +01:00
Markus Reiter
516a39f5a4 Move migrations into UpdateMigrator module. 2018-08-31 16:51:23 +02:00
Markus Reiter
e6b45842e8 Refactor odeprecated. 2018-08-15 12:16:02 +02:00
Markus Reiter
ad7be58655 Use guard clause instead of ||. 2018-07-19 16:53:11 +02:00
Markus Reiter
01b2be755c Move odebug. 2018-07-19 16:41:27 +02:00
Markus Reiter
2452b27866 Refactor ErrorDuringExecution. 2018-07-19 16:41:27 +02:00
Markus Reiter
8c620d8b97 Redirect brew cask search to brew search. 2018-06-18 16:23:35 +02:00
Markus Reiter
42db173851 Get rid of unnecessary cds. 2018-05-21 20:44:25 +02:00
Mike McQuaid
9fca172d03 Fix HOMEBREW_RUBY_WARNINGS="-w"
Fix various circular requirements, method redefinitions, etc.
2018-04-07 20:28:56 +01:00
Alexander Mancevice
57e1e16fc4 Added Homebrew.install_gem!
Useful when gem does not install with executable
2018-03-22 10:13:34 -04:00
Markus Reiter
2876aad217 Fix MethodDeprecatedError output. 2018-03-21 05:42:23 +01:00
Mike McQuaid
b23f66982f Improve external command documentation
Extract `brew bundle` and `brew services` docs from their help. Add a
little for `brew cask` until we can think about e.g. merging the
manpages.
2018-03-15 16:25:14 +00:00
Mike McQuaid
5e161252c9 utils: check for tap_message in odeprecated.
`tap` is not a method-wide variable.

Fixes #3907
2018-03-11 16:55:06 +00:00
Mike McQuaid
8860402f8f
utils: only try and replace tap or replaced methods. 2018-03-08 08:22:47 +00:00
Dominyk Tiller
8668b7108a
utils: stop suggesting fixing hard deprecations tweak 2018-03-02 07:10:31 +00:00
Dominyk Tiller
e960ccdf18
utils: stop suggesting fixing hard deprecations 2018-03-02 06:42:24 +00:00
Mike McQuaid
99dda758c4 utils: only look for gems in GEM_HOME.
This avoids issues where a gem is installed but cannot be found.

Fixes #3355.
Fixes #3760.
2018-02-09 21:09:18 +00:00
Mike McQuaid
0a12328500 utils: no .metadata deprecations.
Otherwise running on old casks can produce deprecations.

Fixes #3738.
2018-02-05 09:14:54 +00:00
Mike McQuaid
4abae7f7e9 Always install Gems into bundler location. 2018-01-26 22:05:43 +00:00
Mike McQuaid
459b113e28 utils: reduce odeprecated warnings.
Fix the code so we don't actually output `odeprecated` warnings for
`HOMEBREW_CACHE`d or `.brew`d formulae.
2018-01-24 09:02:00 +00:00
Mike McQuaid
5e5989b704 utils: no deprecations for cached formulae.
`HOMEBREW_CACHE`d and `.brew`ed formulae cannot be updated so don't
complain about their deprecation.
2018-01-21 13:34:36 +00:00
Mike McQuaid
17c24d040b utils: tell developers to submit odeprecated PRs.
Rather than just telling them to submit an issue as it's likely that
as these folks will be able to submit a PR.
2018-01-17 10:50:48 +00:00
Dominyk Tiller
6fe261bc5c
utils: stop debug exploding when zsh is used 2017-12-24 20:59:34 +00:00
Shaun Jackman
ce85e3b3b5 Remove with_system_path
The method with_system_path is no longer needed,
since environment filtering uses a default PATH.
2017-12-12 09:27:06 -08:00
Shaun Jackman
a4033c7196 Do not specify absolute paths to utilities
Specifying an absolute path to utilities is no longer needed,
since environment filtering uses a default PATH.
2017-12-12 09:25:16 -08:00
Mike McQuaid
9ebf338804 diagnostic: fix paths usage.
- Don't allow taking an argument. This doesn't work and never has as it
  caches the result regardless of the argument.
- Don't rely on the PATH to check for external commands.
2017-11-17 17:41:58 +00:00
Mike McQuaid
b369593cbd utils: correctly handle empty user gem env. 2017-11-05 14:45:36 +00:00
Mike McQuaid
ca189437e4 Tweak use of with_env
- Use it in more places where it saves code
- Allow using symbolic keys for a cleaner interface
- Use `HOMEBREW_GEM_*` instead of `GEM_OLD_*`
2017-10-29 14:44:43 +00:00
Markus Reiter
9bee9ca575 Use “squiggly” heredocs. 2017-10-18 14:39:09 +02:00
Markus Reiter
175ca909ee Clean up code style and remove .rubocop_todo.yml. 2017-10-08 16:10:37 +02:00
Markus Reiter
7cadff0a33 Use PATH where possible. 2017-09-29 22:18:24 +02:00
Dan Wendorf
acf1b278ae List cask full-names
`brew cask list` supports the `--full-name` flag which will include the tap
name for casks not part of the core caskroom/cask tap. For example, if
cask "foo-beta" is installed from the caskroom/versions cask, `brew cask
list --full-name` will report the name as "caskroom/versions/foo-beta".
2017-09-16 10:00:06 -07:00
Gautham Goli
d45ff9c0fd audit: Add a global flag to silent warning when auditing 2017-09-04 23:57:09 +05:30
Mike McQuaid
2d18ba586b Enable more deprecations.
It's been long enough that these have been commented out so let's
enable them globally.
2017-07-21 10:50:07 +01:00
Misty De Meo
610af15f0e
run_as_not_developer: use with_env helper 2017-07-15 17:40:35 -07:00
Misty De Meo
30adcab6cf
Add with_env helper to set temporary ENV vars 2017-07-15 17:39:55 -07:00
Markus Reiter
599a618273 Move require? to utils. 2017-06-14 12:51:36 +02:00
Mike McQuaid
ed9942fbd1 Merge pull request #2769 from MikeMcQuaid/rubocop-no-perl-backrefs
rubocop: don’t allow Perl regex backrefs.
2017-06-12 16:47:28 +01:00
Mike McQuaid
021cef4b2b Autocorrect Rubocop Style/SpecialGlobalVars. 2017-06-12 09:11:42 +01:00
Mike McQuaid
7a0aff1080 Autocorrect Rubocop Style/PerlBackrefs. 2017-06-10 20:23:20 +03:00
Mike McQuaid
486d3d84b1 edit: tweak default editors.
Add `atom` (not my editor of choice [TextMate for life!]) but widely
used enough to probably warrant it. Also, reorder based on my best
guestimates of current usage and cleanup the editor code while we're
here.
2017-06-07 16:07:53 +01:00