722 Commits

Author SHA1 Message Date
Sam Ford
01825acabd
UsesOnSystem: Collect macOS requirements
When determining macOS requirements for a cask, we may need to
reference requirements from related on_system blocks (e.g.,
`on_monterey :or_older`, `on_ventura`, `on_sonoma :or_newer`) when
`depends_on macos` isn't adequate.

Sometimes casks specify different `depends_on macos` values in macOS
on_system blocks but that value is only set when the cask is loaded
in an environment that satisfies the on_system block's requirements.
There are other casks that contain macOS on_system blocks and use
`depends_on macos` outside of the on_system blocks but it may only
use the macOS version of the lowest on_system block (e.g.,
`>= :monterey`), which isn't sufficient if the cask's values vary
based on macOS version.

To be able to simulate macOS versions that meet the requirements of
all the on_system blocks in a cask, we need to collect the macOS
requirements in a way that doesn't require OS simulation. This is also
something that's easy to do in on_system methods, so this adds a
`macos_requirements` array to `UsesOnSystem`, containing
`MacOSRequirement` objects created from the cask's macOS on_system
block conditions.
2025-06-08 00:57:22 -04:00
Sam Ford
3df8f70511
OnSystem: Add UsesOnSystem class
This adds a `UsesOnSystem` class to `OnSystem`, containing boolean
instance variables to indicate which types of on_system methods are
used in a formula or cask. This is intended as a replacement for
`@on_system_blocks_exist`, which doesn't allow us to determine what
kinds of on_system calls were used. This provides more granularity
but we can still use `@uses_on_system.present?` to determine whether
any on_system calls were used (and this doubles as a `nil` check in
`Formula`, as the `self.class` instance variable has to use a nilable
type).

The `UsesOnSystem` instance variables cover the current
`ARCH_OPTIONS` and `BASE_OS_OPTIONS`. At the moment, we mostly need
to tell whether there are macOS/Linux or Intel/ARM on_system calls,
so I've omitted instance variables for specific macOS version until
we have a need for them.

As a practical example, if you wanted to determine whether a cask
uses Linux on_system calls, you can call
`cask.uses_on_system.linux?`. The `linux` boolean will be `true` if
the cask has an `on_linux` block, an `on_system` block (which requires
Linux), or uses `os linux: ...`. This is something that would be
challenging to determine from outside of `OnSystem` but it's
relatively easy to collect the information in `OnSystem` methods and
make it available like this.
2025-06-07 17:58:12 -04:00
Patrick Linnane
c6a2fa335d
brew style --fix 2025-05-05 14:35:08 -07:00
botantony
9ff2abbcdf no_autobump!: rename no_autobump_msg field to no_autobump_message
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
Bo Anderson
3049d21ca0
test/cask/dsl/container_spec: fix test failure with Ruby 3.4 2025-04-16 17:10:10 +01: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
Douglas Eichelberger
c48870080e
Incorporate feedback 2025-03-13 11:59:31 -07:00
Sean Molenaar
fc319f6793 feat: add tests for completion stanzas 2025-03-05 20:12:18 +01:00
apainintheneck
eead014ceb cask/cask: remove unnecessary tests
The `compact:` option got removed from `Cask::Cask#artifacts_list`
in 042d6cc97e886c6f2817500083cda6c856b5350a.
2025-02-06 20:13:19 -08:00
Mike McQuaid
f84082963d
Merge pull request #19009 from Homebrew/fewer_actions_warnings
cask: fewer GitHub Actions warnings.
2024-12-30 13:07:02 +00:00
Mike McQuaid
d490692b26
cask: fewer GitHub Actions warnings.
- don't care about no checksums being defined for official casks
- don't complain about Gatekeeper being disabled on GitHub Actions as
  it's been globally disabled for the team
2024-12-30 12:55:30 +00:00
Rui Chen
79ed2c6e61
chore: fix typos
Signed-off-by: Rui Chen <rui@chenrui.dev>
2024-12-28 15:53:35 -05:00
apainintheneck
9c0987c71c cask/info: update tests 2024-12-12 00:01:30 -08:00
Douglas Eichelberger
3a4243742f Remove OpenStruct from CLI::Args 2024-12-08 10:27:49 -08:00
Sam Ford
79e20b3512
Standardize livecheck block language formatting 2024-12-02 10:13:04 -05:00
Bo Anderson
7308c105a4
cask: try fix a couple of permission edge cases under multi-user 2024-11-25 17:36:47 +00:00
hyuraku
c60e80f0a9 remove Cask::Config.explicit_s spec 2024-10-30 22:20:56 +09:00
Bevan Kay
5a39e1f238
test/cask/audit_spec: audit deprecate/disable reasons 2024-09-30 23:11:44 +10:00
Mike McQuaid
a6954f26a5
Merge pull request #18435 from Homebrew/temp-symlink-test-fix
test/cask/utils_spec: fix test failure when HOMEBREW_TEMP is a symlink
2024-09-27 08:42:11 +01:00
Carlo Cabrera
fe1f330e60
Revert "Deprecate installing casks/formulae from paths." 2024-09-27 10:17:04 +08:00
Bo Anderson
fe0505d492
test/cask/utils_spec: fix test failure when HOMEBREW_TEMP is a symlink 2024-09-27 03:02:26 +01:00
Mike McQuaid
bbdea29a0f
Deprecate installing casks/formulae from paths.
We've already disabled installing casks/formulae from URLs and we
regularly tell people not to install from paths so let's just deprecate
this behaviour entirely.

Even Homebrew developers do not need to work this way.
2024-09-26 20:25:07 +01:00
Mike McQuaid
f0653348c4
Merge pull request #18407 from Homebrew/deprecate_cask_url_block
cask/url: deprecate `url do` blocks.
2024-09-26 16:16:40 +01:00
Mike McQuaid
5b46ec70e9
cask/url: deprecate url do blocks.
We're removing these in
https://github.com/Homebrew/homebrew-cask/pull/186501
so let's deprecate them too.
2024-09-26 14:05:25 +01:00
Case Taintor
31c560e578 Improve cask --adopt to only care about the installed version if auto_update is false 2024-09-26 11:59:40 +02:00
Mike McQuaid
94416e82f0
Add new odeprecated, odisabled, remove disabled code.
Prepare the usual deprecation cycle for Homebrew 4.4.0.
2024-09-24 10:15:34 +01:00
Rylan Polster
b1db0ee290
Rename load method when preferring installed casks 2024-09-10 13:54:12 -04:00
Rylan Polster
8cb62b1398
Set correct tap when loading installed casks 2024-09-10 13:34:40 -04:00
Douglas Eichelberger
f4e04c8951 Make Cask::Artifact::Installer typesafe 2024-08-18 16:10:35 -07:00
Bevan Kay
dcce0584bd
Revert "Make Cask::Artifact::Installer typesafe" 2024-08-13 08:24:20 +10:00
Douglas Eichelberger
52b25d71f5 Make Cask::Artifact::Installer typesafe 2024-08-11 16:56:20 -07:00
Markus Reiter
8e08a698d1
Merge pull request #17562 from reitermarkus/token-auditor
Share code between cask token and formula name audits.
2024-08-10 19:46:32 +02:00
Harald Nordgren
7cf5c2cdd9 Show dependencies for casks 2024-08-03 20:25:13 +02:00
Markus Reiter
3b4e1cb573
Share code between cask token and formula name audits. 2024-07-30 21:41:15 +02:00
Mike McQuaid
7abc6f4349
cask/installer: improve *_FORBIDDEN_* env handling.
- Improve the error message when a cask or formula is forbidden by an
  environment variable (fixes #17880)
- Move the `forbidden_tap_check` and `forbidden_cask_and_formula_check`
  methods to the top of the `install` method, so that they are checked
  before the main cask is downloaded.
2024-07-27 16:13:51 +01:00
Bo Anderson
10cbf191dc
Add env to disable finding packages from paths 2024-07-25 11:37:44 +01:00
Rylan Polster
284f6b8829
Remove redundant context block 2024-07-15 13:55:23 -04:00
Rylan Polster
9ff4bab171
Fix tab info test 2024-07-15 13:31:39 -04:00
Rylan Polster
8b0a4a98bf
Restrict direct url installs to the file:// scheme 2024-07-13 13:30:36 -04:00
Mike McQuaid
f39b5c1426
Merge pull request #17554 from Homebrew/cask-install-receipt 2024-07-13 10:55:06 -04:00
Rylan Polster
fec84544a9
Remove arch and macos dependencies from cask tab 2024-07-10 11:25:05 -04:00
Rylan Polster
d17da89382
Include recursive dependencies in cask tabs 2024-07-09 15:25:57 -04:00
Rylan Polster
119e02ceb0
Cleanup tap_git_head and uninstall_flight_blocks?
Co-authored-by: Kevin <apainintheneck@gmail.com>
2024-07-09 13:22:00 -04:00
Rylan Polster
dd510a5606
Improve test coverage 2024-07-05 10:47:05 -04:00
Rylan Polster
e176159b23
Fix test 2024-07-04 12:27:45 -04:00
Rylan Polster
46cb7f2847
Update tests 2024-07-04 01:47:14 -04:00
Rylan Polster
c16a9b33b2
Use cached json API file for formulae and cask specified paths 2024-07-03 13:41:52 -04:00
apainintheneck
16e605e056 Load tap migration renames from API with short names
This is a follow-up to 484498e. I added loading for tap migration
renames from the API but it apparently only worked for full names.

There was a bug in both the code and the tests which prevented
loading by short names. This fixes those bugs so everything should
be good now.
2024-07-01 18:53:31 -07:00