2265 Commits

Author SHA1 Message Date
Mike McQuaid
b1559f38a0
Add HOMEBREW_UPGRADE_GREEDY_CASKS
A space-separated list of casks. Homebrew will act as if `--greedy`
was passed when upgrading any cask on this list.
2025-02-25 15:34:49 +00:00
Sam Ford
a7cacfff1c
livecheck: refactor HEAD-only formula handling
The existing code for handling a `HEAD`-only formula involves two
return values that can be `nil` but this isn't apparent because the
related methods aren't typed. This adds type signatures to the
methods and updates the livecheck code to account for `nil` return
values (making it clear which methods can return `nil`).

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2025-02-20 22:39:18 -05:00
Douglas Eichelberger
cf635bc28a
Merge pull request #19314 from Homebrew/typed-dep-helpers
Enable strict typing in DependenciesHelpers
2025-02-18 18:47:06 +00:00
Douglas Eichelberger
8763fb6d29 Resolve rubocop violations 2025-02-17 18:56:31 -08:00
Sean Molenaar
22ed703c2b fix: use bottle naming for sha256
Signed-off-by: Sean Molenaar <smillerdev@me.com>
2025-02-17 14:30:44 +01:00
Rylan Polster
f874603a21 Add implicit macOS dependency to casks without explicit depends_on stanza 2025-02-17 14:30:44 +01:00
Sean Molenaar
a28fde1a8c fix sha256 on linux 2025-02-17 14:30:44 +01:00
Sean Molenaar
27a2d94c48 feat: allow zap on linux 2025-02-17 14:30:44 +01:00
Sean Molenaar
975fe8a83f feat: allow cask binaries on linux 2025-02-17 14:30:43 +01:00
Sean Molenaar
b2ca64b207 feat: allow linux blocks in casks 2025-02-17 14:27:38 +01:00
Douglas Eichelberger
0037b1f626 Enable strict typing in DependenciesHelpers 2025-02-16 12:24:22 -08:00
zyoshoka
20e33166e1
cask/url: remove arch placeholder when checking if unversioned
This prevents casks whose `url` contains only `#{arch}` from passing
`audit_sha256_no_check_if_unversioned`.
2025-02-14 15:14:40 +09:00
Douglas Eichelberger
d8c790dddc Use delegation to create Cask DSL methods 2025-02-11 08:33:04 -08:00
apainintheneck
042d6cc97e Remove JSON v3 cask logic 2025-02-05 23:32:32 -08:00
Mike McQuaid
e227663207
cask/artifact/installer: don't reset uid if sudo is used.
This fixes handling `sudo` and EUID when using certain `script` commands
on casks e.g. adobe-creative-cloud.

Co-Authored-By: Bo Anderson <mail@boanderson.me>
2025-02-03 16:58:44 +01:00
Kristján Oddsson
3b0794a884 implement fixes and comments for DisableComment rubocop 2025-01-29 09:17:11 +00:00
Mike McQuaid
7ff99e2353
Use ~ instead of ${HOME}
Partial revert of Homebrew/brew#19153
See https://github.com/Homebrew/brew/pull/19153#discussion_r1930678587
2025-01-27 15:19:59 +00:00
Mike McQuaid
bbf5a9f479
env_config: use environment variables consistently
- use e.g. `$HOMEBREW_*` for cases where only the environment variable
  is the entire backtick-quoted string
- use e.g. `${HOMEBREW_*}` for cases where the environment variable is
  part of a backtick-quoted string to make clear what parts are variable
  and what parts are not
- use `export HOMEBREW_*=...` for cases where we're talking about
  setting the environment variable (because it likely needs to be
  exported to work how they want)

Inspired by https://github.com/Homebrew/homebrew-bundle/pull/1579 making
similar changes for Homebrew/homebrew-bundle.
2025-01-27 14:21:27 +00:00
Ilya Kulakov
730a3de1b9 sudo: Elevate priviliges before adding metadata after relocating a cask, if necessary
Homebrew cannot assume that target location is writable for chmod and xattr.
2025-01-20 14:35:36 -08:00
Sean Molenaar
c34b71655c feat: allow font install on linux
Apply suggestions from code review

Co-authored-by: Douglas Eichelberger <697964+dduugg@users.noreply.github.com>

feat: add linux appdir

Apply suggestions from code review

Co-authored-by: Douglas Eichelberger <697964+dduugg@users.noreply.github.com>
2025-01-19 11:14:24 +01:00
Sam Ford
cf22382921
Curl: use typed: strict
This upgrades `utils/curl.rb` to `typed: strict`, which requires
a number of changes to pass `brew typecheck`. The most
straightforward are adding type signatures to methods, adding type
annotations (e.g., `T.let`) to variables that need them, and ensuring
that methods always use the expected return type.

I had to refactor areas where we call a `Utils::Curl` method and use
array destructuring on a `SystemCommand::Result` return value
(e.g., `output, errors, status = curl_output(...)`), as Sorbet
doesn't understand implicit array conversion. As suggested by Markus,
I've switched these areas to use `#stdout`, `#stderr`, and `#status`.
This requires the use of an intermediate variable (`result`) in some
cases but this was a fairly straightforward substitution.

I also had to refactor how `Cask::URL::BlockDSL::PageWithURL` works.
It currently uses `page.extend PageWithURL` to add a `url` attribute
but this reworks it to subclass `SimpleDelegator` and use an
`initialize` method instead. This achieves the same goal but in a way
that Sorbet can understand.
2025-01-14 08:14:39 -05:00
Mike McQuaid
93a9776e34
cask/cask: ensure plist is readable before reading.
If we don't have permissions to read it, this will raise an exception
even although this whole call chain is very tolerant of nil values.
2025-01-14 08:52:20 +00:00
Issy Long
6ada9a9665
Add clarifying comments to rubocop:disables
- Needed for PR 18842 that adds a `DisableComment` RuboCop to ensure that all RuboCop disables have comments.
2025-01-12 16:59:07 +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
Michael Cho
21f35368eb
deprecate_disable: typed: strict 2024-12-20 13:33:16 -05:00
Sean Molenaar
cb23433612
feat: only block cask install on Linux 2024-12-14 15:49:09 +01:00
apainintheneck
9c0987c71c cask/info: update tests 2024-12-12 00:01:30 -08:00
apainintheneck
8bee0555b9 cask/info: send missing args after removing openstruct
This seems like it was a bug before the recent change to remove
OpenStruct from `Homebrew::CLI::Args` but it was failing silently
before. Now we pass the args to the `Cask::Info.info` method so
that when they eventually reach the `Utils::Analytics.output_analytics`
method they are present as expected.

Example error fragment:

```console
$ set -e HOMEBREW_NO_ANALYTICS
$ brew info iterm2 --cask --verbose
==> iterm2: 3.5.10 (auto_updates)
https://iterm2.com/
Installed
/usr/local/Caskroom/iterm2/3.5.4 (91.7MB)
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/i/iterm2.rb
==> Name
iTerm2
==> Description
Terminal emulator as alternative to Apple's Terminal app
==> Artifacts
iTerm.app (App)
Error: undefined method `analytics?' for an instance of Homebrew::CLI::Args
/usr/local/Homebrew/Library/Homebrew/utils/analytics.rb:248:in `output_analytics'
/usr/local/Homebrew/Library/Homebrew/utils/analytics.rb:342:in `cask_output'
/usr/local/Homebrew/Library/Homebrew/cask/info.rb:39:in `info'
```
2024-12-11 23:24:22 -08:00
Douglas Eichelberger
9e3e1e1847 Namespace some top-level constants 2024-12-11 11:04:55 -08:00
Douglas Eichelberger
69f2d3bf32
Merge branch 'master' into no-ostruct 2024-12-10 11:00:32 -08:00
apainintheneck
ebede56314 cask/artifact/abstract_uninstall: handle sudo trashed paths correctly
This showed a confusing message when the trash path was able to be
deleted using sudo since the untrashable array was updated but
the check was higher up for returning early.

```
==> Trashing files:
/Users/Shared/Maxon
/Users/Shared/Red Giant
~/Library/Application Support/Maxon
~/Library/Application Support/Red Giant
~/Library/Caches/net.maxon.app-manager
~/Library/Preferences/Maxon
~/Library/Preferences/net.maxon.app-manager.plist
~/Library/Saved Application State/net.maxon.app-manager.savedState
==> Using sudo to gain ownership of path '/Users/Shared/Maxon'
==> Using sudo to gain ownership of path '/Users/Shared/Red Giant'
Warning: The following files could not be trashed, please do so manually:
==> Removing all staged versions of Cask 'maxon'
```

The warning about files not getting trashed should only be shown if
some files didn't get trashed.

Fixes https://github.com/Homebrew/brew/issues/18901
2024-12-08 15:53:59 -08:00
Douglas Eichelberger
3a4243742f Remove OpenStruct from CLI::Args 2024-12-08 10:27:49 -08:00
Sam Ford
01cb74e525
livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.

In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.

With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
2024-12-02 10:13:03 -05:00
Patrick Linnane
d04430d1a5
brew style --fix
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-11-26 14:09:13 -08:00
Issy Long
6fb9d2d2f4
Merge pull request #18824 from Homebrew/bump-cask-files-to-sorbet-strict 2024-11-26 10:03:57 +00:00
Issy Long
f923ac574f
sorbet: Bump some Cask files to typed: strict 2024-11-26 00:25:06 +00:00
Bo Anderson
7308c105a4
cask: try fix a couple of permission edge cases under multi-user 2024-11-25 17:36:47 +00:00
Caleb Xu
215fc85579
deprecate_disable: support optional replacement parameter 2024-11-08 15:49:00 -05:00
Douglas Eichelberger
a2612e23dc
Apply suggestions from code review
Co-authored-by: Kevin <apainintheneck@gmail.com>
2024-11-05 16:44:12 +00:00
Douglas Eichelberger
521c463e36
Manually resolve Style/SafeNavigationChainLength violations 2024-11-05 16:44:12 +00:00
Douglas Eichelberger
ffb15ffcf5
brew style --fix 2024-11-05 16:44:12 +00:00
hyuraku
9069d42550 remove Cask::Config.explicit_s 2024-10-30 21:08:17 +09:00
Douglas Eichelberger
ced4a3a91f Migrate Parlour extensions to Tapioca compilers 2024-10-14 19:50:09 -07:00
Mike McQuaid
d1e539cb84
Merge pull request #18547 from Homebrew/cask-formula-dep-preinstall
Perform preinstall checks when a formula is installed via a cask
2024-10-13 17:40:59 +01:00
Bo Anderson
97866f8adf
Perform preinstall checks when a formula is installed via a cask 2024-10-11 16:57:47 +01:00
Bevan Kay
69f04bc069
cask/cask: pass args when initialising dsl 2024-10-10 10:36:44 +11:00
Douglas Eichelberger
8033fcf4a6 Fix brew style docs 2024-10-07 18:59:27 -07:00
Douglas Eichelberger
1a1795fa9c
Merge pull request #18521 from Homebrew/runtime-req-ans
Use requires_ancestor consistently
2024-10-07 07:41:03 -07:00
Douglas Eichelberger
69941c0c73
Merge pull request #18520 from Homebrew/delegator-compiler
Add a Delegator DSL compiler
2024-10-07 07:38:53 -07:00
Issy Long
28349370d3
Bump more files to Sorbet typed: strict 2024-10-06 20:04:42 +01:00