5593 Commits

Author SHA1 Message Date
Mike McQuaid
026ca68c5c
Merge pull request #16834 from reitermarkus/tap-new-private
Make `Tap::new` private.
2024-03-06 15:33:25 +00:00
Mike McQuaid
83c94df40d
Merge pull request #16832 from reitermarkus/tap-sig-fetch
Add type signature for `Tap::fetch`.
2024-03-06 15:32:45 +00:00
Markus Reiter
e3a102efd4
Make Tap::new private. 2024-03-06 15:10:14 +01:00
Markus Reiter
a851bb86ef
Add type signature for Tap::fetch. 2024-03-06 14:30:17 +01:00
Justin Klaassen
009ddd7036
dev-cmd/bump: add --tap= flag 2024-03-05 18:11:53 -08:00
Mike McQuaid
c5e7282985
Merge pull request #16807 from dduugg/numbered-params
Prefer numbered block params over proc conversion
2024-03-04 16:38:14 +00:00
Markus Reiter
e369689794
Add test for Tap#custom_remote?. 2024-03-04 15:32:27 +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
3da0f8c4a6
Fix loading casks/formulae from relative paths. 2024-03-01 04:05:15 +01:00
apainintheneck
cd5b93a2f2 internal json v3: parse ruby source checksum correctly
Currently we are including this in the API but not actually
parsing and loading it correctly from the JSON. I think this
was an oversight when addressing feedback and refactoring
the JSON shape. Not a big deal, of course, because I'm the
only person using it right now.

I found this out while testing installs using the API and I got
this error while running `brew reinstall tree`.

```
Warning: Cannot verify integrity of '60fc4212023d3fef00e6de4b9f3f0d63402cf3eca00778d09f4f2d3481b524a1--tree.rb'.
No checksum was provided.
```
2024-02-28 21:34:31 -08:00
Mike McQuaid
99c101bfc1
internal_tap_json/formula_spec: add comment. 2024-02-28 10:49:36 +00:00
apainintheneck
f1f2e24aec test fixture: pretty print JSON for readability 2024-02-27 20:55:16 -08:00
apainintheneck
bfe5e43ff4 api/formula: Fix failing specs
- clear the formula API cache
- make the API cache directory
- fix stubbed return values (thanks Sorbet!)
2024-02-27 20:55:16 -08:00
apainintheneck
200fe2a6b7 api/formula: Add tests for internal JSON v3
These tests cover both generating and loading formulae from the JSON
bundle. The tests are not comprehensive but they do provide a nice
sanity check that things are working as expected.
2024-02-27 20:55:16 -08:00
apainintheneck
f2c5f6723c test: clear tap instance caches between test runs again
The core taps exist outside of the normal cache busting cycle
so they need to clear explicitly at the instance level.
Just to be sure we should clear all of them each time.

This essentially reverts part of the change in this PR.
- https://github.com/Homebrew/brew/pull/16746
2024-02-27 19:35:30 -08:00
Markus Reiter
18571e8991
Merge pull request #16732 from reitermarkus/repo-var-suffix
Rename `Tap#repo_var` to `Tap#repo_var_suffix`.
2024-02-27 11:26:16 +01:00
Mike McQuaid
ca9405de5c
Merge pull request #16746 from apainintheneck/simplify-cache-clearing-in-tests
cachable: make sure to clear caches between tests
2024-02-27 08:35:38 +00:00
apainintheneck
5cc1c85a5f cachable: Move registry to test directory
Now we only include the cachable registry when running tests.
We basically just load it first and add a bunch of methods to
it before loading the rest of the formula files when we require
global.rb. I added a check to make sure this require order is
preserved.

I also made a bunch of methods private, stop excluding classes
that inherit from casks since it's unnecessary and add more docs.
2024-02-26 20:41:10 -08:00
apainintheneck
536ae08a44 cachable: make sure to clear caches between tests
This adds a registry for all modules and classes that
cachable is included in. The registry allows us to
programmatically clear all caches in between tests
so that we don't forget to do that when adding a new
class or refactoring code. The goal here is to reduce
the number of flaky tests in the future.
2024-02-25 17:47:30 -08:00
Issy Long
f4218a6316
Fix RuboCop Performance/MapCompact offenses
- Rename an iterator variable since it would make the line too long.
2024-02-25 22:59:59 +00:00
Markus Reiter
132a87aff5
Rename Tap#repo_var to Tap#repo_var_suffix. 2024-02-23 16:02:29 +01:00
Markus Reiter
96f861e947
Merge pull request #16729 from reitermarkus/warn-from-name-loader
Pass `warn` in `FromNameLoader`.
2024-02-23 01:27:55 +01:00
Markus Reiter
0684a16293
Pass warn in FromNameLoader. 2024-02-22 22:12:07 +01:00
Markus Reiter
ed07203f9e
Fix tap constants. 2024-02-22 22:03:54 +01:00
Markus Reiter
e0743a1436
Reapply "Refactor Formulary::loader_for."
This reverts commit 24683525cb5abf3cc79a9e0e268fa6efd0af558b.
2024-02-22 18:24:57 +01:00
Markus Reiter
9cfc7ef9bd
Clear all tap caches before each test. 2024-02-22 17:56:47 +01:00
Mike McQuaid
b8243d0e9e
Merge pull request #16717 from jesboat/fix-chmod-message2
[brew audit] fix "Incorrect file permissions" message
2024-02-22 08:51:52 +00:00
Issy Long
a895496982
rubocop: The pyyaml resource requires depends_on "libyaml" 2024-02-20 23:22:15 +00:00
Jade Elizabeth Sailor
94aeabfc8a [brew audit] fix "Incorrect file permissions" message
When the file isn't world-readable, `brew audit` prints a failure
message including a suggestion to `chmod +r` the file. Unfortunately,
this isn't quite right: with both macOS and coreutils, leaving out the
"who" in a chmod only affects bits which would be set in the umask. So,
if the umask doesn't allow world-readable (which might be why the file
wasn't world-readable in the first place), the suggested chmod command
does nothing.

Change to print `chmod a+r` instead; that does have the intended effect.

No other `chmod` suggestions in this file have the same problem.
2024-02-20 16:26:21 -05:00
Mike McQuaid
14ba271533
Merge pull request #16705 from issyl0/lxml-resource-needs-uses-from-macos
rubocop: Formulae with the "lxml" resource have required dependencies
2024-02-20 12:54:19 +00:00
Issy Long
ff23de4766
Formatting and cope with more modern RSpec config changes
Co-authored-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2024-02-20 12:17:27 +00:00
Issy Long
33c33b5338
rubocop: Formulae with the "lxml" resource have required dependencies
- We're moving from `depends_on "python-lxml"` to `resource "lxml" ...` as part
  of the new Python vendoring plan.
- For `resource "lxml"` to work, `uses_from_macos "libxml2"` and
  `uses_from_macos "libxslt"` are needed in the formulae.
- This new RuboCop rule enforces that a formula including the "lxml" resource
  also include those dependencies.
2024-02-19 22:50:55 +00:00
Douglas Eichelberger
e7e4ecc405 Change return type 2024-02-19 13:29:49 -08:00
Douglas Eichelberger
ab62a717b9
Merge pull request #16407 from dduugg/default-prefixes
Remove redirection for default prefixes
2024-02-19 09:48:26 -08:00
Douglas Eichelberger
c2e48ec79c Extract find_files to helper 2024-02-19 08:28:12 -08:00
Douglas Eichelberger
d97645977f Fix rebase test failure 2024-02-19 08:27:59 -08: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
Douglas Eichelberger
d6b3f5031a
Enable and fix warnings 2024-02-19 13:57:27 +00:00
Mike McQuaid
8bb2787dd9
Merge pull request #16691 from dduugg/tapioca-config
Move tapioca args to config; exclude unnecessary gems
2024-02-19 13:54:04 +00:00
apainintheneck
e96313f6ed formulary_spec: update API tests to avoid mocking
Stop mocking the formulary loader method. We just need to set the
environment variable so that it knows to load things from the API.

Fix spec that doesn't work with the `CoreTap.formula_names`.
That method assumes that we always have a valid `ruby_source_path`
in the API JSON even though that was optional for a while after
launching the API if my memory serves me. It's probably fine
to assume this should always be set though and I changed it to use
`Hash#fetch` to give use better error messages if something goes wrong in the future.

Remove unused `allow(x).to receive(y).and_call_original` in tap spec.
2024-02-17 13:00:50 -08:00
Douglas Eichelberger
89b5914c86 Add test that are exclusions are active dependencies 2024-02-17 10:07:58 -08:00
Markus Reiter
a6a6a74c48
Fix API::tap_from_source_download for relative paths. 2024-02-16 23:36:09 +01:00
Mike McQuaid
24683525cb
Revert "Refactor Formulary::loader_for." 2024-02-16 13:41:54 +00:00
Markus Reiter
a6d539cf11
Merge pull request #16680 from reitermarkus/loader-infinite-recursion
Fix flaky `Formulary` test.
2024-02-16 10:58:56 +01:00
Markus Reiter
adbd11a0db
Fix flaky tests. 2024-02-16 10:49:32 +01:00
Markus Reiter
ad1d50e64a
Clear tap cache after setting up test formula. 2024-02-16 10:44:01 +01:00
Markus Reiter
18150d9629
Demonstrate flaky tests. 2024-02-16 10:39:21 +01:00