5284 Commits

Author SHA1 Message Date
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
Kevin
0782ba112c
Merge pull request #16581 from bevanjkay/shared_filelist_cop
rubocops/cask: add a cop for specific numbered shared file list files
2024-02-10 10:13:38 -08:00
Markus Reiter
d1fa91cd78
Clear tap caches after linking cask fixtures. 2024-02-09 23:37:11 +01: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
Kevin
d94772171f
Merge pull request #16541 from apainintheneck/next-gen-api-formula-json-v3
Next gen api formula json v3
2024-02-04 11:16:01 -08:00
Eric Knibbe
7698cf2098
audit: messaging improvements 2024-02-04 15:10:14 +01:00
Bevan Kay
2b60576165
rubocops/cask: add a cop for specific numbered shared file list files 2024-02-04 14:13:06 +01:00
apainintheneck
3c503cdf56
Normalize service serialization method names 2024-02-04 13:50:57 +01:00
Douglas Eichelberger
eb7c3e52a0 Require SystemInclude only where needed 2024-01-31 11:42:01 -08:00
Mike McQuaid
3707c90ce1
Merge pull request #16439 from arianf/fix-non-ghcr
Fixes `openjdk_dep_name_if_applicable` when not using `CurlGitHubPackagesDownloadStrategy`
2024-01-31 11:43:28 +00:00
Douglas Eichelberger
3a27cac7df
Merge pull request #16510 from dduugg/inverse-include-exclude-cop
Vendor remaining Rails cops, remove ActiveSupport
2024-01-30 11:59:10 -08:00
Douglas Eichelberger
e00d066d87 Replace Time refinement with Timer Util 2024-01-29 18:50:12 -08:00
Arian Faurtosh
9088cf9be0 Fixes openjdk_dep_name_if_applicable when not using CurlGitHubPackagesDownloadStrategy
When installing a formula, `FormulaInstaller` calls `#pour`, which in turn calls:

6f20c0300a/Library/Homebrew/formula_installer.rb (L1260)

This `tab` is expected to have `#runtime_dependencies`, and it typically will because most packages come from http://ghcr.io

6f20c0300a/Library/Homebrew/utils/bottles.rb (L111)

Any `DownloadStrategy` that does not match `CurlGitHubPackagesDownloadStrategy` will lead here:
6f20c0300a/Library/Homebrew/software_spec.rb (L463)

Causing this branch to be executed for creating the `tab`:
6f20c0300a/Library/Homebrew/utils/bottles.rb (L119)

This causes a slight issue because `openjdk_dep_name_if_applicable` calls `keg.runtime_dependencies` when it's still `nil`.

6f20c0300a/Library/Homebrew/keg_relocate.rb (L134-L140)

And if it's blank, it won't do the regex replacement on `@@HOMEBREW_JAVA@@`, resulting in the following error when running `Kafka`:

```console
$ tail -f /opt/homebrew/var/log/kafka/kafka_output.log
/opt/homebrew/Cellar/kafka/3.6.0/libexec/bin/kafka-run-class.sh: line 346: /opt/homebrew/@@HOMEBREW_JAVA@@/bin/java: No such file or directory
/opt/homebrew/Cellar/kafka/3.6.0/libexec/bin/kafka-run-class.sh: line 346: exec: /opt/homebrew/@@HOMEBREW_JAVA@@/bin/java: cannot execute: No such file or directory
```

As mentioned by: https://github.com/orgs/Homebrew/discussions/2530#discussioncomment-2002374

> Installing Java-dependent formulae from bottle mirrors doesn't work properly at the moment. The issue is that brew needs the manifest in order to correctly replace @@HOMEBREW_JAVA@@ but brew only knows how to fetch manifests from ghcr.io.
> Pull requests to fix this welcome.

This should fix this issue, by getting the `runtime_dependencies` directly from the formula for those cases that it can't get it from https://ghcr.io or tabfile

```ruby
f_runtime_deps = formula.runtime_dependencies(read_from_tab: false)
tab.runtime_dependencies = Tab.runtime_deps_hash(formula, f_runtime_deps)
```
2024-01-29 15:57:55 -08:00
Mike McQuaid
2cb8efc51d
Merge pull request #16377 from razvanazamfirei/rubocop-uninstall-methods-order
rubocop: order uninstall/zap methods
2024-01-29 16:32:24 +00:00
Razvan Azamfirei
82cdf27eb8
fixture/cask: fix style violations 2024-01-28 10:19:39 -05:00
Razvan Azamfirei
7c540dd3c5
rubocop: add uninstall methods order tests
Co-authored-by: Bevan Kay <email@bevankay.me>
2024-01-28 07:08:47 -05:00
Razvan Azamfirei
db72295c20
rubocop: order uninstall methods 2024-01-28 07:08:47 -05:00
Douglas Eichelberger
4b59101549 Resolve type errors 2024-01-26 15:04:00 -08:00
Douglas Eichelberger
ae249ec282 Vendor InverseMethods cop 2024-01-26 15:03:59 -08:00
Douglas Eichelberger
0caaa1fa36 Vendor SafeNavigationWithBlank cop 2024-01-26 15:03:59 -08:00
Douglas Eichelberger
665bda0fbd Vendor Presence cop 2024-01-26 15:03:59 -08:00
Douglas Eichelberger
f99d39faf9 Vendor CompactBlank cop 2024-01-26 15:03:59 -08:00
Douglas Eichelberger
9d081a67cc Replace Rails/NegateInclude with Inverse/Invertible cops 2024-01-26 12:27:50 -08:00
Douglas Eichelberger
36f64d6b30 Enable Style/TopLevelMethodDefinition 2024-01-26 11:37:11 -08:00
Issy Long
a6b8a795b4
Merge pull request #16365 from issyl0/rubocop-cask-zap-arrays-alphabetical
Add a new RuboCop for alphabetizing `zap trash` array elements
2024-01-24 21:34:18 +00:00
Michael Cho
6bc6aae0ca
cmd/upgrade: rename arg to installed_formula/cask
This avoids running `brew outdated` in shell completions, which is
noticeably slow.
2024-01-24 12:45:49 -05:00
Issy Long
693a27d48b
Treat zap and uninstall the same
- Since `zap` can have more than just `trash`.
2024-01-21 19:48:30 +00:00
Mike McQuaid
2ed2b337c2
Merge pull request #16507 from bevanjkay/cask-uninstall-upgrade-skip
cask/uninstall: skip quit/signal directives when upgrading or reinstalling
2024-01-21 19:16:36 +00:00
Issy Long
458844af44
Move multi-line comments with the code they're 'attached' to
Co-authored-by: Bevan J. Kay <email@bevankay.me>
2024-01-21 12:42:22 +00:00
Issy Long
8910d5a479
Remove the single-element array in everything.json used for Cask tests
```
  1) Cask::Cask#to_h when loaded from cask file returns expected hash
     Failure/Error: expect(JSON.pretty_generate(hash)).to eq(expected_json)

Diff:
       @@ -28,9 +28,7 @@
              "uninstall": [
                {
                  "launchctl": "com.every.thing.agent",
       -          "delete": [
       -            "/Library/EverythingHelperTools"
       -          ],
       +          "delete": "/Library/EverythingHelperTools",
                  "kext": "com.every.thing.driver",
                  "signal": [
                    [
       @@ -103,7 +101,7 @@
          ],
          "ruby_source_path": "Casks/everything.rb",
          "ruby_source_checksum": {
       -    "sha256": "b2707d1952f02c3fa566b7ad2a707a847a959d36f51d3dee642dbe5deec12f27"
       +    "sha256": "0c4af571cce1632fc6a3dcf3e75ba82a3283077ef12399428192c26f9d6f779b"
          }
        }
     # ./test/cask/cask_spec.rb:225:in `block (4 levels) in <top (required)>'
     # ./test/support/helper/spec/shared_context/homebrew_cask.rb:53:in `block (2 levels) in <top (required)>'
```
2024-01-21 01:32:15 +00:00
Bevan J. Kay
779f1bba7d
Move comments in tandem with the lines they belong to 2024-01-20 00:03:34 +00:00
Issy Long
c63723bd7d
Merge pull request #16501 from issyl0/rubocop-new-rules-style-redundant-freeze
Fix RuboCop `Style/RedundantFreeze` offenses
2024-01-19 15:05:08 +00:00
Issy Long
bc5e422815
Merge pull request #16497 from issyl0/rubocop-new-rules-style-array-intersect
Fix RuboCop `Style/ArrayIntersect` offenses
2024-01-19 13:00:30 +00:00
Bevan Kay
bd6ab1d2b8
cask/uninstall: skip quit and signal directives when upgrading or reinstalling 2024-01-19 23:30:25 +11:00