2315 Commits

Author SHA1 Message Date
botantony
ac2d167ffc
cask/dsl: set no_autobump! if livecheck uses :extract_plist
Signed-off-by: botantony <antonsm21@gmail.com>
2025-05-21 23:23:29 +02:00
Eric Knibbe
5027a9d2f2
cask/audit: skip audit_rosetta on Intel-only casks & OSes 2025-05-21 10:14:08 -04:00
Mike McQuaid
28eab5c9a0
Merge pull request #19910 from botantony/no_autobump_extract_plist
cask/dsl: set `no_autobump!` automatically in some cases
2025-05-20 07:49:16 +00:00
Carlo Cabrera
7cd1972f39
Revert "cask/artifact/abstract_uninstall: fix trash_paths" 2025-05-14 01:39:47 +08:00
Bo Anderson
923be69785
Phase out using cgi library 2025-05-13 01:33:14 +01:00
Eric Knibbe
0838ceda90
cask: document shell completion stanzas
Also, allow them to be given a `target:` parameter.
2025-05-09 14:47:26 -04:00
botantony
6cea5ef4f0
cask/dsl: exclude from autobump if version is :latest
Signed-off-by: botantony <antonsm21@gmail.com>
2025-05-07 17:25:58 +02:00
botantony
4373aad153
cask/dsl: set no_autobump! if :extract_plist livecheck strategy is used
Signed-off-by: botantony <antonsm21@gmail.com>
2025-05-07 14:07:36 +02:00
Patrick Linnane
c6a2fa335d
brew style --fix 2025-05-05 14:35:08 -07:00
Mike McQuaid
eae31bacdc
cask/installer: output the correct environment variable.
We previously would output `HOMEBREW_FORBIDDEN_CASKS` for both when it
was used and when `HOMEBREW_FORBID_CASKS` was set.
2025-05-02 14:38:26 +01:00
Mike McQuaid
30d9ea24c5
Add HOMEBREW_FORBID_CASKS to allow forbidding all casks.
`HOMEBREW_FORBIDDEN_CASKS` allows forbidding specific casks but, in some
cases, you may wish to forbid all casks from installation.
2025-05-01 09:48:53 +01:00
botantony
a10b635fe9 no_autobump!: suggestions from contributors and docs
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-29 18:04:59 +02:00
botantony
79cf39fc1d formula/cask: add symbol support to no_autobump! method
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-29 18:04:59 +02:00
botantony
ad66e0c418 tap: get autobump list from formula/cask API
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-29 18:04:59 +02:00
botantony
1fcacdc2dc formula/cask DSL: add no_autobump! method
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-29 18:04:59 +02:00
Carlo Cabrera
f816a39d1f
cask/artifact/abstract_uninstall: fix trash_paths
This is currently behaving incorrectly when calling `trash.swift` fails
due to lack of permissions. In this instance, `trash.swift` prints

    error: permissionDenied

to stdout, and this is incorrectly parsed as having successfully trashed
a file named `error` and another named ` permissionDenied`.

Let's fix this by ensuring that:
- any paths in `trashed` are in the `paths` that we wanted to trash in
  the first place
- define `untrashable` by removing the `trashed` paths from `paths`
2025-04-24 18:03:07 +08:00
Sam Ford
4917fb2c93
Cask::DSL: Remove duplicate token definition
I inadvertently duplicated the `@token` instance variable definition
in `Cask::DSL#initiailize`, so this removes the duplicate. This
didn't have any noticeable effect because it was redefined afterward,
so this is just a bit of tidying up.
2025-04-23 09:37:05 -04:00
Sam Ford
c0f23acdcd
Cask::Auditor: update language_blocks condition
I recently modified `Cask::DSL` to define instance variables in the
`#initialize` method and this involved some changes to the `language`,
`language_eval`, and `languages` methods. One of those was to
initialize `@language_blocks` to an empty hash instead of using a
`nil` default. I updated the related condition in the `language_eval`
method but I missed that `language_blocks` is used in `Cask::Auditor`
and it specifically relies on a false-y value to check if the variable
is set. An empty hash isn't false-y, so this is causing issues for
`brew audit`.

This updates the condition in `Cask::Auditor` to check for a non-empty
hash instead, which resolves the issue.
2025-04-23 09:19:41 -04:00
Mike McQuaid
141414a3c3
Merge pull request #19807 from Homebrew/downloadable-fixes
Cleanup Downloadable variables and types
2025-04-23 07:24:19 +00:00
Sam Ford
6f511ee4e2
Cask::DSL: initialize more instance variables
I recently updated `Cask::DSL` to define instance variables in
`#initialize` to get us closer to resolving a "shape variation"
warning from Ruby. The reason why we continued to receive this warning
after the previous changes is because I overlooked the variables that
are set using `set_unique_stanza`.

The tricky part about those instance variables is that we need to be
able to identify if they've been set. I've handled this by using a
`nil` initial value and updating the `instance_variable_defined?`
condition to check for a non-`nil` value instead. This works for these
variables but it would be a problem if we ever have a DSL method that
accepts a `nil` argument.
2025-04-22 23:21:05 -04:00
Bo Anderson
35f874c036
Cleanup Downloadable variables and types 2025-04-23 03:30:15 +01:00
Sam Ford
5b5c460ab9
Cask::DSL: define instance variables in initialize
We're now seeing warnings related to the cask DSL surfaced by Ruby
3.4:

```
/opt/homebrew/Library/Homebrew/cask/dsl.rb:456: warning: The class
Cask::DSL reached 8 shape variations, instance variables accesses
will be slower and memory usage increased.
It is recommended to define instance variables in a consistent order,
for instance by eagerly defining them all in the #initialize method.
```

I've been working on upgrading `Cask::DSL` to `typed: strict` and
part of that involves defining all of the instance variables in the
`initialize` method, so I've extracted this part of that work as a
way of helping to resolve the aforementioned warning. This doesn't
fully resolve the warning but it addresses what it was originally
referencing, at least.

For what it's worth, this includes some type fixes but I've only
included what's necessary to pass `brew typecheck`.
2025-04-22 18:12:33 -04:00
Sam Ford
c495aa3e63
Cask::DSL::DependsOn: add empty?, present? methods
`#present?` is called on a `DependsOn` object in `Cask::DSL` and this
is seemingly deferred to the underlying hash object but Sorbet doesn't
understand this kind of `SimpleDelegator` magic. This adds `empty?`
and `present?` methods that explicitly interact with the hash in a
way that Sorbet can understand.
2025-04-22 18:07:09 -04:00
Mike McQuaid
c9a7b62b1d
Homebrew 4.5 deprecations/disables/removals
The usual cycle of deprecating, disabling, and removing things in
Homebrew major/minor releases.
2025-04-22 17:15:23 +01:00
botantony
4fa1355be0 deprecate!/disable!: remove non-typed replacement field
Signed-off-by: botantony <antonsm21@gmail.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2025-04-21 21:13:25 +02:00
botantony
ca447e1ce9 deprecate!/disable!: replacement_formula/replacement_cask fields
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-21 21:13:25 +02:00
botantony
e594e7e0bb deprecate!/disable!: allow to specify replacement type
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-21 21:13:25 +02:00
Bo Anderson
4cda5a1aa9
cask/artifact/abstract_flight_block: fix warning in Ruby 3.4 2025-04-16 17:06:59 +01:00
Sam Ford
97cce36779
Make os available in cask livecheck blocks
Casks now support an `os` DSL method, similar to `arch`. This makes
it available in `livecheck` blocks, like we do with `arch`.
2025-04-04 09:17:32 -04:00
Bevan Kay
4852829931
cask/audit: install container deps 2025-04-02 16:34:28 +11:00
Eric Knibbe
57f764a1d8 cask/api: remove control characters from cask caveats 2025-03-24 15:43:15 -04:00
Mike McQuaid
2a7c7511c3
cask/quarantine: tweak wording.
Co-authored-by: Eric Knibbe <enk3@outlook.com>
2025-03-20 18:07:30 +00:00
Mike McQuaid
10ad72c348
quarantine: allow skipping the app management permissions prompt.
If we know that we don't care about this prompt, let's allow setting
a variable to avoid alarming users.
2025-03-20 16:22:41 +00:00
Mike McQuaid
4a4aeca424
cask/download: avoid some checksum warnings.
These are always output in CI for e.g. `brew fetch google-chrome` and
are completely unactionable by the user.

Ultimately this is not disabling any security checks, it's just changing
when a warning is output and unifying the logic with the other similar
warning.
2025-03-19 12:45:50 +00:00
Douglas Eichelberger
c9a6bd6438
Merge pull request #19475 from Homebrew/typed-system-command
refactor: Enable strict typing in download_strategy
2025-03-14 22:34:17 +00:00
Sean Molenaar
756ba2ba59 Add Linux dependency check in cask.rb 2025-03-13 21:47:17 +01:00
Sean Molenaar
9f6b421ad6 fix: check OS for macos dependency 2025-03-13 21:28:40 +01:00
Sean Molenaar
a137426839 feat: generate cask API for linux 2025-03-13 21:28:40 +01:00
Douglas Eichelberger
c48870080e
Incorporate feedback 2025-03-13 11:59:31 -07:00
Douglas Eichelberger
f183d0a398
Enable strict typing in Cask::URL 2025-03-12 19:09:52 -07:00
Douglas Eichelberger
e49a69679d
Enable strict typing in TopologicalHash 2025-03-12 19:09:52 -07:00
Douglas Eichelberger
1ca5299f40
refactor: Enable strict typing in download_strategy 2025-03-12 15:15:20 -07:00
Bevan Kay
74556fe97c
cask/utils: alllow use of @ in cask name 2025-03-12 19:57:37 +11:00
Eric Knibbe
cae1ca33ec
rmdir: ignore unreadable path errors 2025-03-11 09:48:39 -04:00
Eric Knibbe
c5ec1fa61b
cask/installer: pass more options to cask dependencies 2025-03-06 14:10:37 -05:00
Sam Ford
1ac70579eb
Cask: skip livecheck https audit for POST requests
We recently added `POST` request support to livecheck but related cask
checks are failing the `livecheck_https_availability` audit because it
calls `validate_url_for_https_availability` which calls
`Utils::Curl.curl_check_http_content` and that checks the URL using a
`GET` request. Adding `POST` request support to all of those methods
will take some work, so this adds a guard to skip the audit if the
`livecheck` block uses `post_form` or `post_json`. This isn't ideal
but it will allow us to add these `livecheck` blocks in the interim
time.

Co-authored-by: Douglas Eichelberger <d@eic.email>
2025-03-06 12:14:42 -05:00
Sean Molenaar
fc319f6793 feat: add tests for completion stanzas 2025-03-05 20:12:18 +01:00
Sean Molenaar
ab2b18f78c feat: add os_version for casks 2025-03-05 20:12:18 +01:00
Sean Molenaar
55b07d7fed feat: add cask shell completion 2025-03-05 20:12:18 +01:00
Douglas Eichelberger
fcf18912fe
Inline use of attr_predicate 2025-03-02 21:36:03 -08:00