1528 Commits
Author SHA1 Message Date
apainintheneck b85f407e95 Only upgrade :latest casks when --greedy and the cask has been updated
A sha256 hash of the previous download is stored and compared with
new downloads before updating :latest casks. This prevents unnecessary
reinstalls when the cask hasn't been updated.

Move download path to cask from installer to prevent unnecessary
redownloads of casks.
2022-05-17 16:15:05 -07:00
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
apainintheneck 0dd3764041 Allow casks with outdated caskfiles to be reinstalled
The problem occurred when calling `brew reinstall` on a cask
with an out of date caskfile.

To solve the problem Cask::Installer#uninstall_existing_cask has been changed to
catch a possible CaskInvalidError when trying to load outdated
caskfiles using Cask::CaskLoader#load.
2022-05-02 23:39:18 -07:00
Sam Ford 13e3f704c9 Cask::Audit: Account for nil appcast_contents 2022-04-20 23:47:51 -04: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
Mike McQuaid 61976e0672 caskroom: add, use any_casks_installed?.
Add a new method for the two places we're checking if we have any
casks installed. This is much more performance and user friendly than
attempting to load every cask.

Fixes #13027
2022-03-30 17:25:00 +01:00
Mike McQuaid 38e1b3d64b Deprecations, disables, deletions for 3.4.0 2022-02-22 14:28:32 +00:00
Carlo Cabrera 902b4e1f3f cask/dsl/caveats: add :requires_rosetta
Some casks will fail to install with a `Bad CPU type in executable`
error on Apple Silicon. See Homebrew/homebrew-cask#118638.

This error can be quite confusing, so let's add a way to help users know
that they need to install Rosetta to use or even install a cask.
2022-02-04 09:50:21 +08:00
Mike McQuaid a691768c81 cask/exceptions: fix reinstall cask messaging.
Fixes #12813.
2022-02-01 08:39:40 +00:00
Mike McQuaid 3a709d36b2 Start process to remove Enumerable from Formula and Cask::Cask.
This is the first step to address
https://github.com/Homebrew/brew/issues/11292.
2022-01-03 14:59:10 +00:00
Dabezt 0b44dd5a48 Make trash.swift safer and more modern 2021-12-31 14:07:42 +03:00
Dabezt e4f106533e Modernize quarantine.swift 2021-12-31 13:23:45 +03:00
Rylan Polster 2e6b6ab3a2 Fix style 2021-12-24 21:15:21 -05:00
fn ⌃ ⌥ 68160df041 cask: add #csv to version DSL 2021-11-16 16:34:12 -08:00
Nihaal SanghaandGitHub 1984ca098d Update cask cookbook header 2021-11-07 01:23:31 +00:00
Bo Anderson 4836ea0ba2 Remove XQuartz handling 2021-11-05 12:40:22 +00:00
Sam Ford 77273fe2b3 Cask::Audit: Handle referenced cask in livecheck
`Cask::Audit#check_livecheck_version` was never updated to handle
a referenced cask in a `livecheck` block (e.g., `cask "other-cask"`).
As a result, this audit will wrongly give an error like `Version
'1.2.3' differs from '' retrieved by livecheck.` in this scenario.

This commit ensures that a referenced cask is handled by the audit
and it won't error when the referenced check provides a good version.
2021-11-02 12:32:38 -04:00
Mike McQuaid d43555dd75 brew style --fix 2021-11-02 11:16:10 +00:00
Rylan Polster 0b8032d421 Document HOMEBREW_INSTALL_FROM_API 2021-10-22 12:37:57 -04:00
Rylan Polster e24703e58d Rename :cert_error_allowlist to :secure_connection_audit_skiplist 2021-10-21 21:11:06 -04:00
Rylan Polster fa4bb7d74a Refactor audit exception handling 2021-10-21 21:11:05 -04:00
Rylan Polster d124d8eae8 cask/audit: allow the homepage https audit to have exceptions 2021-10-21 21:01:52 -04:00
George AdamsandGitHub 8c22e009ac update depends_on_java to suggest temurin
AdoptOpenJDK has been deprecated. Temurin is the new cask
2021-10-21 13:00:00 +01:00
fn ⌃ ⌥andGitHub 04710be2a8 install: fix --skip-cask-deps message 2021-09-27 18:25:39 -07:00
fn ⌃ ⌥ 8dc060c88b upgrade: use greedy_* method parameters 2021-09-21 11:45:49 -07:00
XuehaiPan c2d5d84b21 Merge remote-tracking branch 'upstream/master' into fix-inconsistent-shell-style 2021-09-16 01:01:49 +08:00
XuehaiPan 3f96d963f7 style: fix inconsistent code style for shell scripts 2021-09-15 14:59:01 +08:00
Bo AndersonandGitHub bb69e1ee4d Merge pull request #12037 from Bo98/type-bump
Bump various type strictnesses
2021-09-14 02:18:38 +01:00
Mike McQuaidandGitHub 1a904af264 Merge pull request #12018 from FnControlOption/upgrade-tsort
upgrade: use topological sort to upgrade formulae
2021-09-12 19:26:22 +01:00
Bo Anderson 861dea9ada Bump various type strictnesses 2021-09-11 01:00:23 +01:00
hyuraku e44ac800c2 repair cask install quiet mode 2021-09-10 23:12:52 +09:00
fn ⌃ ⌥ 0c3e49092c upgrade: use topological sort to upgrade formulae 2021-09-09 13:41:50 -07: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
Rylan Polster 5d536d66fc Rename HOMEBREW_JSON_CORE to HOMEBREW_INSTALL_FROM_API 2021-08-27 00:24:15 -04:00
Rylan PolsterandGitHub 8690d661fd Merge pull request #11859 from Rylan12/cask-json
Allow casks to be installed using the `cask-source` API
2021-08-26 23:58:51 -04:00
Rylan Polster c3a8b3841e Only include differring versions
Move the resetting of `MacOS.version` to an `ensure` block.

Fix the tests by adding a test OS and new fixture that has a
different version for that test OS.
2021-08-25 10:30:38 -04:00
Rylan Polster 663cc40139 Add per-os versions to Cask::Cask#to_h 2021-08-24 11:35:19 -04:00
Rylan Polster ea2e40c69a Add Cask::Cask#source to return cask's source code 2021-08-14 16:18:13 -04:00
Rylan Polster 99635bf3ae Remove need for homebrew/cask to be tapped 2021-08-14 16:17:26 -04:00
Mike McQuaidandGitHub b3dd9fb42f Merge pull request #11629 from bevanjkay/upgrade_outdated_skipunversioned
adds an option to skip unversioned casks in outdated and upgrade command
2021-08-03 08:53:53 +01:00
ylht 75a38b7187 refactor the format 2021-07-19 10:02:19 +08:00
ylht e5986dba6c cmd/doctor: repair xattr not find 2021-07-19 09:55:30 +08:00
Nanda H Krishna 2394a4c4fc Rename metadata_master_container_path to metadata_main_container_path 2021-07-08 12:36:40 +05:30
Bevan Kay 322d5c67ec Add parentheses to if statement 2021-07-06 10:11:40 +10: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