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
Tweak cask-source API handling #14439
Conversation
- Use raw.githubusercontent.com to download cask source rather than formulae.brew.sh. This allows us to remove these files - output the tap's current `HEAD` for both formulae and cask JSON - use this `HEAD` for the cask-source API to get the exact file on raw.githubusercontent.com rather than just whatever is newest (which is what the previous API did) - set the `Tap` correctly when creating a `Cask` from the API - if the `formula.json` file exists: print its modified time include `brew config` - memoize `tap.git_head` as we'll be calling it a lot in the same process with the same value
Review period ended. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for opening this!
I think the cask source method should live in Homebrew::API::Cask
since the modules within Homebrew::API
are meant to correspond to actual formulae.brew.sh API endpoints. If we're planning on removing /api/cask-source
, we should also remove Homebrew::API::CaskSource
.
I'm away for a family event this weekend so won't have as much time to play with it, but I'll try to push those changes and test it out a bit when I have time
return FromContentLoader.new(cask_source).load(config: config) | ||
end | ||
|
||
# convert generic string replacements into actual ones | ||
json_cask[:artifacts] = json_cask[:artifacts].map(&method(:from_h_hash_gsubs)) | ||
json_cask[:caveats] = from_h_string_gsubs(json_cask[:caveats]) | ||
|
||
Cask.new(token, source: cask_source, config: config) do | ||
tap = Tap.fetch(json_cask[:tap]) if json_cask[:tap].to_s.include?("/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the case where json_cask[:tap].to_s
does not include /
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly thinking of the case where it's an empty/invalid string.
This is no longer needed after Homebrew/brew#14439 is merged and in a stable tag.
These is no longer needed after Homebrew/brew#14439 and Homebrew/brew#14500 are merged and in a stable tag.
These are no longer needed after Homebrew/brew#14439 and Homebrew/brew#14500 are merged and in a stable tag.
These are no longer needed after Homebrew/brew#14439 and Homebrew/brew#14500 are merged and in a stable tag.
These are no longer needed after Homebrew/brew#14439 and Homebrew/brew#14500 are merged and in a stable tag.
These are no longer needed after Homebrew/brew#14439 and Homebrew/brew#14500 are merged and in a stable tag.
These are no longer needed after Homebrew/brew#14439 and Homebrew/brew#14500 are merged and in a stable tag.
These are no longer needed after Homebrew/brew#14439 and Homebrew/brew#14500 are merged and in a stable tag.
HEAD
for both formulae and cask JSONHEAD
for the cask-source API to get the exact file on raw.githubusercontent.com rather than just whatever is newest (which is what the previous API did)Tap
correctly when creating aCask
from the APIformula.json
file exists: print its modified time includebrew config
tap.git_head
as we'll be calling it a lot in the same process with the same value@Rylan12 would appreciate if you can kick the tires on this a bit. Feel free to merge when you're happy or commit to it and then merge if you want changes. Thanks ❤️ 🙇🏻