1991 Commits

Author SHA1 Message Date
apainintheneck
984dcf8c11 API: Load casks/formula from JSON with missing keys
We'd like to reduce the size of the API JSON and to do that we are
going to remove unused and/or blank elements from the cask/formula
definition. This will reduce the amount of data that has to go
over the wire and make it easier to load this data into memory.
2024-01-01 19:10:48 -08:00
Douglas Eichelberger
ffd761d2e9 Create dedicated Attrable mixin for attr_ methods 2023-12-28 11:46:27 -08:00
Douglas Eichelberger
caf8259ae6 Code review changes 2023-12-27 15:29:33 -08:00
Douglas Eichelberger
3abbf4447e Some minor regexp match perf improvements 2023-12-27 13:16:36 -08:00
Razvan Azamfirei
2dc3741f08
audit: fix formula path 2023-12-26 08:19:49 +02:00
apainintheneck
b79778229c Resolve Cask::Cask.all todo
Now it takes the :eval_all parameter that means we can remove
ARGV handling inside Cask::Cask.all.
2023-12-21 21:55:16 -08:00
apainintheneck
5a674c232f Fix Cask::Cask.all bug
We were only loading casks from files with this command which,
of course, didn't work for casks that can only be loaded from
the API (when the core cask tap is not tapped). This changes
things to align more with what we do for formulae.
2023-12-21 21:39:58 -08:00
Mike McQuaid
228b1d62ed
cask/artifact/abstract_uninstall: handle signal failures.
If the process is running as another user: this will always fail.
2023-12-20 19:43:46 +00:00
Patrick Linnane
9dee80cb2d
various: fix style errors 2023-12-18 09:34:01 -08:00
Rylan Polster
25b753fe51
Re-add some discontinued? checks for casks 2023-12-17 19:07:37 -05:00
Rylan Polster
4793677123
Merge pull request #16292 from Rylan12/cask-deprecate-disable
Add `deprecate!` and `disable!` to casks
2023-12-17 15:03:39 -05:00
Mike McQuaid
fb7f1a2c4d
Merge pull request #16349 from unshare/homepage-ua
Work around recent Akamai/Microsoft issues
2023-12-17 15:58:01 +00:00
Rylan Polster
c21b8bd68a
Fix deprecation message
Co-authored-by: Bo Anderson <mail@boanderson.me>
2023-12-16 23:10:20 -05:00
Rylan Polster
6431822e7b
Apply feedback 2023-12-16 20:18:35 -05:00
Rylan Polster
472dd95b16
Fix cask loading from the API
Co-authored-by: Kevin <apainintheneck@gmail.com>
2023-12-16 20:08:26 -05:00
Rylan Polster
40d3ab6a5d
Add tests and fix brew typecheck 2023-12-16 20:01:47 -05:00
Rylan Polster
7eb3f1a314
Replace discontinued? with deprecated? 2023-12-16 20:01:47 -05:00
Rylan Polster
641a80475e
Update cask logic to handle deprecations and disables 2023-12-16 20:01:47 -05:00
Rylan Polster
036723a668
Add deprecate! and disable! methods to the Cask DSL 2023-12-16 20:01:46 -05:00
Valentin Kulesh
06155ff6e0
Work around recent Akamai/Microsoft issues
At the moment, Microsoft Office and related casks fail audit due to
failure to fetch a product homepage from the main Microsoft site
(https://www.microsoft.com/) served by Akamai CDN.
The failure is severe and weird: no status code is received as the
connection is reset.
The analysis revealed the issue is linked to `User-Agent` and
`Accept-Language` headers parsing. Homebrew uses involved user agent
strings and has language hardcoded as `en`.
The simplest workaround is to use a simple user agent string when checking
homepage availability if the cask is in an audit exceptions list.

Merging this would fix Microsoft Office updates (including
https://github.com/Homebrew/homebrew-cask/pull/162671)
2023-12-16 22:20:17 +03:00
Issy Long
149b0e4f31
Fix new Style/MutableConstant RuboCop offenses for Ruby 3.1
- A follow-up to de592af20bbff5bcb548d2474f0722e59ff1129a, resetting the previous disabled comments too.
2023-12-16 11:57:06 +00:00
Issy Long
de592af20b
rubocop: Set TargetRubyVersion to 3.1 & disable all cops that fail
- As discussed in
  https://github.com/Homebrew/brew/pull/16337#issuecomment-1855668516,
  then we won't have the chicken/egg problem of fixing cops for syntax
  that's unsupported on Ruby 2.6 _before_ we set the TargetRubyVersion
  to 3.1, but if we set it too early then all the taps will fail.
2023-12-14 23:19:43 +00:00
Bo Anderson
5692c8ecbf
Fix style violations under newer RuboCop 2023-12-14 05:47:12 +00:00
Mike McQuaid
bd378a7b25
Merge pull request #16330 from MikeMcQuaid/untap_exceptions
cmd/untap: fix untapping syntax failure.
2023-12-13 14:09:44 +00:00
Mike McQuaid
beb9799265
cmd/untap: fix untapping syntax failure.
If an installed cask is invalid on attempting an untap: it will
prevent untapping that cask.

Fix this in two ways: one more specific to `untap` and one more
generally to other commands too:
- specific: only read the actual formulae/casks from the tap we're
  untapping instead of all of those that are installed
- general: rescue more exceptions in `Cask::Caskroom.casks` (like we
  already do for `Formula.installed`
2023-12-13 13:54:37 +00:00
Mike McQuaid
79a6091d08
Cask#full_name: properly output Homebrew org names
This was not returning the full name correctly for e.g. anything in
Homebrew/homebrew-fonts.

While we're here, fix up a few other places where `tap.core_cask_tap?`
can be used more appropriately.
2023-12-13 13:17:12 +00:00
Bo Anderson
b42256d286
Deprecate, disable & delete code for Homebrew 4.2.0 2023-12-07 23:42:13 +00:00
Sam Ford
491e2c4a80
Reorder #audit_min_os array for consistency
This change doesn't affect the behavior of the `#audit_min_os`
method and simply reorders the array members to place `plist_min_os`
before `sparkle_min_os` for the sake of consistency (using the same
order as the preceding lines).
2023-11-16 12:05:25 -05:00
Sam Ford
28451bd2bc
Use Sparkle sorting/filtering in #livecheck_min_os
The `#livecheck_min_os` cask audit method manually replicates some of
the `Sparkle` strategy's behavior but in an incomplete way that has
lead to inappropriate audit failures at times. This reimplements it
to use `Livecheck` methods, so it will align with the `Sparkle`
strategy's behavior.
2023-11-16 12:05:24 -05:00
Sam Ford
d376b46a7d
Skip items strategy blocks in #livecheck_min_os
The `#livecheck_min_os` cask audit method should be skipped when a
`Sparkle` `livecheck` block contains a `strategy` block that uses
the `items` argument (instead of `item`). These `strategy` blocks
contain arbitrary logic that ignores/overrides the strategy's sorting,
so we can't identify which item would be first/newest.
2023-11-16 12:05:24 -05:00
Bevan Kay
5f79980938
cask/url headers parameter type fix 2023-11-09 10:23:13 +11:00
Mike McQuaid
ff404fe5ab
Merge pull request #16184 from dduugg/rm-try
Remove use of ActiveSupport try
2023-11-06 13:11:01 +00:00
Mike McQuaid
d4bf3b0685
Merge pull request #16183 from dduugg/sorbet-updates
Sorbet updates for compatibility with recent releases
2023-11-06 13:10:12 +00:00
Razvan Azamfirei
df2aee4553
audit: add extract artifcats method 2023-11-05 17:18:32 -05:00
Razvan Azamfirei
e60523766e
audit: code review changes 2023-11-05 17:18:32 -05:00
Razvan Azamfirei
c90e6e7b4b
cask/audit: add audit_min_os 2023-11-05 17:18:31 -05:00
Douglas Eichelberger
75179e9239 brew style --fix 2023-11-05 12:18:31 -08:00
Douglas Eichelberger
00ba09d73d Remove use of ActiveSupport try 2023-11-05 09:28:19 -08:00
Douglas Eichelberger
0191af7899 resolve typecheck errors 2023-11-05 08:55:58 -08:00
Mike McQuaid
54012f14ce
cask: add installed_time to JSON output.
This is provided for formulae in `installed.time` and is useful to have
for casks as well as formulae so let's output it here too.
2023-11-03 11:37:01 +00:00
Edward
f21af1e3eb
fix: xattr check in download quarantine 2023-10-25 21:22:06 +08:00
Edward
25ab4a2733
Revert "fix: ignore quarantine for linux cask download"
This reverts commit d2c15d04a1603c0a20fcedd0070d7c144cba28d8.
2023-10-25 21:21:28 +08:00
Edward
d2c15d04a1
fix: ignore quarantine for linux cask download 2023-10-25 19:25:29 +08:00
Mike McQuaid
eb1355e624
Add HOMEBREW_SUDO_THROUGH_SUDO_USER
This environment variable allows telling Homebrew to use the `SUDO_USER`
variable to `sudo` through that user when Homebrew (Cask) attempts to
run `sudo`.

While we're here, clarify in some messaging that we're running `sudo`
and that that's the password we're asking for; the specific password is
configuration dependent and not the specific password for the user.

Similarly, remove the `Package installers may write to any location`
output; it's kinda spammy and doesn't feel like the right place.
2023-09-29 18:49:44 +01:00
Bo Anderson
af7d744af0
Fixes for Ruby 3 2023-09-29 05:25:48 +01:00
apainintheneck
85bd4c7e1f utils/backtrace: scrub sorbet-runtime from backtrace
Ever since we started using this at runtime it's been polluting
the backtrace output. This makes it harder to debug errors and
increases the amount of info users have to paste into the box
when filing an issue.

This is a very direct approach. Essentially, we strip out
everything related to the `sorbet-runtime` gem whenever the top
line in the backtrace is unrelated to sorbet-runtime.

The hope is that this will allow errors related to sorbet to
be diagnosed easily while also reducing the backtrace size
for all other types of errors.

Sometimes it is useful to see the full backtrace though.
For those cases, we include the full backtrace when
`--verbose` is passed in and print a warning that the
Sorbet lines have been removed from the backtrace the
first time they are removed.

Note: This requires gems to be set up so that the call to
`Gem.paths.home` works correctly. For that reason, it must
be included after `utils/gems` which is included in
`standalone/load_path` already.
2023-09-21 21:07:22 -07:00
Mike McQuaid
9b7b283805
Merge pull request #15977 from apainintheneck/improve-cask-audit
Improve cask audit
2023-09-08 00:46:34 -04:00
apainintheneck
1dc9274f62 Improve cask audit
- check for cask.url in audit steps
- check for cask.version in audit steps
- check for cask.sha256 in fetch command
- stop omitting casks based on nil url in audit command

It would be nice to be able to omit casks from the audit
if the os is not supported but there is not easy way to
do that without updating the SimulateSystem code or
refactoring how MacOSRequirement's are defined in the DSL.
2023-09-07 20:38:17 -07:00
Mike McQuaid
d5d74788b2
Merge pull request #15968 from MikeMcQuaid/cask_upgrade_sudo_test_fix
cask/quarantine: don't try to sudo during tests.
2023-09-06 10:17:37 -04:00
Mike McQuaid
58df7885e6
cask/quarantine: sudo correctly during tests.
Use `NeverSudoSystemCommand` and pass it through to
`Quarantine.copy_xattrs` so `brew tests` doesn't try to `sudo`.

Fixes #15958

Co-authored-by: Bo Anderson <mail@boanderson.me>
Co-authored-by: Kevin <apainintheneck@gmail.com>
2023-09-06 10:03:45 -04:00