663 Commits

Author SHA1 Message Date
Kevin
c44e053847
Merge pull request #17242 from Homebrew/fix-cask-source-file-path-loading-issues
Fix cask source file path loading issues
2024-05-08 18:28:04 -07:00
apainintheneck
ffc503f1d0 Fix cask source file path loading issues
There are two big changes here. Both have to do with how we want
to load casks in different scenarios. One also is related to formulae.

1. Prevent loading casks & formulae outside of taps for specific commands.

There are certain commands like `bump`, `bump-*-pr`, `livecheck` and `audit`
where it really makes no sense to try and run things if the specified formulae
or cask is not in a tap. A new `#to_formulae_and_casks_with_taps` method was
added to the `CLI::NamedArgs` class to allow us to easily grab and validate
formulae and casks from named arguments.

2. Always load the source file path when loading casks with the path loader.

There was an edge case where all JSON cask files were being loaded without
setting the source file path because most of the work was handed off to the
API loader where that normally would make more sense. Now we set that when
calling the API loader which solves the problem. This improves the user
experience of people using the `--cache` and `fetch` commands in certain
edge cases. Hopefully it makes the user experience a bit more consistent.

A regression test was added for this point.
2024-05-06 23:34:23 -07:00
Carlo Cabrera
be29afa5f7
Fix brew style 2024-05-06 15:26:29 +01:00
Carlo Cabrera
3b794fc6e8
formula_installer, cask/installer: add tests for HOMEBREW_ALLOWED_TAPS 2024-05-06 15:22:48 +01:00
Carlo Cabrera
34387bfc8a
cask/installer: update to match formula_installer 2024-05-05 14:00:02 +01:00
Patrick Linnane
7fe4d2e42f
various: remove remaining Homebrew/cask-versions references
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-05-02 15:29:21 -07:00
Razvan Azamfirei
0b0fcdcdd2
homebrew/cask-versions: remove 2024-05-02 16:59:33 -04:00
Markus Reiter
480e264d9a
Lint Ruby docs. 2024-05-01 11:35:21 +02:00
Markus Reiter
caf87c0336
Warn about undocumented non-private APIs. 2024-05-01 11:35:20 +02:00
Mike McQuaid
1474806527
Add more HOMEBREW_FORBIDDEN_* configuration
We already had `HOMEBREW_FORBIDDEN_LICENSES` but this commit adds
`HOMEBREW_FORBIDDEN_CASKS`, `HOMEBREW_FORBIDDEN_FORMULAE` and
`HOMEBREW_FORBIDDEN_TAPS` for also forbidding those.

Relatedly, add `HOMEBREW_FORBIDDEN_OWNER` and
`HOMEBREW_FORBIDDEN_OWNER_CONTACT` to allow customising these
messages.

There were no existing tests for `HOMEBREW_FORBIDDEN_LICENSES` so have
added more tests for all of these checks.

Co-authored-by: Bo Anderson <mail@boanderson.me>
2024-04-08 16:38:32 +01:00
Douglas Eichelberger
f664433b5c Enable RSpec/DescribeClass 2024-04-03 09:12:47 -07:00
Mike McQuaid
7e35ae25d5
cask/utils: quieten down when fixing permissions fails.
When fixing permissions fails, we should not print the error messages
from e.g. `chmod` unless we are in debug or verbose mode (because we
immediately retry taking ownership `sudo`).
2024-04-01 16:22:42 +01:00
Douglas Eichelberger
03b815df82 Enable and fix RSpec/DescribedClassModuleWrapping 2024-03-30 11:29:34 -07:00
Kevin
7b2bfee363
Merge pull request #16903 from apainintheneck/prevent-unexpected-network-calls-in-tests
Prevent unexpected network calls in tests
2024-03-20 20:40:26 -07:00
apainintheneck
74aea8e92d spec_helper: add :no_api test scope
This sets the HOMEBREW_NO_INSTALL_FROM_API environment variable
to prevent the selected tests from using the API. We will need
this as we transition to having the API be enabled by default
when running the tests but it's also nice as a sanity check
with the :needs_utils_curl scope in a few places.
2024-03-19 22:18:02 -07:00
Bo Anderson
326bc3f889
Fix cask source checksum handling 2024-03-19 21:21:37 +00:00
apainintheneck
ad35db4b24 tests: fix tests that make unexpected network calls
These were found with the Utils::Curl check and just turning
off the network on my computer and running the entire test suite.
2024-03-18 20:57:35 -07:00
apainintheneck
b66097fa3d spec_helper: add check for unexpected network calls
Any test that is not tagged as :needs_network and that makes
a call to an unapproved method in the `Utils::Curl` module
will raise an error unless that method gets mocked somehow.

tests: add exceptions for tests that use curl to download local files

These are acceptable ways to use curl in local, non-network tests.
For those edge cases we allow you to bypass the check with :needs_utils_curl.
2024-03-18 20:57:23 -07:00
Bo Anderson
011dfc8f45
cask/artifact/moved: fix permission handling when removing directories 2024-03-15 21:31:37 +00:00
Michael Cho
85a08bcdc4
cask/audit: allow @ for versioned casks
Signed-off-by: Michael Cho <michael@michaelcho.dev>
2024-03-09 12:20:27 -05:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Markus Reiter
a24da6b072
Remove FromDefaultNameLoader to avoid warning twice. 2024-03-06 23:14:28 +01:00
Douglas Eichelberger
c4db19232d git grep -lE '\(\&[A-Za-z._]+method\(:' | xargs gsed -i -E 's|\(\&([A-Za-z._]+)method\(:([a-z?_]+)\)\)| { \1\2(_1) }|g' 2024-03-03 18:55:56 -08:00
Markus Reiter
9cfc7ef9bd
Clear all tap caches before each test. 2024-02-22 17:56:47 +01:00
Douglas Eichelberger
d7ebf97467
Turn on disable_monkey_patching 2024-02-19 13:57:28 +00:00
Douglas Eichelberger
ab8f5702ac
git grep -l '^shared_examples' | xargs gsed -i 's|^shared_examples|RSpec.shared_examples|g' 2024-02-19 13:57:28 +00:00
Douglas Eichelberger
26eda5a303
git grep -l '^describe' | xargs gsed -i 's|^describe|RSpec.describe|g' 2024-02-19 13:57:27 +00:00
Douglas Eichelberger
2255b9d43d
Enable verify_partial_doubles 2024-02-19 13:57:27 +00:00
Markus Reiter
adbd11a0db
Fix flaky tests. 2024-02-16 10:49:32 +01:00
Markus Reiter
18150d9629
Demonstrate flaky tests. 2024-02-16 10:39:21 +01:00
Markus Reiter
c8058a3859
Add tests for cask migrations to default tap. 2024-02-13 21:27:36 +01:00
Mike McQuaid
0b04a7bdfc
test/cask/upgrade_spec: remove flaky specs.
BuildPulse (and my interactions with CI on this repository) have shown
this tests to be very flaky. Flaky tests are not useful tests so let's
just delete them and they can be re-added if fixed in future.
2024-02-13 09:38:04 +00:00
Douglas Eichelberger
12d32cc69e Manual fixes 2024-02-11 20:13:24 -08:00
Douglas Eichelberger
2be13eb715 brew style --fix 2024-02-11 14:35:42 -08:00
Kevin
6797edf425
Merge pull request #16632 from reitermarkus/simplify-tests
Simplify tests.
2024-02-10 10:29:31 -08:00
Markus Reiter
d42f419217
Don't use slashes when loading casks in tests. 2024-02-09 23:17:25 +01:00
Markus Reiter
d9263196a2
Never link outdated cask fixtures. 2024-02-09 22:04:26 +01:00
Markus Reiter
55b4db3f43
Use before instead of let!. 2024-02-09 22:03:13 +01:00
Markus Reiter
a04dd7b547
Deduplicate before blocks. 2024-02-09 22:03:05 +01:00
Markus Reiter
4d8b3784db
Remove unnecessary to_s. 2024-02-09 22:02:00 +01:00
Markus Reiter
889854b0b3
Merge FromTapPathLoader into FromPathLoader. 2024-02-08 16:20:32 +01:00
Markus Reiter
889c3c38ed
Refactor CaskLoader::for. 2024-02-07 02:02:02 +01:00
Markus Reiter
e5a6f765da
Revert "Merge pull request #16608 from bevanjkay/revert-16596-cask-rename-migrations"
This reverts commit 5799e8541567385c4d729cc3f0062b45e55b9936, reversing
changes made to 677517132782b276ba1c4ba77456adf7540d99ba.
2024-02-07 02:02:02 +01:00
Bevan Kay
f0b8845ad6
Revert "Handle tap migrations in CaskLoader." 2024-02-06 20:16:03 +00:00
Markus Reiter
0fa503b827
Test CaskLoader::for with both short and full tokens. 2024-02-06 20:20:39 +01:00
Markus Reiter
094761dcd9
Add tests for CaskLoader::for. 2024-02-06 19:56:09 +01:00
Bevan Kay
bd6ab1d2b8
cask/uninstall: skip quit and signal directives when upgrading or reinstalling 2024-01-19 23:30:25 +11:00
Patrick Linnane
50b0940c72
various: fix future tense in tests
Co-authored-by: Bo Anderson <mail@boanderson.me>
2024-01-08 18:41:30 +00:00
Douglas Eichelberger
caf8259ae6 Code review changes 2023-12-27 15:29:33 -08:00
Douglas Eichelberger
3abbf4447e Some minor regexp match perf improvements 2023-12-27 13:16:36 -08:00