2034 Commits

Author SHA1 Message Date
apainintheneck
8c2f101138 cmd/fetch: handle nil cask urls
These urls can be nil if there is an unsatisfied macos version
requirement. We check for false here because either the macos
requirement can be satisfied and return true or can not be
specified and return nil. If it's not specified, it means it
can run on any macos version.

The change in Cask::Download should provide better error messages
in Downloadable but honestly we're better off just checking for
the missing url higher up the call stack which is why I made
the changes in the fetch command. Either way it seemed like
a good idea while I'm here.
2023-09-02 20:56:55 -07:00
apainintheneck
51387287f7 Handle nil urls in cask installer and API cask loader
The goal here is to handle the case where a cask might have a nil
url stanza because that cask is not available on the current version
of macOS or the given architecture. This just moves those checks
from the end of the `Cask::Installer#fetch` method to the beginning
so that we don't try and download casks that are missing urls.

This will now provide a helpful error message like so:
```
Error: This software does not run on macOS versions older than Big Sur.
```

Beyond that it no longer tries to run the url stanza with a nil value
when loading casks from the API.
2023-09-02 20:56:36 -07:00
Eric Knibbe
686638b683
cask/audit: format-check block URLs only if online 2023-08-29 17:10:40 -04:00
Douglas Eichelberger
d01cda2815 Turn up the types 2023-08-12 22:01:22 -07:00
Mike McQuaid
22553cd34a
Fix cask sharding issues
- Fix cask info output being incorrect
- Improve some code referring to casks as formulae
- Move livecheck cask fixtures to not shadow existing names
- Adjust the cask tap symlinking logic to make handling outdated
  shadowed casks significantly easier
- Fix various flaky tests caused by casks sharding logic
- Prefer longer paths when there's multiple formulae or casks in a tap
  with the same name rather than always using the first
2023-08-10 16:08:47 +01:00
Razvan Azamfirei
72df964b33
change path 2023-08-09 15:27:36 -04:00
Razvan Azamfirei
a916d6184b
Update Library/Homebrew/cask/audit.rb
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-08-09 15:26:47 -04:00
Razvan Azamfirei
ef9e0bc8a6
cask/audit: audit for appropriate sharding directory 2023-08-09 14:52:30 -04:00
Douglas Eichelberger
efd02b956d Revert "Revert "Make inreplace a purely static method""
This reverts commit 8656caa67ce2dd9ec6484969b183c1fd7805451e.
2023-08-04 16:20:38 -07:00
Mike McQuaid
b3c33d34ab
Various sharding fixes
- Load paths with no API when needed (e.g. for `brew edit`)
- Use no API mode for `brew log` as it's needed there
- Define sharding format for homebrew-cask and homebrew-core inside
  `Tap` methods
- Create new formulae/casks in location defined by these `Tap` methods
- Fix a bug in Formulary that made sharded formulae lookup less
  efficient (and possibly broke it for core and some API usage)
- Fix various other hardcoded Formula/Cask directory assumptions

Co-authored-by: Bo Anderson <mail@boanderson.me>
2023-08-04 16:43:13 +01:00
Alexander Bayandin
8656caa67c
Revert "Make inreplace a purely static method" 2023-08-03 16:16:19 +01:00
Douglas Eichelberger
2ad87f87d5 Make inreplace a purely static method 2023-08-02 09:44:18 -07:00
Eric Knibbe
b3ecd91f97
dev-cmd/edit: suggest tapping core repositories 2023-08-01 13:39:28 -04:00
Mike McQuaid
471e733641
Merge pull request #15754 from MikeMcQuaid/cask_url_class
cask/url: accept `Class` for `using`.
2023-07-25 16:04:48 +01:00
Mike McQuaid
4b9c031e1b
Merge pull request #15725 from razvanazamfirei/bump-cask-pr-arch
`bump-cask-pr`: add arch-specific version support
2023-07-25 15:52:36 +01:00
Mike McQuaid
7d153d34e9
cask/url: accept Class for using.
Fixes #15750.
2023-07-25 15:50:49 +01:00
apainintheneck
c9dea04bd4 cmd/install: upgrade already installed casks
Previously, the behavior was to warn users that a cask was already
installed and then skip modifying the installed version. This is
different to how we handled things with formulas. For them we would
upgrade any already installed formulas. This just brings casks in line
with what we already do with formulas.

Changes:
- cmd/install: Upgrade already installed casks if HOMEBREW_NO_INSTALL_UPGRADE
  is not set
- env_config: Update wording of HOMEBREW_NO_INSTALL_UPGRADE to include casks
- remove error that was only used to alert about already installed casks

Note:
- The upgrade command for casks defaults to --greedy when you pass named casks
  to the command which means that this will always default to that behavior
  since you must specify the name of the cask when installing.
2023-07-23 18:50:39 -07:00
Razvan Azamfirei
c64c834d05
bump-cask-pr: add arch-specific version support 2023-07-21 11:45:34 -04:00
Bo Anderson
67ecc2452a
Merge pull request #15602 from donaldducky/cask-support-multiple-headers
Cask support multiple headers
2023-07-20 21:19:55 +01:00
Douglas Eichelberger
368dd4d949 Fix other to_json override while we're here 2023-07-18 11:30:46 -07:00
Mike McQuaid
c940e15a5c
Use HOMEBREW_CELLAR_PLACEHOLDER
Similarly to HOMEBREW_PREFIX_PLACEHOLDER, this allows the substitution
of HOMEBREW_CELLAR in JSON output when using the API.

Fixes #15668.
2023-07-18 10:59:27 +01:00
Bo Anderson
ba02c669e1
Introduce CoreCaskTap class 2023-07-13 20:33:26 +01:00
Mike McQuaid
cb6178596b
Merge pull request #15632 from MikeMcQuaid/deprecate_disable_delete
Deprecate/disable/delete code.
2023-07-07 07:57:50 +01:00
Mike McQuaid
7da934f7e2
Deprecate/disable/delete code.
The next release after this is merged will be 4.1.0.

Co-authored-by: Markus Reiter <me@reitermark.us>
2023-07-06 16:56:20 +01:00
Mike McQuaid
eadac2fb2a
cask/quarantine: tweak wording. 2023-07-06 14:10:13 +01:00
Marcin Floryan
1b474a508d
App Management message updated
With the update of MacOS from Monterey (12) to Ventura (13) the appearance of the System Settings has changes and the "Security & Privacy" category has been renamed to "Privacy & Security".

I am aware that currently Ventura has a very low adoption rate so this change could be premature.
2023-07-06 14:43:36 +02:00
Don Chea
907a9238c2 Always pass headers as array to downloader, if present
We still need to support it being named "header" in the Cask url stanza.
2023-06-28 11:37:15 -04:00
Don Chea
8f8d69a203 cask: url stanza support for multiple headers 2023-06-28 11:36:12 -04:00
hyuraku
de7152b7a3 rename Cask::outdated_versions 2023-06-19 22:09:01 +09:00
Ismayil Mirzali
8a52ae2933
cask/quarantine: fix exception not being caught
Changes the rescue clause to also handle EPERM.

This fixes the issue of cask upgrades/reinstalls to failing due to
permissions [1]. It's worth noting though, the prompt for allowing App
Management permissions does not seem to occur, so that's something else
to be investigated.

1. https://github.com/Homebrew/homebrew-cask/issues/148253

Signed-off-by: Ismayil Mirzali <ismayilmirzeli@gmail.com>
2023-06-05 18:54:44 +03:00
Mike McQuaid
89dfe4fc5b
Merge pull request #15483 from JBYoshi/cask-prompt-permissions
Check for App Management permissions before updating apps.
2023-05-29 09:15:22 +01:00
Mike McQuaid
98dd8610ae
Tweak code style and documentation wording 2023-05-29 08:59:35 +01:00
JBYoshi
97b9b61061
Change permission failure from fatal to warning. 2023-05-26 11:13:23 -05:00
JBYoshi
40352cb2da
Make Homebrew check for App Management permissions before updating apps. 2023-05-24 22:11:16 -05:00
Markus Reiter
43c6b0ab61
Use sudo for copying xattrs when necessary. 2023-05-24 23:39:18 +02:00
Markus Reiter
813e639678
Add cask URL location to audit problems. 2023-05-21 16:17:16 +02:00
Markus Reiter
7cc1b6191e
Clean up brew audit output. 2023-05-19 19:40:37 +02:00
Markus Reiter
beb4c044c2
Fix wrong token in Cask::Migrator. 2023-05-18 19:50:06 +02:00
Markus Reiter
53de9f38a2
Merge pull request #15430 from reitermarkus/cask-inspect
Simplify `Cask#inspect`.
2023-05-16 11:08:01 +02:00
Markus Reiter
2f9c1868aa
Don't special-case message for outdated casks that aren't installed. 2023-05-15 11:42:01 +02:00
Markus Reiter
89292f47b5
Simplify Cask#inspect. 2023-05-15 10:17:17 +02:00
Markus Reiter
2ae5ae243a
Merge pull request #15414 from reitermarkus/rmdir-sudo
Use `sudo` for `rmdir` if necessary.
2023-05-14 21:42:00 +02:00
Markus Reiter
d2231086bd
Merge pull request #15420 from reitermarkus/simulate-system-with
Add `SimulateSystem::with`.
2023-05-14 21:41:20 +02:00
Mike McQuaid
3dabf504bd
Merge pull request #15176 from reitermarkus/cask-renames
Implement cask renames.
2023-05-14 19:46:56 +01:00
Markus Reiter
0d56b97b07
Add SimulateSystem::with. 2023-05-14 01:45:04 +02:00
Markus Reiter
935c5efaf8
Use sudo for rmdir if necessary. 2023-05-13 06:46:59 +02:00
Markus Reiter
d7a0e260e8
Improve Cask::Utils.gain_permissions_remove for symlinks. 2023-05-13 03:54:48 +02:00
Markus Reiter
2c71d9dcd8
Use sudo for symlinks if necessary. 2023-05-13 03:42:00 +02:00
JBYoshi
ad8ce82673
Fix typing on revert_upgrade().
Also adds several type signature checks to test for these errors.
2023-05-12 14:53:27 -05:00
Markus Reiter
a3231a03fa
Implement cask renames. 2023-05-12 21:17:30 +02:00