5284 Commits

Author SHA1 Message Date
Michael Wagner
78c07fd0e1
Fix Missing Download Strategy And Dependency 2023-05-17 16:30:00 -05:00
Markus Reiter
486c3765ce
Add --os=all and --arch=all options. 2023-05-17 15:26:46 +02:00
Sam Ford
104d30d231
Finish renaming GithubRelease to GithubReleases 2023-05-16 16:08:18 -04:00
Sean Molenaar
940b63cad3
chore: rename GitHubRelease to GitHubReleases 2023-05-16 14:19:01 -04:00
Sam Ford
bed4737826
GithubRelease: Add tests
This adds tests to cover all of the strategy outside of the
`#find_versions` method, which we don't currently test because it
involves a network request.
2023-05-16 14:19:00 -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
Markus Reiter
a7cc9a8b41
Fix BundleVersion comparison. 2023-05-16 14:23:15 +02: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
d2231086bd
Merge pull request #15420 from reitermarkus/simulate-system-with
Add `SimulateSystem::with`.
2023-05-14 21:41:20 +02:00
Mike McQuaid
3dabf504bd
Merge pull request #15176 from reitermarkus/cask-renames
Implement cask renames.
2023-05-14 19:46:56 +01:00
Markus Reiter
0d56b97b07
Add SimulateSystem::with. 2023-05-14 01:45:04 +02: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
d7a0e260e8
Improve Cask::Utils.gain_permissions_remove for symlinks. 2023-05-13 03:54:48 +02:00
Markus Reiter
4e483c9a0e
Add test for Cask::Utils::gain_permissions_mkpath. 2023-05-13 03:42:00 +02:00
Markus Reiter
a3231a03fa
Implement cask renames. 2023-05-12 21:17:30 +02:00
JBYoshi
b1c7f12fbb
Clean up allow and expect. 2023-05-12 09:57:12 -05:00
JBYoshi
4a3b8923f2
More test cleanup. 2023-05-12 09:52:57 -05:00
JBYoshi
d697037aca
Merge remote-tracking branch 'origin/master' into cask-upgrade/wildcards 2023-05-11 17:32:36 -05:00
JBYoshi
5e23a0563a
Switch base case expect() to allow(). 2023-05-11 17:10:41 -05:00
JBYoshi
7a108d3db0
Merge and_call_original instruction into expect() calls. 2023-05-11 17:09:27 -05:00
JBYoshi
84ad387661
Clean up code for feedback. 2023-05-11 13:29:56 -05:00
JBYoshi
a1780c842c
Improve unit test to make sure the sudo version is used. 2023-05-11 12:44:35 -05:00
Markus Reiter
5c9c089b68
Improve #to_str and #to_json for Version::NULL. 2023-05-11 19:16:42 +02:00
JBYoshi
2e8232de39
Replace wildcard copy with a loop over children.
Fixes one of the errors in https://github.com/orgs/Homebrew/discussions/4498 (specifically "cp: [...].app/*:
No such file or directory").
2023-05-11 11:47:16 -05:00
Mike McQuaid
04866b6e39
Merge pull request #15392 from reitermarkus/remove-rubocop
Remove `NoDslVersion` cop.
2023-05-10 13:13:35 +01:00
Markus Reiter
46b9dba03c
Remove NoDslVersion cop. 2023-05-10 01:02:42 +02:00
Markus Reiter
f7168bf234
Merge pull request #15336 from reitermarkus/version-head-null
Merge `HeadVersion` and `NullVersion` into `Version`.
2023-05-10 01:01:21 +02:00
Markus Reiter
8274920217
Rename OS::Mac::Version to MacOSVersion. 2023-05-09 05:08:38 +02:00
Markus Reiter
02dbeb62fc
Refactor RuboCop tests. 2023-05-09 04:28:25 +02:00
Markus Reiter
fe19ddc3a7
Remove Version#empty?. 2023-05-09 01:13:55 +02:00
Markus Reiter
a1efaf1864
Merge HeadVersion and NullVersion into Version. 2023-05-09 01:13:54 +02:00
Markus Reiter
b05de929c6
Merge pull request #15351 from reitermarkus/livecheck-head
Use `curl_headers` and `curl_output` for `Livecheck` strategies.
2023-05-09 00:55:34 +02:00
Mike McQuaid
b61d3500aa
Merge pull request #15270 from SMillerDev/feature/livecheck/github_latest_api
feat: use API for GitHub latest release strategy
2023-05-08 16:45:41 +01:00
Mike McQuaid
63ad10392d
Merge pull request #15230 from reitermarkus/installer-manual-open
Make manual installers easier to open.
2023-05-08 12:46:34 +01:00
Markus Reiter
df620ad3ba
Make manual installers easier to open. 2023-05-08 08:25:32 +02:00
Sam Ford
cfba45fb56
GithubLatest: Use API URL as generated value
The generated URL should reflect what we're actually checking, which
is now the `/releases/latest` API URL.
2023-05-07 10:21:48 +02:00
Sean Molenaar
573d87cdfa
feat: use API for GitHub latest release strategy 2023-05-07 10:21:48 +02:00
Markus Reiter
1df501b0ac
Tweak tests. 2023-05-07 10:04:28 +02:00
Markus Reiter
81fdb3716e
Implement StanzaOrder cop using on_cask_stanza_block. 2023-05-07 08:30:29 +02:00
Issy Long
704482d815
wip a test for ordering of both on_* blocks and their contents
- This is very broken, "detected clobbering" errors.
2023-05-07 08:29:31 +02:00
Issy Long
bd6e9e72a1
rubocops/cask: Check for correct stanza ordering within on_* blocks
- Now that we detect correct stanza _grouping_ within `on_*` blocks in
  Casks (PR 15211), correct stanza _ordering_ in `on_*` blocks was the
  next logical step. For example, `url` has to come after `version` and
  `sha256` in an `on_macos` or `on_intel` block for consistency with the
  top-level stanza order we enforce elsewhere.
- Still not doing the nested `on_os` inside `on_arch`, that felt
  excessive for an edge case that isn't present in any actual real
  Casks we have. I removed the test with that specific TODO.
2023-05-07 08:27:43 +02:00
Markus Reiter
353818f508
Rename curl_head to curl_headers. 2023-05-06 03:41:35 +02:00
Markus Reiter
dfc9d94c5b
Type livecheck.rb. 2023-05-06 03:27:42 +02:00
Mike McQuaid
0e387fee8c
Merge pull request #15138 from JBYoshi/cask-move-contents
Don't remove cask directories when upgrading.
2023-05-04 11:43:44 +01:00
Issy Long
40f697e96e
diagnostic: Check for unnecessary Core and Cask taps
- If the user doesn't have `HOMEBREW_DEVELOPER` or
  `HOMEBREW_NO_INSTALL_FROM_API` set but does have `homebrew/core` or
  `homebrew/cask` taps installed this can cause problems with installing
  outdated software.
- Hence, warn them in `brew doctor` if they have either of these taps
  installed, with instructions on how to remove them.
2023-04-30 15:25:56 +01:00
Ruoyu Zhong
254941c6f7
rubocops/service: check for more cellar paths
This is a follow-up to #15154. In addition to `bin`, the `service` block
can also reference other cellar paths like `libexec`. They don't work
with the API either, as reported in
https://github.com/orgs/Homebrew/discussions/4459.

Violations are already corrected in Homebrew/homebrew-core#129736
and Homebrew/homebrew-core#129737.

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2023-04-30 07:39:25 +08:00
Mike McQuaid
cd683aefa8
Merge pull request #14629 from Kentzo/sudo-user
sudo: explicitly specify the root user where necessary
2023-04-29 11:17:21 +01:00
Carlo Cabrera
f3724f00d2
determine-test-runners: fix test 2023-04-29 11:36:31 +08:00