36194 Commits

Author SHA1 Message Date
Sam Ford
a2fb2b00fd
GithubRelease: Simplify block handling
The `#versions_from_content` method requires a regex and this will be
enforced by the type signature, so we don't have to check for the
presence of a regex when handling a `strategy` block.
2023-05-16 14:18:23 -04:00
Sam Ford
263f486806
GithubRelease: Add #generate_input_values method
Keeping the logic for generating the API URL in a method makes it
testable, aligns with other strategies, and will help to enable some
future work.
2023-05-16 14:18:23 -04:00
Sam Ford
701f7c5051
GithubRelease: Update type signature 2023-05-16 14:18:23 -04:00
Sam Ford
8a0f63e728
GithubRelease: Omit unnecessary prefix 2023-05-16 14:18:22 -04:00
Sam Ford
a29b5c34d2
GithubRelease: Rework documentation comments
The initial documentation comments contained some remaining text
referring to `GithubLatest` and hadn't been updated to incorporate
the recent changes to the aforementioned strategy. This also reworks
some of the language to better explain the strategy's function,
application, etc.
2023-05-16 14:18:22 -04:00
Sam Ford
1dd7556c74
GithubLatest: Tweak documentation comments 2023-05-16 14:18:22 -04:00
Sam Ford
db7a6baa33
GithubLatest: Fix test for GithubRelease changes
`GithubLatest` was updated to use parts of `GithubRelease` and this
works fine within `brew livecheck` (since we `require` all the
strategies) but we need to explicitly `require` `GithubRelease` in
the `GithubLatest` test file now. Without this, we encounter errors
in parts of `GithubLatest` where `GithubRelease` is referenced.
2023-05-16 14:18:22 -04:00
Sean Molenaar
5139b9b468
feat: add github_release strategy 2023-05-16 14:18:22 -04:00
Carlo Cabrera
111f504925
Merge pull request #15439 from Homebrew/sponsors-maintainers-man-completions
Update manpage and completions.
2023-05-17 01:44:36 +08:00
Carlo Cabrera
da0cd37bd4
brew/brew: add GITHUB_EVENT_PATH to env allowlist
Needed for Homebrew/homebrew-test-bot#922.
2023-05-17 01:41:58 +08:00
BrewTestBot
b27548dd97
Update manpage and completions.
Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow.
2023-05-16 16:33:15 +00:00
Mike McQuaid
cb143b14d0
Merge pull request #15421 from apainintheneck/add-dry-run-for-generate-api-cmds
dev-cmd/generate-*-api: add dry run option
2023-05-16 17:32:31 +01:00
Mike McQuaid
59c4bb45e5
Merge pull request #15437 from samford/livecheck/update-curl_headers-args
Strategy: Pass --max-redirs to #curl_headers
2023-05-16 17:31:57 +01:00
Mike McQuaid
83ab385281
Merge pull request #15422 from apainintheneck/update-service-documentation
formula-cookbook: update service docs
2023-05-16 17:24:13 +01:00
Markus Reiter
7c3077f3e9
Merge pull request #15438 from reitermarkus/bundle-version
Fix `BundleVersion` comparison.
2023-05-16 17:50:52 +02:00
Eric Knibbe
b6a2f5a9a0
Merge pull request #15433 from Moulick/patch-1
Fix 1Password logo in README.md
2023-05-16 11:00:10 -04:00
Moulick Aggarwal
8277ce2988
Fix 1password logo in README.md
Co-authored-by: Eric Knibbe <enk3@outlook.com>
2023-05-16 15:55:27 +02:00
Markus Reiter
a7cc9a8b41
Fix BundleVersion comparison. 2023-05-16 14:23:15 +02:00
Markus Reiter
53de9f38a2
Merge pull request #15430 from reitermarkus/cask-inspect
Simplify `Cask#inspect`.
2023-05-16 11:08:01 +02:00
Markus Reiter
34dd47d7d4
Merge pull request #15434 from reitermarkus/formula-loaded-from-api
Add `Formula#loaded_from_api?`.
2023-05-16 11:07:06 +02:00
Markus Reiter
fab2f20451
Merge pull request #15432 from reitermarkus/upgrade-bug-message
Don't special-case message for outdated casks that aren't installed.
2023-05-16 10:57:45 +02:00
apainintheneck
152020038c workflows/tests: use dry run for generate-*-api 2023-05-15 18:32:11 -07:00
apainintheneck
358a2ce788 dev-cmd/generate-*-api: add dry run option
There are two reasons for this:
- Makes it easier to run this command as a sanity check without
  having to create a temporary directory
- Is somewhat faster since you don't have to write thousands of files
2023-05-15 18:29:49 -07:00
Sam Ford
bcddf99838
Strategy: Pass --max-redirs to #curl_headers
The default curl args in `#curl_headers` cover most of
`Livecheck::Strategy::DEFAULT_CURL_ARGS` but `--max-redirs` was
overlooked. This adds an explicit `--max-redirs` argument in
the `#page_headers` `#curl_headers` call but it's worth mentioning
that this approach wouldn't benefit from any changes in
`DEFAULT_CURL_ARGS` and would need to be manually kept in parity.
2023-05-15 13:14:13 -04:00
Markus Reiter
f60612e6b2
Add Formula#loaded_from_api?. 2023-05-15 13:58:33 +02:00
Moulick Aggarwal
0c8bca16d5
Fix 1password logo in Readme.md 2023-05-15 11:52:50 +02:00
Markus Reiter
2f9c1868aa
Don't special-case message for outdated casks that aren't installed. 2023-05-15 11:42:01 +02:00
Markus Reiter
89292f47b5
Simplify Cask#inspect. 2023-05-15 10:17:17 +02:00
Carlo Cabrera
64259a420b
Merge pull request #15428 from carlocab/simulate-system-fix
simulate_system: fix `tap_syntax` job errors
2023-05-15 14:02:06 +08:00
Carlo Cabrera
28c593ed6a
simulate_system: fix tap_syntax job errors
Fixes

    Error: Cannot simulate :ventura :intel while already simulating :macos.

See https://github.com/Homebrew/homebrew-core/actions/runs/4974116510/jobs/8900390980#step:4:24.
2023-05-15 13:44:51 +08:00
Markus Reiter
6c80308290
Merge pull request #15419 from reitermarkus/tag-standardized-arch
Compare `Tag` using `standardized_arch`.
2023-05-14 21:45:24 +02:00
Markus Reiter
2ae5ae243a
Merge pull request #15414 from reitermarkus/rmdir-sudo
Use `sudo` for `rmdir` if necessary.
2023-05-14 21:42:00 +02:00
Markus Reiter
94d6213196
Merge pull request #15418 from reitermarkus/simplify-hash-merge
Simplify hash merge.
2023-05-14 21:41:39 +02:00
Markus Reiter
d2231086bd
Merge pull request #15420 from reitermarkus/simulate-system-with
Add `SimulateSystem::with`.
2023-05-14 21:41:20 +02:00
Kevin
6f48d55640
Merge pull request #15426 from clarkjc/patch-1
Fix missing require in update-report.rb
2023-05-14 12:33:12 -07:00
John Clark
1a6568b566
Update update-report.rb
Error: uninitialized constant Cask::Migrator
Please report this issue:
  https://docs.brew.sh/Troubleshooting
/usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:591:in `block in migrate_cask_rename'
/usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:590:in `each'
/usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:590:in `migrate_cask_rename'
/usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:250:in `each'
/usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:250:in `output_update_report'
/usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:41:in `update_report'
/usr/local/Homebrew/Library/Homebrew/brew.rb:94:in `<main>'
2023-05-14 15:12:11 -04:00
Mike McQuaid
b89b354a82
Merge pull request #15424 from Homebrew/sponsors-maintainers-man-completions
Update manpage and completions.
2023-05-14 20:03:25 +01:00
Mike McQuaid
a734170b83
Merge pull request #15404 from MikeMcQuaid/brew_generate_api_test
workflows/tests: test API generation.
2023-05-14 20:01:10 +01:00
BrewTestBot
18336080df
Update manpage and completions.
Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow.
2023-05-14 18:47:44 +00:00
Mike McQuaid
3dabf504bd
Merge pull request #15176 from reitermarkus/cask-renames
Implement cask renames.
2023-05-14 19:46:56 +01:00
Mike McQuaid
cea0ec8b40
workflows/tests: test API generation.
This should avoid making changes here that break API generation.
2023-05-14 19:46:24 +01:00
apainintheneck
41c7eb7078 formula-cookbook: update service docs
Add more info about the `run` method.
- Adds array example
- Adds OS specific example
2023-05-13 23:41:18 -07:00
Markus Reiter
0d56b97b07
Add SimulateSystem::with. 2023-05-14 01:45:04 +02:00
apainintheneck
ed24ef4860 docs/formula-cookbook: update service docs 2023-05-13 14:53:02 -07:00
apainintheneck
1bae81cba2 rubocops/service: add checks for custom service names
It now checks for two new edge cases.
1. Are the required methods defined in the block?
2. Is the `run` command defined if we're using methods other
   than `service_name` or `plist_name`?

It has also been updated to only get the list of method call nodes
once instead of doing it repeatedly for each cellar path check.
2023-05-13 14:53:01 -07:00
apainintheneck
1111706378 service: add custom service name DSL
The main thing is that this DSL allows us to provide an
interface that can be serialized to the JSON API.

Changes:
- Homebrew::Service
  - Adds `#service_name` and `#plist_name` methods
    - Each is now included in the `#serialize` method as well
  - Eval block on instantiation
    - Before we lazy evaluated this but the cost is not significant
      and it complicated the code a bunch. This only gets called
      during install, when evaluating caveats and in the `brew service`
      command. It skips this evaluation if the service block isn't there.
  - Add `#command?` helper to avoid `#command.blank?` and `#command.present?`
- Formula
  - `#service` now returns a service whenever it's called. This call is
    hidden behind a call to `#service?` most of the time anyway so this
    should be fine.
  - `#plist_name` and `#service_name` now call the methods of the same name
    on the service class. This should have already been in the service object
    to begin with and keeping these methods here helps preserve backwards
    compatibility with people who were overwriting these methods before.
- Caveats
  - Prefer `service#command?`
  - Add helpers for checking on service commands
    - This duplicates some of the work in `brew services`. Maybe we should
      merge that repo in at some point.
  - Check for installed service at `#plist_name` or `#service_name`. I think
    this should be used instead of `Keg#plist_installed?` which checked for any plist file.
    We should think about deprecating `#plist_installed?` in the future.
  - Stop using `ps aux | grep #{formula.plist_name}` to check for service files
    because it was inaccurate (it always returns true on my machine) because the grep
    process is started before the ps process.
  - Note: The behavior is the same as it was before. This means that caveats
    only show up for custom service files on install or if they're already installed.
    Otherwise it won't show up in `brew info`. This is because it has to check
    first if the service file has been installed.
- Utils::Service
  - Add utils for evaluating if a service is installed and running. This duplicates
    some of the work already found in `brew services`. We should seriously consider
    merging `brew services` with the main brew repo in the future since it's already
    tightly coupled to the code in the main repo.
- Formulary.load_formula_from_api
  - Be more explicit about which types can be deserialized into run params since
    it is now possible for run params to be nil.
- Update and add tests
2023-05-13 14:53:01 -07:00
Markus Reiter
4c3e8255cf
Compare Tag using standardized_arch. 2023-05-13 22:19:35 +02:00
Markus Reiter
023238a761
Simplify hash merge. 2023-05-13 22:18:17 +02:00
Markus Reiter
935c5efaf8
Use sudo for rmdir if necessary. 2023-05-13 06:46:59 +02:00
Markus Reiter
b0dc84b117
Merge pull request #15413 from reitermarkus/symlink-sudo
Use `sudo` for symlinks if necessary.
4.0.18
2023-05-13 04:10:01 +02:00