Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cask tab to better identify installed casks #17821

Closed

Conversation

apainintheneck
Copy link
Contributor

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • 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.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Fixes #17427
Fixes #17416

Previously we would identify installed casks by token derived from directories present in the caskroom directory. That was error prone when the token was ambiguous. In that case, the Cask::Caskroom.cask method would default to the first cask which was not always correct.

Now that we have the cask tab we can use the installed receipt to get the tap a cask came from. With both the tap and the token, we can be sure that we're loading the cask that is actually installed and not another cask from a different tap that just happens to have the same name.

TODO: Testing

@apainintheneck apainintheneck added the cask Homebrew Cask label Jul 20, 2024
Previously we would identify installed casks by token derived from
directories present in the caskroom directory. That was error prone
when the token was ambiguous. In that case, the `Cask::Caskroom.cask`
method would default to the first cask which was not always correct.

Now that we have the cask tab we can use the installed receipt to
get the tap a cask came from. With both the tap and the token, we
can be sure that we're loading the cask that is actually installed
and not another cask from a different tap that just happens to have
the same name.
@apainintheneck apainintheneck force-pushed the use-cask-tab-to-better-identify-installed-casks branch from 4a0c72b to 5c3a1a2 Compare July 21, 2024 01:47
@Rylan12
Copy link
Member

Rylan12 commented Jul 21, 2024

@apainintheneck I just opened a PR (#17823) which duplicates some of the work here. So sorry, I didn't see this until now, otherwise I would have reviewed or modified mine to work around this.

My PR takes a slightly different approach (and covers an additional issue with named arguments), but I'm not sure it's a better solution, so this might still be the way to go with the Cask::Caskroom::casks method

@apainintheneck
Copy link
Contributor Author

Closing in favor of #17823 which is much more thorough and comprehensive than this PR. Any necessary discussion can happen there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cask Homebrew Cask
Projects
None yet
2 participants