2402 Commits

Author SHA1 Message Date
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
Douglas Eichelberger
d3d25beb35 Use requires_ancestor consistently 2024-10-06 09:25:57 -07:00
Douglas Eichelberger
6eaf122144 Add a Delegator DSL compiler 2024-10-05 19:36:54 -07:00
Patrick Linnane
c2e2b23c50
brew style --fix
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-10-02 10:03:12 -07:00
Bevan Kay
4a6644650a
cask/audit: audit deprecate/disable reasons 2024-09-30 23:11:44 +10:00
Carlo Cabrera
fe1f330e60
Revert "Deprecate installing casks/formulae from paths." 2024-09-27 10:17:04 +08: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
20444638f3 modifies logic to only compare versions if auto_updates is false 2024-09-26 13:41:22 +02: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
Douglas Eichelberger
eeb31d3050 Fix violations 2024-09-20 11:07:00 -07:00
Rylan Polster
b1db0ee290
Rename load method when preferring installed casks 2024-09-10 13:54:12 -04:00