5628 Commits

Author SHA1 Message Date
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
Markus Reiter
c5a877d7db
Simplify test. 2024-02-14 20:28:07 +01:00
Markus Reiter
4641690674
Refactor Formulary::loader_for. 2024-02-14 20:28:06 +01:00
Markus Reiter
228ebe0c32
Add tests for formula migration warnings to default tap. 2024-02-13 21:27:36 +01:00
Markus Reiter
c8058a3859
Add tests for cask migrations to default tap. 2024-02-13 21:27:36 +01:00
Markus Reiter
7f369c500b
Merge pull request #16648 from reitermarkus/tap-migrations-rename
Allow tap migrations with renames.
2024-02-13 19:26:51 +01:00
Markus Reiter
3472362ddd
Don't stub all Pathnames in tests. 2024-02-13 18:46:58 +01:00
Markus Reiter
27189f4aba
Fix stubbing casks in tests. 2024-02-13 18:44:00 +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
Mike McQuaid
8e3bcd3e62
Merge pull request #16620 from samford/livecheck/add-crate-strategy
Livecheck: Add Crate strategy
2024-02-12 15:32:08 +00:00
Mike McQuaid
599db8cc95
Merge pull request #16642 from dduugg/rubocop-rspec-paths
Include all test paths in RSpec cops
2024-02-12 14:48:25 +00:00
Douglas Eichelberger
12d32cc69e Manual fixes 2024-02-11 20:13:24 -08:00
Sam Ford
98f3258ff4
Livecheck: Add Crate strategy
We discussed the idea of adding a livecheck strategy to check crate
versions years ago but decided to put it off because it would have
only applied to one formula at the time (and it wasn't clear that a
crate was necessary in that case). We now have a few formulae that
use a crate in the `stable` URL (`cargo-llvm-cov`, `pngquant`,
`oakc`) and another formula with a crate resource (`deno`), so
there's some value to the idea now.

I established a standard approach for checking crate versions in a
somewhat recent `pngquant` `livecheck` block update and this commit
reworks it into a strategy, so we won't have to duplicate that
`livecheck` block in these cases. With this strategy, we usually
won't even need a `livecheck` block at all.

Under normal circumstances, a regex and/or strategy block shouldn't
be necessary but the strategy supports them when needed. The response
from the crates.io API is a JSON object, so this uses
`Json#versions_from_content` internally and a `strategy` block will
receive the parsed `json` object and a regex (the strategy default or
the regex from the `livecheck` block).
2024-02-11 21:53:21 -05:00
Douglas Eichelberger
2be13eb715 brew style --fix 2024-02-11 14:35:42 -08:00
apainintheneck
70ffc31338 formulary: update logic and add regression test 2024-02-11 13:09:53 -08:00
Kevin
6797edf425
Merge pull request #16632 from reitermarkus/simplify-tests
Simplify tests.
2024-02-10 10:29:31 -08:00