unversioned_cask_checker: check installer artifacts
- [x] Have you followed the guidelines in our Contributing document?
- [x] Have you checked to ensure there aren't other open Pull Requests for the same change?
- [x] Have you added an explanation of what your changes do and why you'd like us to include them?
- [ ] Have you written new tests for your changes? Here's an example.
- [x] Have you successfully run
brew stylewith your changes locally? - [ ] Have you successfully run
brew typecheckwith your changes locally? - [x] Have you successfully run
brew testswith your changes locally?
This PR adds installer paths to the unversioned_cask_checker method, which allows the :extract_plist livecheck method to look inside of installer paths for info.plist files. This will be used fairly rarely but will enable a livecheck to be added to the PR - https://github.com/Homebrew/homebrew-cask/pull/128899
I'm seeing an error with typecheck locally, that I'm not sure how to resolve as this is not the case practically;
unversioned_cask_checker.rb:102: This code is unreachable https://srb.help/7006
102 | source = artifact.is_a?(Cask::Artifact::Installer) ? artifact.path : artifact.source.basename
^^^^^^^^^^^^^
unversioned_cask_checker.rb:102: This condition was always falsy (T::Boolean)
102 | source = artifact.is_a?(Cask::Artifact::Installer) ? artifact.path : artifact.source.basename
Review period will end on 2022-08-09 at 00:00:00 UTC.
Review period ended.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Looks good to me so far!
Would like to see this lines covered by at least unit tests, some other cask folks and/or @Bo98 👍🏻 this before merging.
One cask that needs this is https://github.com/Homebrew/homebrew-cask-drivers/pull/3008
Gentle nudge as I want to get https://github.com/Homebrew/homebrew-cask-drivers/pull/3008 working and closed :)
Gentle nudge :)
I have added a test that should confirm that this works with an installer artifact.
I have little experience with writing tests, so I hope that this suffices.
To allow the test to be completed, I needed an artifact to check for a contained info.plist file. I created a modified version of the caffeine.zip fixture that includes an info.plist file.
It seems that the test doesn't work on Linux? I'm not sure how to proceed, would love some direction here.
It seems that the test doesn't work on Linux? I'm not sure how to proceed, would love some direction here.
Looks like a Sorbet issue here where the wrong argument is being passed?
The test is simulating the livecheck command on a cask fixture, however this will not work on Linux as the strategy uses system commands that are only found on MacOS - https://github.com/Homebrew/brew/blob/96574c831f9ed1f3fa281f4724719d8cb2424ece/Library/Homebrew/unversioned_cask_checker.rb#L83
Could this be why it is failing on CI, but I can't replicate it locally?
Maybe restrict feature to macOS only? or find a linux alternative?
@aaronliu0130 The whole cask system should be limited to Mac only, but I'm not sure how that integrates with CI testing.
@bevanjkay Can this command perhaps be mocked out instead? It'll be slower to call it directly anyway.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Thanks again @bevanjkay!