Permalink
Browse files

Sparkle

  • Loading branch information...
1 parent 5a35e08 commit de7b8a70ca7fc8685ed108889afd0837c8955a90 @rsms committed Dec 20, 2010
Showing with 3,259 additions and 190 deletions.
  1. +9 −0 admin/appcast.xml
  2. +124 −0 admin/distribution.sh
  3. +19 −0 admin/release-notes.html
  4. +1 −0 deps/Sparkle.framework/Headers
  5. +1 −0 deps/Sparkle.framework/Resources
  6. +1 −0 deps/Sparkle.framework/Sparkle
  7. +33 −0 deps/Sparkle.framework/Versions/A/Headers/SUAppcast.h
  8. +47 −0 deps/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h
  9. +118 −0 deps/Sparkle.framework/Versions/A/Headers/SUUpdater.h
  10. +27 −0 deps/Sparkle.framework/Versions/A/Headers/SUVersionComparisonProtocol.h
  11. +21 −0 deps/Sparkle.framework/Versions/A/Headers/Sparkle.h
  12. +24 −0 deps/Sparkle.framework/Versions/A/Resources/Info.plist
  13. +7 −0 deps/Sparkle.framework/Versions/A/Resources/License.txt
  14. +174 −0 deps/Sparkle.framework/Versions/A/Resources/SUModelTranslation.plist
  15. +56 −0 deps/Sparkle.framework/Versions/A/Resources/SUStatus.nib/classes.nib
  16. +20 −0 deps/Sparkle.framework/Versions/A/Resources/SUStatus.nib/info.nib
  17. BIN deps/Sparkle.framework/Versions/A/Resources/SUStatus.nib/keyedobjects.nib
  18. +50 −0 deps/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  19. +20 −0 deps/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/info.nib
  20. BIN deps/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  21. +67 −0 deps/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/classes.nib
  22. +20 −0 deps/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/info.nib
  23. BIN deps/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/keyedobjects.nib
  24. +59 −0 deps/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  25. +20 −0 deps/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib/info.nib
  26. BIN deps/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  27. BIN deps/Sparkle.framework/Versions/A/Resources/de.lproj/Sparkle.strings
  28. +50 −0 deps/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  29. +20 −0 deps/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/info.nib
  30. BIN deps/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  31. +67 −0 deps/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/classes.nib
  32. +20 −0 deps/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/info.nib
  33. BIN deps/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/keyedobjects.nib
  34. +59 −0 deps/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  35. +21 −0 deps/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib/info.nib
  36. BIN deps/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  37. BIN deps/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings
  38. +50 −0 deps/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  39. +20 −0 deps/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/info.nib
  40. BIN deps/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  41. +67 −0 deps/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/classes.nib
  42. +20 −0 deps/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/info.nib
  43. BIN deps/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/keyedobjects.nib
  44. +59 −0 deps/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  45. +20 −0 deps/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib/info.nib
  46. BIN deps/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  47. BIN deps/Sparkle.framework/Versions/A/Resources/es.lproj/Sparkle.strings
  48. +50 −0 deps/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  49. +16 −0 deps/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/info.nib
  50. BIN deps/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  51. +67 −0 deps/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/classes.nib
  52. +16 −0 deps/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/info.nib
  53. BIN deps/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/keyedobjects.nib
  54. +59 −0 deps/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  55. +16 −0 deps/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib/info.nib
  56. BIN deps/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  57. BIN deps/Sparkle.framework/Versions/A/Resources/fr.lproj/Sparkle.strings
  58. +1 −0 deps/Sparkle.framework/Versions/A/Resources/fr.lproj/fr.lproj
  59. +1 −0 deps/Sparkle.framework/Versions/A/Resources/fr_CA.lproj
  60. +50 −0 deps/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  61. +20 −0 deps/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/info.nib
  62. BIN deps/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  63. +67 −0 deps/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/classes.nib
  64. +20 −0 deps/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/info.nib
  65. BIN deps/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/keyedobjects.nib
  66. +59 −0 deps/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  67. +20 −0 deps/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib/info.nib
  68. BIN deps/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  69. BIN deps/Sparkle.framework/Versions/A/Resources/it.lproj/Sparkle.strings
  70. +50 −0 deps/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  71. +18 −0 deps/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/info.nib
  72. BIN deps/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  73. +67 −0 deps/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/classes.nib
  74. +16 −0 deps/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/info.nib
  75. BIN deps/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/keyedobjects.nib
  76. +59 −0 deps/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  77. +16 −0 deps/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib/info.nib
  78. BIN deps/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  79. BIN deps/Sparkle.framework/Versions/A/Resources/nl.lproj/Sparkle.strings
  80. BIN deps/Sparkle.framework/Versions/A/Resources/relaunch
  81. +50 −0 deps/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  82. +20 −0 deps/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/info.nib
  83. BIN deps/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  84. +67 −0 deps/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/classes.nib
  85. +20 −0 deps/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/info.nib
  86. BIN deps/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/keyedobjects.nib
  87. +59 −0 deps/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  88. +18 −0 deps/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib/info.nib
  89. BIN deps/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  90. BIN deps/Sparkle.framework/Versions/A/Resources/ru.lproj/Sparkle.strings
  91. +50 −0 deps/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  92. +20 −0 deps/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/info.nib
  93. BIN deps/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  94. +39 −0 deps/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/classes.nib
  95. +18 −0 deps/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/info.nib
  96. BIN deps/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/keyedobjects.nib
  97. +59 −0 deps/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  98. +20 −0 deps/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib/info.nib
  99. BIN deps/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  100. BIN deps/Sparkle.framework/Versions/A/Resources/sv.lproj/Sparkle.strings
  101. BIN deps/Sparkle.framework/Versions/A/Sparkle
  102. +1 −0 deps/Sparkle.framework/Versions/Current
  103. +86 −2 kod.xcodeproj/project.pbxproj
  104. +507 −168 resources/Info.plist
  105. +115 −19 resources/MainMenu.xib
  106. +20 −0 resources/dsa_pub.pem
  107. +3 −0 src/KAppDelegate.h
  108. +7 −0 src/KAppDelegate.mm
  109. +1 −1 src/KDocumentController.mm
View
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
+ <channel>
+ <title>Kod releases</title>
+ <link>http://kodapp.com/</link>
+ <description>Appcast for Kod</description>
+ <language>en</language>
+ </channel>
+</rss>
View
@@ -0,0 +1,124 @@
+#!/bin/bash
+set -o errexit
+
+[ $BUILD_STYLE = Release ] || { echo Distribution target requires "'Release'" build style; false; }
+
+VERSION=$(defaults read "$BUILT_PRODUCTS_DIR/$PROJECT_NAME.app/Contents/Info" CFBundleVersion)
+DOWNLOAD_BASE_URL="http://kodapp.com/dist"
+RELEASENOTES_URL="http://kodapp.com/release-notes.html#version-$VERSION"
+
+ARCHIVE_FILENAME="$PROJECT_NAME-$VERSION.zip"
+DOWNLOAD_URL="$DOWNLOAD_BASE_URL/$ARCHIVE_FILENAME"
+KEYCHAIN_PRIVKEY_NAME="Kod release signing key (private)"
+
+WD=$PWD
+cd "$BUILT_PRODUCTS_DIR"
+rm -f "$PROJECT_NAME"*.zip
+ditto -ck --keepParent "$PROJECT_NAME.app" "$ARCHIVE_FILENAME"
+
+SIZE=$(stat -f %z "$ARCHIVE_FILENAME")
+PUBDATE=$(LC_TIME=c date +"%a, %d %b %G %T %z")
+
+# For OS X >=10.6:
+SIGNATURE=$(
+ openssl dgst -sha1 -binary < "$ARCHIVE_FILENAME" \
+ | openssl dgst -dss1 -sign <(security find-generic-password -g -s "$KEYCHAIN_PRIVKEY_NAME" 2>&1 1>/dev/null | /usr/bin/perl -pe '($_) = /"(.+)"/; s/\\012/\n/g' | /usr/bin/perl -MXML::LibXML -e 'print XML::LibXML->new()->parse_file("-")->findvalue(q(//string[preceding-sibling::key[1] = "NOTE"]))') \
+ | openssl enc -base64
+)
+# For OS X <=10.5:
+#SIGNATURE=$(
+# openssl dgst -sha1 -binary < "$ARCHIVE_FILENAME" \
+# | openssl dgst -dss1 -sign <(security find-generic-password -g -s "$KEYCHAIN_PRIVKEY_NAME" 2>&1 1>/dev/null | perl -pe '($_) = /"(.+)"/; s/\\012/\n/g') \
+# | openssl enc -base64
+#)
+
+[ $SIGNATURE ] || { echo Unable to load signing private key with name "'$KEYCHAIN_PRIVKEY_NAME'" from keychain; false; }
+
+
+python - <<EOF
+# encoding: utf-8
+import sys, re
+ITEM = '''
+ <item>
+ <title>Version $VERSION</title>
+ <sparkle:releaseNotesLink>$RELEASENOTES_URL</sparkle:releaseNotesLink>
+ <pubDate>$PUBDATE</pubDate>
+ <enclosure
+ url="$DOWNLOAD_URL"
+ sparkle:version="$VERSION"
+ type="application/octet-stream"
+ length="$SIZE"
+ sparkle:dsaSignature="$SIGNATURE"
+ />
+ </item>
+'''
+newver = re.findall(r'sparkle:version="([^"]+)"', ITEM)[0]
+newsig = re.findall(r'sparkle:dsaSignature="([^"]+)"', ITEM)[0]
+
+f = open('$WD/admin/appcast.xml','r')
+APPCAST = f.read()
+f.close()
+
+if newver in re.findall(r'sparkle:version="([^"]+)"', APPCAST):
+ print >> sys.stderr, ('Version %s is already in the appcast.xml -- you need to manually '\
+ 'remove it from the appcast.xml if this is not an error.') % newver
+ sys.exit(1)
+elif newsig in re.findall(r'sparkle:dsaSignature="([^"]+)"', APPCAST):
+ print >> sys.stderr, ('Signature %s is already in the appcast.xml -- you need to manually '\
+ 'remove it from the appcast.xml if this is not an error.') % newsig
+ sys.exit(1)
+
+APPCAST = re.compile(r'(\n[ \r\n\t]*</channel>)', re.M).sub(ITEM.rstrip()+r'\1', APPCAST)
+open('$WD/admin/appcast.xml','w').write(APPCAST)
+EOF
+
+python - <<EOF
+# encoding: utf-8
+import sys, re
+ITEM = '''
+ <section id="version-$VERSION">
+ <h2>Version $VERSION</h2>
+ <ul>
+ <li>DESCRIPTION</li>
+ </ul>
+ </section>
+'''
+VERSIONRE = r'<section id="version-([^"]+)">'
+newver = re.findall(VERSIONRE, ITEM)[0]
+
+f = open('$WD/admin/release-notes.html','r')
+HTML = f.read()
+f.close()
+
+if newver in re.findall(VERSIONRE, HTML):
+ print >> sys.stderr, ('Version %s is already in the release-notes.html -- you need to manually '\
+ 'remove it from release-notes.html if this is not an error.') % newver
+ sys.exit(1)
+
+HTML = re.compile(r'(\n[ \r\n\t]*</body>)', re.M).sub(ITEM.rstrip()+r'\1', HTML)
+open('$WD/admin/release-notes.html','w').write(HTML)
+EOF
+
+PATH=~/bin:$PATH # if mate is in home/bin
+mate -a "$WD/admin/appcast.xml" "$WD/admin/release-notes.html"
+mate -a <<EOF
+
+ ------------- INSTRUCTIONS -------------
+
+1. Complete the new entry created in release-notes.html
+
+mate '$WD/admin/release-notes.html'
+
+2. Publish the archive, release notes and appcast -- in that order:
+
+scp '$BUILT_PRODUCTS_DIR/$ARCHIVE_FILENAME' hunch.se:/var/www/hunch.se/www/public/scrup/dist/
+scp '$WD/admin/release-notes.html' hunch.se:/var/www/hunch.se/www/public/scrup/release-notes.html
+scp '$WD/admin/appcast.xml' hunch.se:/var/www/hunch.se/www/public/scrup/appcast.xml
+
+3. Commit, tag and push the source
+
+git ci 'Release $VERSION' -a
+git tag -sm 'Release $VERSION' 'v$VERSION'
+git pu
+
+EOF
View
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html lang="en">
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=utf-8">
+ <title>Kod release notes</title>
+ <meta name="robots" content="anchors">
+ <style type="text/css" media="screen">
+ body {
+ margin: 2px 12px 12px 12px; font-size:13px; background:white;
+ color:#222;
+ }
+ p,li,a,a:hover,h1,h2,h3 { font-family:helvetica,arial,sans-serif; }
+ h2 { font-size:16px; }
+ section { display:block; clear:both; }
+ </style>
+ </head>
+ <body>
+ </body>
+</html>
@@ -0,0 +1,33 @@
+//
+// SUAppcast.h
+// Sparkle
+//
+// Created by Andy Matuschak on 3/12/06.
+// Copyright 2006 Andy Matuschak. All rights reserved.
+//
+
+#ifndef SUAPPCAST_H
+#define SUAPPCAST_H
+
+@class SUAppcastItem;
+@interface SUAppcast : NSObject {
+ NSArray *items;
+ NSString *userAgentString;
+ id delegate;
+ NSMutableData *incrementalData;
+}
+
+- (void)fetchAppcastFromURL:(NSURL *)url;
+- (void)setDelegate:delegate;
+- (void)setUserAgentString:(NSString *)userAgentString;
+
+- (NSArray *)items;
+
+@end
+
+@interface NSObject (SUAppcastDelegate)
+- (void)appcastDidFinishLoading:(SUAppcast *)appcast;
+- (void)appcast:(SUAppcast *)appcast failedToLoadWithError:(NSError *)error;
+@end
+
+#endif
@@ -0,0 +1,47 @@
+//
+// SUAppcastItem.h
+// Sparkle
+//
+// Created by Andy Matuschak on 3/12/06.
+// Copyright 2006 Andy Matuschak. All rights reserved.
+//
+
+#ifndef SUAPPCASTITEM_H
+#define SUAPPCASTITEM_H
+
+@interface SUAppcastItem : NSObject {
+ NSString *title;
+ NSDate *date;
+ NSString *itemDescription;
+
+ NSURL *releaseNotesURL;
+
+ NSString *DSASignature;
+ NSString *minimumSystemVersion;
+
+ NSURL *fileURL;
+ NSString *versionString;
+ NSString *displayVersionString;
+
+ NSDictionary *propertiesDictionary;
+}
+
+// Initializes with data from a dictionary provided by the RSS class.
+- initWithDictionary:(NSDictionary *)dict;
+
+- (NSString *)title;
+- (NSString *)versionString;
+- (NSString *)displayVersionString;
+- (NSDate *)date;
+- (NSString *)itemDescription;
+- (NSURL *)releaseNotesURL;
+- (NSURL *)fileURL;
+- (NSString *)DSASignature;
+- (NSString *)minimumSystemVersion;
+
+// Returns the dictionary provided in initWithDictionary; this might be useful later for extensions.
+- (NSDictionary *)propertiesDictionary;
+
+@end
+
+#endif
@@ -0,0 +1,118 @@
+//
+// SUUpdater.h
+// Sparkle
+//
+// Created by Andy Matuschak on 1/4/06.
+// Copyright 2006 Andy Matuschak. All rights reserved.
+//
+
+#ifndef SUUPDATER_H
+#define SUUPDATER_H
+
+#import <Sparkle/SUVersionComparisonProtocol.h>
+
+@class SUUpdateDriver, SUAppcastItem, SUHost, SUAppcast;
+@interface SUUpdater : NSObject {
+ NSTimer *checkTimer;
+ SUUpdateDriver *driver;
+
+ SUHost *host;
+ IBOutlet id delegate;
+}
+
++ (SUUpdater *)sharedUpdater;
++ (SUUpdater *)updaterForBundle:(NSBundle *)bundle;
+- (NSBundle *)hostBundle;
+
+- (void)setDelegate:(id)delegate;
+- delegate;
+
+- (void)setAutomaticallyChecksForUpdates:(BOOL)automaticallyChecks;
+- (BOOL)automaticallyChecksForUpdates;
+
+- (void)setUpdateCheckInterval:(NSTimeInterval)interval;
+- (NSTimeInterval)updateCheckInterval;
+
+- (void)setFeedURL:(NSURL *)feedURL;
+- (NSURL *)feedURL;
+
+- (void)setSendsSystemProfile:(BOOL)sendsSystemProfile;
+- (BOOL)sendsSystemProfile;
+
+- (void)setAutomaticallyDownloadsUpdates:(BOOL)automaticallyDownloadsUpdates;
+- (BOOL)automaticallyDownloadsUpdates;
+
+// This IBAction is meant for a main menu item. Hook up any menu item to this action,
+// and Sparkle will check for updates and report back its findings verbosely.
+- (IBAction)checkForUpdates:sender;
+
+// This kicks off an update meant to be programmatically initiated. That is, it will display no UI unless it actually finds an update,
+// in which case it proceeds as usual. If the fully automated updating is turned on, however, this will invoke that behavior, and if an
+// update is found, it will be downloaded and prepped for installation.
+- (void)checkForUpdatesInBackground;
+
+// Date of last update check. Returns null if no check has been performed.
+- (NSDate*)lastUpdateCheckDate;
+
+// This begins a "probing" check for updates which will not actually offer to update to that version. The delegate methods, though,
+// (up to updater:didFindValidUpdate: and updaterDidNotFindUpdate:), are called, so you can use that information in your UI.
+- (void)checkForUpdateInformation;
+
+// Call this to appropriately schedule or cancel the update checking timer according to the preferences for time interval and automatic checks. This call does not change the date of the next check, but only the internal NSTimer.
+- (void)resetUpdateCycle;
+
+- (BOOL)updateInProgress;
+@end
+
+@interface NSObject (SUUpdaterDelegateInformalProtocol)
+// This method allows you to add extra parameters to the appcast URL, potentially based on whether or not Sparkle will also be sending along the system profile. This method should return an array of dictionaries with keys: "key", "value", "displayKey", "displayValue", the latter two being specifically for display to the user.
+- (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile;
+
+// Use this to override the default behavior for Sparkle prompting the user about automatic update checks.
+- (BOOL)updaterShouldPromptForPermissionToCheckForUpdates:(SUUpdater *)bundle;
+
+// Implement this if you want to do some special handling with the appcast once it finishes loading.
+- (void)updater:(SUUpdater *)updater didFinishLoadingAppcast:(SUAppcast *)appcast;
+
+// If you're using special logic or extensions in your appcast, implement this to use your own logic for finding
+// a valid update, if any, in the given appcast.
+- (SUAppcastItem *)bestValidUpdateInAppcast:(SUAppcast *)appcast forUpdater:(SUUpdater *)bundle;
+
+// Sent when a valid update is found by the update driver.
+- (void)updater:(SUUpdater *)updater didFindValidUpdate:(SUAppcastItem *)update;
+
+// Sent when a valid update is not found.
+- (void)updaterDidNotFindUpdate:(SUUpdater *)update;
+
+// Sent immediately before installing the specified update.
+- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update;
+
+// Return YES to delay the relaunch until you do some processing; invoke the given NSInvocation to continue.
+- (BOOL)updater:(SUUpdater *)updater shouldPostponeRelaunchForUpdate:(SUAppcastItem *)update untilInvoking:(NSInvocation *)invocation;
+
+// Called immediately before relaunching.
+- (void)updaterWillRelaunchApplication:(SUUpdater *)updater;
+
+// This method allows you to provide a custom version comparator.
+// If you don't implement this method or return nil, the standard version comparator will be used.
+- (id <SUVersionComparison>)versionComparatorForUpdater:(SUUpdater *)updater;
+
+// Returns the path which is used to relaunch the client after the update is installed. By default, the path of the host bundle.
+- (NSString *)pathToRelaunchForUpdater:(SUUpdater *)updater;
+
+@end
+
+// Define some minimum intervals to avoid DOS-like checking attacks. These are in seconds.
+#ifdef DEBUG
+#define SU_MIN_CHECK_INTERVAL 60
+#else
+#define SU_MIN_CHECK_INTERVAL 60*60
+#endif
+
+#ifdef DEBUG
+#define SU_DEFAULT_CHECK_INTERVAL 60
+#else
+#define SU_DEFAULT_CHECK_INTERVAL 60*60*24
+#endif
+
+#endif
@@ -0,0 +1,27 @@
+//
+// SUVersionComparisonProtocol.h
+// Sparkle
+//
+// Created by Andy Matuschak on 12/21/07.
+// Copyright 2007 Andy Matuschak. All rights reserved.
+//
+
+#ifndef SUVERSIONCOMPARISONPROTOCOL_H
+#define SUVERSIONCOMPARISONPROTOCOL_H
+
+/*!
+ @protocol
+ @abstract Implement this protocol to provide version comparison facilities for Sparkle.
+*/
+@protocol SUVersionComparison
+
+/*!
+ @method
+ @abstract An abstract method to compare two version strings.
+ @discussion Should return NSOrderedAscending if b > a, NSOrderedDescending if b < a, and NSOrderedSame if they are equivalent.
+*/
+- (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB;
+
+@end
+
+#endif
Oops, something went wrong.

0 comments on commit de7b8a7

Please sign in to comment.