5593 Commits

Author SHA1 Message Date
Markus Reiter
fa2d917dec
Add test for extracting unwritable files. 2023-02-24 12:28:05 +01:00
Mike McQuaid
f280ce069b
Support loading formulae/casks from subdirectories
Previously, we required all formulae and casks to be in a specific
formula or cask directory but did not check any subdirectories.

This commit allows using subdirectories for official taps, the only
ones likely to be big enough to warrant sharding in this way and to
avoid potentially breaking backwards compatibility for existing taps.

This was inspired by the most recent issues with homebrew-cask.
2023-02-24 10:57:41 +00:00
DenizUgur
46aefe776f fix tests 2023-02-23 11:08:39 -08:00
DenizUgur
026709962d update tests 2023-02-23 11:02:20 -08:00
Sam Ford
7735036c56
livecheck: Add Json strategy
This adds a generic `Json` strategy to livecheck that requires a
`strategy` block to operate. This is primarily intended as a
replacement for existing `strategy` blocks in formulae/casks that
use `JSON#parse`, as it allows us to internalize/standardize that
boilerplate while improving error-handling.

Additionally, future strategies that parse JSON data can use the
`Json#find_versions` method instead of having to reinvent the wheel
(similar to how we currently have a number of strategies that
leverage `PageMatch#find_versions`).
2023-02-23 13:17:35 -05:00
Mike McQuaid
d7029e95cd
Merge pull request #14769 from dduugg/enable-types
Enable typing in Cask::Artifact
2023-02-23 18:02:44 +00:00
Mike McQuaid
f6d1fa62f1
Merge pull request #14762 from MikeMcQuaid/generate_api
Add generate-{cask,formula}-api commands
2023-02-23 09:02:15 +00:00
Bo Anderson
e663f532a6
Checksum Ruby source file downloads 2023-02-22 22:50:24 +00:00
Bo Anderson
b7d6d00c34
api: use signed endpoint 2023-02-22 21:53:32 +00:00
Douglas Eichelberger
29c6baeed1 Enable typing in Cask::Artifact 2023-02-22 09:11:29 -08:00
Mike McQuaid
8d02143c2b
Add generate-{cask,formula}-api commands
These replace the similar scripts in formulae.brew.sh.

Part of #14730.
2023-02-22 15:33:16 +00:00
Mike McQuaid
7ac31f7d65
Merge pull request #14732 from dduugg/formula-cop-mixin
Refactor FormulaCop as an abstract class
2023-02-21 23:05:58 +00:00
Douglas Eichelberger
d9db5e8825 Refactor FormulaCop as a mixin 2023-02-20 18:14:47 -08:00
Issy Long
298bb65dfb
rubocop: Entirely disable Metrics cops
- These are arbitrary length limits that had a load of disables in code.
- The limits were only increasing over time rather than decreasing.
- Fixing the problematic code to be shorter would take a long time for
  questionable gain since the problem has been around so long.
2023-02-21 00:34:17 +00:00
Bo Anderson
cacd7194f6
Support link_overwrite and conflicts_with in API 2023-02-20 16:28:07 +00:00
Mike McQuaid
aaec4014fd
Merge pull request #14710 from issyl0/rubocop-excludes
rubocop: Clean up some `Exclude`s
2023-02-20 09:51:11 +00:00
Issy Long
f8654bd363
rubocop: In-line disables of Metrics/{Module,Block,Class}Length
- We're not going to make the really long things be any shorter any time soon.
- The instructions in issue 14685 say, pragmatically, "disable all the rubocop
  rules we're never going to realistically fix e.g. Metrics/ClassLength". But
  that felt like a slippery slope to more _really_ long modules/classes/blocks,
  and the limits are here for a reason.
2023-02-19 16:33:23 +00:00
Issy Long
4a8384e8a8
rubocop: In-line disables of Lint/ConstantDefinitionInBlock 2023-02-19 16:33:22 +00:00
Bo Anderson
c2342eca91
Further improvements to API handling in shell 2023-02-19 05:38:13 +00:00
Mike McQuaid
a743e9277f
workflows/tests: faster, more reliable tests.
- Extract update tests into separate tests.
- Make `brew tests --online` run only once in its own job. This job
  could be made non-required to fight flakiness.
- Split up the various macOS runs into several steps now that we have
  more parallel macOS workers available.
- Cleanup some flaky tests.
2023-02-17 15:26:18 +00:00
Mike McQuaid
897121de88
Merge pull request #14678 from apainintheneck/add-cask-api-loader-tests
cask: add FromAPILoader tests
2023-02-17 12:34:22 +00:00
apainintheneck
3eede57ba2 ::FromAPILoader tests for cask 2023-02-16 19:35:34 -08:00
Bo Anderson
921b427ff2
test/utils/analytics_spec: fix flaky test 2023-02-17 02:17:03 +00:00
Mike McQuaid
17c872fb52
Merge pull request #14657 from MikeMcQuaid/tap_cask_api
tap: return the default_remote if not installed.
2023-02-16 12:52:25 +00:00
Mike McQuaid
53c57d7a70
tap: return the default_remote if not installed.
Fixes #14656.
2023-02-16 12:25:28 +00:00
Mike McQuaid
f7f04bae26
api: use formulae.brew.sh for cask-source API again.
GitHub's raw endpoint is proving hilariously unreliable for us here.
2023-02-16 12:05:38 +00:00
Mike McQuaid
769a8c5001
analytics: report to InfluxDB by default.
Now that this is ready: let's roll it out to everyone in 4.0.0.
2023-02-15 17:27:02 +00:00
Mike McQuaid
c5252817c2
analytics: refactor InfluxDB/Google handling. 2023-02-15 16:34:50 +00:00
Sean Molenaar
50e9247da4
fix: add better keys and fuller values to influxDB analytics 2023-02-15 14:12:05 +01:00
Mike McQuaid
08c6b4556d
Merge pull request #14616 from reitermarkus/audit-cask-version
Add audit for versions containing colons or slashes.
2023-02-15 11:59:59 +00:00
Bo Anderson
6e1b9ddb49
test/cask/cask_spec: fix test 2023-02-15 04:59:07 +00:00
Mike McQuaid
237eec8ef8
Overhaul Formula/Cask JSON generation
- Use constants for placeholders
- Monkeypatch to set `HOMEBREW_PREFIX` consistently to placeholder
- Use environment variable to set `Dir.home` consistently to placeholder
- Use `appdir` short-circuit to set `Cask#appdir` consistently to placeholder
- Use `Cask.generating_hash!` to enable "generating mode" with these patches
- Fix `Formula#caveats` from JSON

Fixes #14505
Fixes #14595
2023-02-14 14:19:40 +00:00
Mike McQuaid
66c9d5f2af
Merge pull request #14620 from Kentzo/sudo-env
sudo: pass env variables without /usr/bin/env
2023-02-14 14:13:37 +00:00
Sanjito Kurniawan
2daae5e84d
edit: add HOMEBREW_NO_INSTALL_FROM_API warning. 2023-02-14 12:04:10 +00:00
Mike McQuaid
e0ba9a1249
Merge pull request #14617 from Bo98/api-reqs-oldname
formulary: support requirements, aliases etc from API
2023-02-14 11:54:55 +00:00
Mike McQuaid
70db4bc723
Merge pull request #14621 from Bo98/api-uses_from_macos-fix
formulary: fix uses_from_macos handling on macOS
2023-02-14 11:24:44 +00:00
Ilya Kulakov
9ff7ceb563 sudo: pass env variables without /usr/bin/env
Using /usr/bin/env as a frontend for the actual command
prevents sudoers from restricting allowed commands and configuring
detailed command environment.
2023-02-13 22:10:35 -08:00
apainintheneck
39c6f7d6fb Stop including *flight block source in cask API
Originally we were going to try and load the *flight blocks from the API
but we ended up going with downloading the caskfile for the subset of
casks that need this functionality for consisty's sake.

This reverts the following commits from most recent to oldest:
- ffc74a51fb32b66a4cd8bc41dbd076dd23d9100e
- e5616e94fe42505434c330be35eeafef2739944f
- d1490c3d5c087d00f2bca1787cce331202b195c5
- 7ca5a5d9a71a73f21bbb8555a38048f027bee89b
- 2d5d132713d0701d02d5ff33e9918812d13d2a83

It also changes how *flight blocks are handled in `.to_h`.
Essentially, when *flight blocks exist they are just included
as a hash of the artifact to nil to indicate that they exist.

More information isn't necessary since we don't evaluate
the current source code in the *flight artifacts that
we get from the API.
2023-02-13 21:22:18 -08:00
Bo Anderson
7c1b642035
formulary: fix uses_from_macos handling on macOS 2023-02-14 04:07:51 +00:00
Bo Anderson
9b26bf9b92
formulary: support requirements, aliases etc from API 2023-02-14 03:32:56 +00:00
Markus Reiter
cd18703582
Add audit for versions containing colons or slashes. 2023-02-14 02:08:56 +01:00
Michael Cho
476f83d38d
livecheck_version: only split on commas in cask version 2023-02-12 15:32:32 -08:00
Mike McQuaid
ed79381155
Merge pull request #14574 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-1.45.1
build(deps): bump rubocop from 1.44.1 to 1.45.1 in /Library/Homebrew
2023-02-12 15:11:40 +00:00
Rylan Polster
f7fa5937d8
Allow brew info --json=v2 without taps with JSON API 2023-02-12 12:03:40 +00:00
EricFromCanada
dfc9906184
internal messaging fixes 2023-02-10 23:17:16 -05:00
Mike McQuaid
b9b3bd2571
brew style --fix 2023-02-10 08:59:51 +00:00
Mike McQuaid
cb1872e5bf
Merge pull request #14553 from MikeMcQuaid/4.0.0-changes 2023-02-08 11:05:08 +00:00
Mike McQuaid
342d40e88d
Merge pull request #14510 from reitermarkus/audit-only-except
Pass `only` and `except` to cask audits.
2023-02-08 09:05:00 +01:00
Markus Reiter
b821a00bc5
Pass only and except to cask audits. 2023-02-08 08:38:32 +01:00
Mike McQuaid
6b4363092d
Revert "Merge pull request #14548 from Homebrew/revert-14382-deprecate-disable-remove"
This reverts commit 932d2cf3b77c9439a57b6a43577fc8d3b6399a62, reversing
changes made to f4e60482791d2ff628efadfdbf0d14d9237d2d29.
2023-02-07 19:25:51 +01:00