50 Commits

Author SHA1 Message Date
Sean Molenaar
55b07d7fed feat: add cask shell completion 2025-03-05 20:12:18 +01: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
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
Douglas Eichelberger
3a4243742f Remove OpenStruct from CLI::Args 2024-12-08 10:27:49 -08:00
Issy Long
f923ac574f
sorbet: Bump some Cask files to typed: strict 2024-11-26 00:25:06 +00:00
hyuraku
9069d42550 remove Cask::Config.explicit_s 2024-10-30 21:08:17 +09:00
Issy Long
45978435e7
rubocop: Use Sorbet/StrictSigil as it's better than comments
- Previously I thought that comments were fine to discourage people from
  wasting their time trying to bump things that used `undef` that Sorbet
  didn't support. But RuboCop is better at this since it'll complain if
  the comments are unnecessary.

- Suggested in https://github.com/Homebrew/brew/pull/18018#issuecomment-2283369501.

- I've gone for a mixture of `rubocop:disable` for the files that can't
  be `typed: strict` (use of undef, required before everything else, etc)
  and `rubocop:todo` for everything else that should be tried to make
  strictly typed. There's no functional difference between the two as
  `rubocop:todo` is `rubocop:disable` with a different name.

- And I entirely disabled the cop for the docs/ directory since
  `typed: strict` isn't going to gain us anything for some Markdown
  linting config files.

- This means that now it's easier to track what needs to be done rather
  than relying on checklists of files in our big Sorbet issue:

```shell
$ git grep 'typed: true # rubocop:todo Sorbet/StrictSigil' | wc -l
    268
```

- And this is confirmed working for new files:

```shell
$ git status
On branch use-rubocop-for-sorbet-strict-sigils
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Library/Homebrew/bad.rb
        Library/Homebrew/good.rb

nothing added to commit but untracked files present (use "git add" to track)

$ brew style
Offenses:

bad.rb:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true.
^^^^^^^^^^^^^

1340 files inspected, 1 offense detected
```
2024-08-12 15:24:27 +01:00
Douglas Eichelberger
179419d8bc rm unnecessary casts 2024-05-31 15:49:12 -07:00
Mike McQuaid
5ad4e6e293
Merge pull request #17128 from reitermarkus/docs-api-public
Explicitly mark non-private APIs.
2024-04-23 08:28:27 +01:00
Markus Reiter
4b432c7ea4
Explicitly mark non-private APIs. 2024-04-22 21:16:49 +02:00
Douglas Eichelberger
7bfa552702 Individually namespace args for each command 2024-04-21 16:51:31 -07:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Douglas Eichelberger
f6c7eb7124 Add hash/keys to extend/ 2024-01-19 13:36:17 -08:00
Douglas Eichelberger
0191af7899 resolve typecheck errors 2023-11-05 08:55:58 -08:00
Douglas Eichelberger
368dd4d949 Fix other to_json override while we're here 2023-07-18 11:30:46 -07:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Markus Reiter
3da305fa80
Add keyboard_layout stanza. 2023-03-26 08:14:24 +02:00
Mike McQuaid
1e4abe2cc9
Merge pull request #15018 from dduugg/rm-hash-refinement
Use ActiveSupport Hash#assert_valid_keys instead of refinement
2023-03-20 13:48:47 +00:00
Douglas Eichelberger
92b99b3132 Remove misleading upstream.rbi, enable types in on_system 2023-03-19 19:41:46 -07:00
Douglas Eichelberger
4dcd5ac47f Remove HashValidator 2023-03-19 17:37:58 -07:00
Douglas Eichelberger
516c61057b Use ActiveSupport Hash#assert_valid_keys instend of refinement 2023-03-19 17:37:58 -07:00
Bo Anderson
e78665f4f7
Replace ENV["HOME"] with Dir.home 2022-06-17 19:47:57 +01:00
Rylan Polster
2e6b6ab3a2
Fix style 2021-12-24 21:15:21 -05:00
nandahkrishna
d0200e8737
cask/config: fix explicit_s 2021-02-03 13:37:53 +05:30
EricFromCanada
f39fb5d6b2 cask/config: new method for cask.config.explicit as string 2021-02-01 10:44:19 -05:00
Seeker
fbafaff4fe rubocop: require braces for Sorbet sig 2021-01-18 16:52:45 -08:00
Markus Reiter
9922ad382f Ignore invalid keys when reading existing Cask::Config. 2021-01-13 08:30:50 +01:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Markus Reiter
5f005f67cf Refactor global Cask::Config. 2020-10-01 00:57:10 +02:00
Markus Reiter
90ade88996 Document Config. 2020-08-26 03:13:59 +02:00
Markus Reiter
b48bc316e0 Use CLI::Parser for cask commands. 2020-08-13 05:15:15 +02:00
Markus Reiter
8d148b1fbc Remove special-casing of MacOS::languages. 2020-07-22 01:09:14 +02:00
Mike McQuaid
aa81982aba
brew style --fix 2020-06-02 09:49:23 +01:00
Claudia
b8aa808b9d
Make sure DEFAULT_DIRS values are Pathnames
This commit fixes the PR #7417 bug.

The call to `canonicalize` needs to wrap `DEFAULT_DIRS`, not the
other way around. This was mixed up in PR #7417 due to an oversight.
2020-04-27 15:25:28 +02:00
Claudia
dd3267ece0
Add test for JSON-based cask config loader
Previously, the JSON-based cask config loader was untested.
This commit changes the interface to accept a string, making the loader
easier to test. The commit also adds a test.
2020-04-27 14:54:56 +02:00
Claudia
d026cb91e7
Fix cask loading after adding an artifact type
This commit fixes an issue where we added a new global artifact
and then updated a cask to make use of that new artifact.
This caused a number of `brew cask` commands to fail for users
who had the cask installed before the artifact was added.

When loading the definition of an installed cask, we configure it
using a snapshot from install time, e. g. `/usr/local/Caskroom/markdownmdimporter/.metadata/config.json`.

The snapshot looks like this:

```
{
  "default": {
    "appdir": "/Applications",
    "prefpanedir": "/Users/claudia/Library/PreferencePanes",
    "qlplugindir": "/Users/claudia/Library/QuickLook",
    "dictionarydir": "/Users/claudia/Library/Dictionaries",
    "fontdir": "/Users/claudia/Library/Fonts",
    "colorpickerdir": "/Users/claudia/Library/ColorPickers",
    "servicedir": "/Users/claudia/Library/Services",
    "input_methoddir": "/Users/claudia/Library/Input Methods",
    "internet_plugindir": "/Users/claudia/Library/Internet Plug-Ins",
    "audio_unit_plugindir": "/Users/claudia/Library/Audio/Plug-Ins/Components",
    "vst_plugindir": "/Users/claudia/Library/Audio/Plug-Ins/VST",
    "vst3_plugindir": "/Users/claudia/Library/Audio/Plug-Ins/VST3",
    "screen_saverdir": "/Users/claudia/Library/Screen Savers"
  },
  "env": {},
  "explicit": {}
}
```

Note that there is no `mdimporterdir` because the cask was installed
before the artifact was added.

The root cause is that the cask loading code still expects the snapshot
to contain directory configuration for all artifact types.
Since the snapshot never learned about the new artifact type, cask
loading would fail.

The fix applied in this commit is to fall back to the global default
whenever the `default` directory map of a configuration snapshot is
incomplete.

See also:
- https://github.com/Homebrew/brew/pull/7286#issuecomment-613376568
- https://discourse.brew.sh/t/cask-definition-is-invalid-invalid-mdimporter-stanza-key-not-found-mdimporterdir
2020-04-21 18:29:14 +02:00
Dario Vladovic
3a21ca8956
Implement mdimporter cask stanza 2020-04-06 15:24:14 +02:00
Mike McQuaid
dfa22680df
Autofix rubocop checks. 2020-02-19 11:24:12 +00:00
Tim Masliuchenko
3ef5e06943 Add Manpage artifact 2019-10-22 15:21:49 +03:00
Markus Reiter
162be6b411 Don't treat non-directory arguments as paths. 2019-07-09 20:50:01 +02:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Markus Reiter
3bf7e5bce5 Remove Cask::Config#write. 2019-02-15 10:09:14 +01:00
Markus Reiter
bcdb4a3f32 Add Cask::Config::canonicalize. 2019-02-15 10:09:14 +01:00
Markus Reiter
defbf7d74c Don’t ignore other arguments in HOMEBREW_CASK_OPTS. 2019-02-15 10:09:14 +01:00
Markus Reiter
190ff7558a Use saved cask config for reinstall/upgrade/uninstall. 2019-02-15 10:09:14 +01:00
Markus Reiter
fda6e0cab3 Split cask config into three tiers. 2019-02-15 10:09:14 +01:00
Markus Reiter
1e1ce1c471 Save config file for casks. 2019-02-15 10:09:14 +01:00
Markus Reiter
a84a1c63db Rename Hbc module to Cask. 2018-09-06 09:30:52 +02:00
Mike McQuaid
90b3a13909
cask: move cask/lib/hbc/* to cask/*.
Fix the load path, requires and some filenames accordingly.
2018-09-04 09:56:57 +01:00