Cleanup generate_keys and fix URLs for localized release notes #1664
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR includes the following changes:
generate_keys/main.swift
reorganized somewhat and cleaned up significantly. The code has been heavily commented, failure messages are displayed consistently (and where the context allows, using ANSI color), error messages and informational text has been rewritten for grammar and clarity, and top-level code has been encapsulated in function context for consistency. The remaining vestiges of the abandoned "syncable keychain item" implementation have been removed.generate_keys
now has a "lookup mode", enabled by passing the-p
flag on the command line. In this mode,generate_keys
looks up whether a key already exists - if so, it outputs the public key as a single line of Base64 and immediately exits with success; if not, an error is printed and it exits with failure. This mode is intended to assist other tools and scripts in retrieving the public signing key automatically, without having to hardcode Sparkle's keychain matching parameters or any assumptions about how the data in the keychain item is laid out. An obvious use of this would be in a shell script Xcode build phase which automatically updates the value ofSUPublicEDKey
in an app'sInfo.plist
.generate_appcast
now generates full URLs for links to localized release notes in an appcast, utilizing the same logic used to generate the link to "base" release notes (use a release notes URL prefix if specified, otherwise use the feed URL if available). Previously, localized release notes links would be specified only as filenames. Before:After:
This change guarantees that localized release notes always load correctly when applicable even when their filenames contain otherwise problematic characters such as spaces - previously, in many cases they would simply fail to load.