218 Commits
Author SHA1 Message Date
Mike McQuaid 94148c3bc8 Fix handling unreadable casks
When casks are unreadable (e.g. have invalid syntax, the cask file
cannot be found) then it's not been possible to uninstall them, list
them or perform any operation which iterates through all casks.

Handle these various cases by falling back to creating a `Cask::Cask`
object using just the name/token and latest installed version on disk.

This provides enough functionality to be able to verbosely list these
casks, not error on listing and, most importantly, uninstall/reinstall
them.

Fixes https://github.com/Homebrew/homebrew-cask/issues/62223
2022-05-16 17:27:13 -04:00
xxyzz 1b877273d8 Don't print Cask installed error message when --quiet is used 2022-05-11 11:03:20 +08:00
Issy Long 0b6b2f04da cask/reinstall: Support --zap for entirely purging cask files
- The `brew uninstall` command has `--zap`, so let's make `brew
  reinstall` have parity here for a better user experience. (Requested
  in issue 12983.)
- It feels weird that to get my new reinstall test to pass I had to add
  `--zap` to `cask/cmd/install.rb`, not `cask/cmd/reinstall.rb` to get
  the tests to pass. But the `brew reinstall --cask caffeine --zap`
  command worked fine all the time. The CLI argument parser from the
  test run was complaining about not knowing what `zap` was. As a
  result, `--zap` now shows up as a switch in `brew install --help`
  which I'm not 100% convinced is the desired UX. But I've edited the
  description accordingly to specify that it will only work on
  `reinstall` operations (and `--zap` on `install` is a no-op).

```
issyl0 at pictor in /opt/homebrew on reinstall-cask-zap
❯ brew reinstall --cask caffeine --zap
==> Downloading https://github.com/IntelliScape/caffeine/releases/download/1.1.3/Caffeine.dmg
Already downloaded: /Users/issyl0/Library/Caches/Homebrew/downloads/3d6ccfdd3b8d0ab37d1c2468d6e69078c2d31d3b12bf51947c4db21e5f376af2--Caffeine.dmg
==> Implied `brew uninstall --cask caffeine`
==> Backing App 'Caffeine.app' up to '/opt/homebrew/Caskroom/caffeine/1.1.3/Caffeine.app'
==> Removing App '/Applications/Caffeine.app'
==> Dispatching zap stanza
==> Trashing files:
~/Library/Application Support/com.intelliscapesolutions.caffeine
~/Library/Preferences/com.intelliscapesolutions.caffeine.plist
~/Library/Caches/com.intelliscapesolutions.caffeine
~/Library/HTTPStoages/com.intelliscapesolutions.caffeine.binarycookies
==> Removing all staged versions of Cask 'caffeine'
==> Installing Cask caffeine
==> Moving App 'Caffeine.app' to '/Applications/Caffeine.app'
🍺  caffeine was successfully installed!
```
2022-04-09 16:37:23 +01:00
Rylan Polster 2e6b6ab3a2 Fix style 2021-12-24 21:15:21 -05:00
fn ⌃ ⌥ 8dc060c88b upgrade: use greedy_* method parameters 2021-09-21 11:45:49 -07:00
hyuraku e44ac800c2 repair cask install quiet mode 2021-09-10 23:12:52 +09:00
FnControlOption eb16e10902 messages: record cask installations.
This is used to record installation times and also to determine
whether to display caveats.
2021-09-02 08:44:00 -07:00
FnControlOption 278c06f31d upgrade: deduplicate cask caveats.
Cask::Installer.caveats invokes Homebrew.messages.record_caveats
so only invoke it once and store the return value.
2021-09-02 08:43:56 -07:00
EricFromCanada c234d1ea03 upgrade: list upgradeable dependencies/migrations/cleanups on dry run 2021-08-31 12:27:14 -04:00
Bevan Kay 88edb1c64b fix style 2021-07-04 17:25:03 +10:00
Bevan Kay 9cf0a7409b fix style 2021-07-03 11:58:16 +10:00
Bevan Kay 507fba73c4 update command line outputs 2021-07-03 11:57:32 +10:00
Bevan Kay 85082066f2 fix style 2021-07-01 23:02:15 +10:00
Bevan Kay b1c70160f3 Split into two flags --greedy-latest and --greedy-auto-updates 2021-07-01 23:01:22 +10:00
Bevan Kay 72e3704827 update style 2021-06-30 11:21:24 +10:00
Bevan Kay 057b3a3502 adds an option to skip unversioned casks in outdated and upgrade command 2021-06-30 11:13:21 +10:00
Nanda H Krishna 47a549e944 Fix style using brew style --fix 2021-06-02 11:43:16 +05:30
hyuraku 45b7e438f1 repair manual_installer_casks block 2021-05-15 21:24:24 +09:00
hyuraku 5f62f417fd add error message that cask was installed manually 2021-05-14 12:56:57 +09:00
hyuraku bc476a31b4 remove manual installer casks from upgrage casks 2021-05-12 23:46:50 +09:00
Mike McQuaid 6f071a06f8 Use JSON.pretty_generate
It's dramatically more human readable for very little difference in
space.
2021-04-09 15:44:37 +01:00
Markus Reiter 72a79d934e Fix audit annotations for casks. 2021-04-03 04:27:32 +02:00
Rylan Polster 2b8d19e0bd audit: limit non-failure cask output 2021-03-22 22:16:54 -04:00
Bo Anderson 32d532fb49 cmd/list: fix Cask listing 2021-03-22 16:21:02 +00:00
Bo Anderson 8e98ce69f3 Stricter handling of CLI args 2021-03-18 16:41:57 +00:00
Mike McQuaid d6957a3acb Homebrew 3.0.0 deprecations/disables 2021-01-29 19:50:24 +00:00
EricFromCanada 6fc116318e fixes for grammar and wording 2021-01-26 16:19:47 -05:00
EricFromCanada 99ad3350ee use single quotes around stanza and parameter names 2021-01-26 16:19:47 -05:00
EricFromCanada a427de5bee capitalization fixes
"curl" is the binary, while "cURL" is the umbrella project.
2021-01-26 15:36:44 -05:00
EricFromCanada d0ad829e43 use arrow character for UI prompts 2021-01-26 15:36:43 -05:00
Seeker fbafaff4fe rubocop: require braces for Sorbet sig 2021-01-18 16:52:45 -08:00
Seeker f476bcafcb upgrade: show formula caveats after casks have been updated 2021-01-11 11:43:11 -08:00
Seeker b9854bd4cf rubocops: add unless_multiple_conditions 2021-01-08 10:33:54 -08:00
Mike McQuaid d8a5e467e8 audit: quieten down and make casks audit consistent with formulae.
The current casks audit is very noisy in the no-op case (i.e. no errors)
https://github.com/Homebrew/brew/pull/10234/checks?check_run_id=1655630568#step:15:7

This means when there are errors and you're querying all casks it's
pretty hard to quickly identify the problems.

This commit silences the `passing`, `warning` and header/summary output
when you're querying all casks (rather than a specific cask or tap).

This is more consistent with `brew audit` for formulae which is silent
unless there are audit failures.
2021-01-07 13:31:14 +00:00
Mike McQuaid 9216d8abe6 rubocop-rails: make fixes. 2020-12-02 10:43:04 +00:00
Markus Reiter 6750448d95 Fix some auto-correctable type errors. 2020-11-29 21:23:54 +01:00
Markus Reiter 5be4c9b5e0 Upgrade typed sigils. 2020-11-25 17:04:19 +01:00
Markus Reiter 3c2ec1c60f Deprecate remaining cask commands. 2020-11-21 19:56:12 +01:00
Markus ReiterandGitHub 7dd7d69cd8 Merge pull request #9207 from reitermarkus/brew-zap
Add `--zap` flag for `brew uninstall`.
2020-11-20 09:42:13 +01:00
Markus Reiter 7a83f34dd1 Support casks in brew fetch. 2020-11-19 19:46:59 +01:00
Markus Reiter f4b4fdac98 Add brew zap command. 2020-11-19 13:42:02 +01:00
Markus Reiter 24cef5c2ce Support casks in brew audit. 2020-11-18 13:21:49 +01:00
Markus Reiter e54e719e38 Add Cask::Cmd::Audit.audit_casks method. 2020-11-18 10:25:32 +01:00
Markus Reiter 0184e271d8 Fix RuboCop offenses. 2020-11-17 11:09:55 +01:00
Markus ReiterandGitHub 9f458142b7 Merge pull request #9146 from reitermarkus/upgrade
Mention `--greedy` when no casks were upgraded.
2020-11-16 22:03:10 +01:00
Markus Reiter 3ee66d8c0d Add type annotations related to upgrade. 2020-11-16 19:45:15 +01:00
EricFromCanada f784b7107f manpage: fixes for grammar 2020-11-16 07:56:50 -05:00
Markus Reiter 7893d316ab Mention --greedy when no casks were upgraded. 2020-11-16 04:35:55 +01:00
Markus Reiter 1b732ec7b2 Fix RuboCop offenses. 2020-11-16 02:05:29 +01:00
Rylan PolsterandMarkus Reiter 50890ebd51 fix Lint/DuplicateBranch style 2020-11-16 02:02:52 +01:00