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

Parse cask file for appcast, calc shasum, update #4

Conversation

Amorymeltzer
Copy link
Contributor

See if you like this, tried to match your style here; refs Homebrew/homebrew-cask/issues/15908.

My sed regex on L68 is intentionally vague, in case the appcast is ever downloaded to a file and shasummed that way. A commitment to always pipe through curl would mean it could be changed to sed 's| -$||' if so desired.

Checking to see if the appcast url is still valid is a bit lazy, but should cover the trick; I think it's important to include, though. See also Homebrew/homebrew-cask/pull/15831

@vitorgalvao
Copy link
Owner

Thank you, I like this.

Will make just a few modifications:

  • Make curl silent.
  • Move the logic of changing the appcast’s shasum to its own function.
  • Use -n to check if the variable is set (I usually do that, as a complement to -z).
  • Change sed to awk (consistent to how it’s done to get cask_sha).
  • In cask_appcast_url, only check for single quotes (we’ll never have string interpolation there).
  • In cask_appcast_url, removed the ,? (since we’ll remove :format anyway). Either way, since we’re only checking for the value inside the quotes, it isn’t necessary.
  • Fixed indentation (four spaces → two spaces, and removed a tab).
  • Whitespace around pipes.

@vitorgalvao
Copy link
Owner

Merged in 68a0f7b.

Amorymeltzer added a commit to Amorymeltzer/tiny-scripts that referenced this pull request Dec 28, 2015
Without ,? the url incorporates the terminal comma should it exist
Basically means the sha will be wrong, and in different ways depending on how the url is redirected
Refs vitorgalvao#4
Amorymeltzer added a commit to Amorymeltzer/tiny-scripts that referenced this pull request Dec 28, 2015
Without , the url incorporates the terminal comma should it exist
Basically means the sha will be wrong, and in different ways depending on how the url is redirected
Refs vitorgalvao#4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants