488 Commits

Author SHA1 Message Date
Mike McQuaid
aa81982aba
brew style --fix 2020-06-02 09:49:23 +01:00
Mike McQuaid
bc27e38f18
Remove ARGV.debug?
Replace with `Homebrew.args.debug?`.

Part of #5730.
2020-05-23 14:38:58 +01:00
Mike McQuaid
e33dc9e916
utils: brew style --fix. 2020-05-21 10:15:34 +01:00
Mike McQuaid
3381cbf5c7
Use Homebrew::EnvConfig. 2020-04-07 09:58:26 +01:00
Mike McQuaid
b5165ed7e8
Clarify tap issues should not be reported to Homebrew.
Instead, direct people to the actual tap.
2020-03-11 10:57:36 +00:00
Mike McQuaid
eb87651341
Revert "Revert "help: print cli/parser help message if used"" 2020-02-02 16:36:59 +01:00
Gautham Goli
acde828a45 ARGV: Replace ARGV.verbose? with Homebrew.args.verbose? 2020-02-02 14:00:04 +01:00
Mike McQuaid
f3afedb4ff
utils#system: improve verbose output.
This previously output the hilarious long and unnecessary LOAD_PATH.
2019-11-06 15:25:51 +00:00
Issy Long
341ea60807
Auto-fix Style/RedundantBegin offenses
- This also required auto-fixes for Layout/EmptyLinesAroundBlockBody and
  Layout/InconsistentIndentation once the auto-fixer had got rid of the
  "redundant begin"s.
2019-10-13 16:04:27 +01:00
Markus Reiter
b1d0c61fea Update Gems. 2019-10-03 09:22:44 +02:00
Markus Reiter
e5899a6101 Move global methods into Kernel module.
Otherwise they are not defined inside of subclasses of `DelegateClass`.
2019-08-15 16:39:55 +02:00
Mike McQuaid
c5c59149c4
utils: make redact_secrets handle nil secrets.
Fixes #6363.
2019-08-13 08:15:24 +01:00
Cheng XU
9232ca4508
system_command: allow redacting secrets in the log
Add a new argument `secrets` to specify secret tokens, so we can redact them in the log.
2019-07-18 15:06:32 +08:00
Mike McQuaid
6325db9e37
utils: fix frozen string usage in odeprecated.
Fixes https://github.com/Homebrew/brew/issues/6053
2019-04-23 22:32:11 -07:00
Mike McQuaid
fc6bd2ea1c
Fixup more frozen string handling. 2019-04-20 14:07:29 +09:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
86f43f79ee
Enable/fix optional Ruby frozen string literal usage
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.
2019-04-19 10:30:41 +09:00
Markus Reiter
75aa369102 Fix support for HOMEBREW_EDITOR with args. 2019-04-03 23:49:37 +02:00
Mike McQuaid
70b93f65ea
*cmd/*: use *system instead of exec for easier testing.
This improves both test coverage, makes it easier to use a profiler and
a debugger.
2019-03-27 21:15:24 +00:00
Zach Auten
dd4daa247f Merge branch 'master' of https://github.com/Homebrew/brew into brew-info-display-casks 2019-03-06 17:56:22 -05:00
Mike McQuaid
4f76d12874
utils/gems: extract from utils.
Also, don’t use any non-standard Ruby functionality to avoid needing any `requires.
2019-02-21 12:56:22 +00:00
Mike McQuaid
d64429a736
rubocop: enable Style/IfUnlessModifier. 2019-02-21 12:55:49 +00:00
Zach Auten
554106d2e0 Updated missing formula cask reason
- search_for_cask in missing_formula renamed to is_a_cask_reason
    - is_a_cask calls new getInfo method in cask/cmd/info.rb to return info
      string
    - self.info in info.rb now calls getInfo and puts return value
    - added ohai_title to return the ohai printout for only titles, so that
      ohai printout could be added to the getInfo return string without
      calling puts.
    - refactored ohai to use ohai_title
    - updated info_spec.rb cask info test to be more specific when
      matching stderr.
    - is_a_cask_reason will respect 'silent'
    - refactored print_caveats to return instead of print
2019-02-18 03:33:57 -05:00
Mike Miller
6819cbf967 Set DISPLAY from HOMEBREW_DISPLAY unconditionally
No need to test for existence, ruby ENV does the right thing.
2019-02-12 11:42:17 -08:00
Mike Miller
ae1e4e7022 Set DISPLAY environment variable for browser on Linux
Fixes #5692
2019-02-10 23:30:54 -08:00
Mike McQuaid
8bfde013f6
utils: fix SVN remote test on Mojave.
For some reason Mojave needs the SSL args always set otherwise this
will always fail waiting for interactivity.

Also, while debugging this I noticed that `utils.rb` had a failure
expecting an integer so fix that too.
2019-01-22 14:20:24 +00:00
Mike McQuaid
a75f979eec
utils: re-add install_gem! version argument.
This is needed for `compat/download_strategy` for now.
2019-01-17 09:29:21 +00:00
Mike McQuaid
a7d72351cf
utils: don't look for bundler executable.
This exists sometimes and not others it seems.
2019-01-08 20:33:39 +00:00
Mike McQuaid
92cb62dace
utils: fix bad parameters. 2019-01-08 16:29:27 +00:00
Mike McQuaid
bf6cd48994
Merge branch 'master' into fix-deprecated-gem-options 2019-01-08 16:24:24 +00:00
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