Rename SPUInstallerProtocol -> SUInstallerProtocol, remove -cleanup

This is to prepare for the next merge from master.
This commit is contained in:
Zorg committed 2016-12-26 19:12:02 -05:00
1 parent fd533f937e
commit 36ed896d0f
12 files changed
+22 -73

No files matched your search

+3 -12
View File
@@ -65,7 +65,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
@property (nonatomic, assign) BOOL shouldRelaunch;
@property (nonatomic, assign) BOOL shouldShowUI;
@property (nonatomic) id<SPUInstallerProtocol> installer;
@property (nonatomic) id<SUInstallerProtocol> installer;
@property (nonatomic) BOOL willCompleteInstallation;
@property (nonatomic) BOOL receivedInstallationData;
@property (nonatomic) BOOL finishedValidation;
@@ -435,7 +435,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
dispatch_async(self.installerQueue, ^{
NSError *installerError = nil;
id <SPUInstallerProtocol> installer = [SUInstaller installerForHost:self.host expectedInstallationType:self.installationType updateDirectory:self.updateDirectoryPath error:&installerError];
id <SUInstallerProtocol> installer = [SUInstaller installerForHost:self.host expectedInstallationType:self.installationType updateDirectory:self.updateDirectoryPath error:&installerError];
if (installer == nil) {
SULog(@"Error: Failed to create installer instance with error: %@", installerError);
@@ -448,7 +448,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
NSError *firstStageError = nil;
if (![installer performInitialInstallation:&firstStageError]) {
SULog(@"Error: Failed to start installer with error: %@", firstStageError);
[self.installer cleanup];
self.installer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
@@ -501,7 +500,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
});
} else {
SULog(@"Error: Failed to resume installer on stage 2 because installation cannot be installed silently");
[self.installer cleanup];
self.installer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
@@ -556,7 +554,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
if (![self.installer performFinalInstallation:&thirdStageError]) {
SULog(@"Failed to finalize installation with error: %@", thirdStageError);
[self.installer cleanup];
self.installer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
@@ -590,13 +587,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
[self.agentConnection.agent relaunchPath:pathToRelaunch];
}
dispatch_async(self.installerQueue, ^{
[self.installer cleanup];
dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:EXIT_SUCCESS];
});
});
[self cleanupAndExitWithStatus:EXIT_SUCCESS];
});
});
}];
+2 -2
View File
@@ -17,9 +17,9 @@ A guided installation can be started by applications other than the application
*/
#import <Foundation/Foundation.h>
#import "SPUInstallerProtocol.h"
#import "SUInstallerProtocol.h"
@interface SUGuidedPackageInstaller : NSObject <SPUInstallerProtocol>
@interface SUGuidedPackageInstaller : NSObject <SUInstallerProtocol>
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath;
-4
View File
@@ -76,8 +76,4 @@
return YES;
}
- (void)cleanup
{
}
@end
+2 -2
View File
@@ -7,7 +7,7 @@
//
#import <Foundation/Foundation.h>
#import "SPUInstallerProtocol.h"
#import "SUInstallerProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface SUInstaller : NSObject
+ (nullable id<SPUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory error:(NSError **)error;
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory error:(NSError **)error;
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr;
+2 -2
View File
@@ -112,7 +112,7 @@
return newAppDownloadPath;
}
+ (nullable id<SPUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory error:(NSError * __autoreleasing *)error
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory error:(NSError * __autoreleasing *)error
{
BOOL isPackage = NO;
BOOL isGuided = NO;
@@ -128,7 +128,7 @@
// Make sure we find the type of installer that we were expecting to find
// We shouldn't implicitly trust the installation type fed into here from the appcast because the installation type helps us determine
// ahead of time whether or not this installer tool should be ran as root or not
id <SPUInstallerProtocol> installer = nil;
id <SUInstallerProtocol> installer = nil;
if (isPackage && isGuided) {
if (![expectedInstallationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
if (error != NULL) {
@@ -1,5 +1,5 @@
//
// SPUInstallerProtocol.h
// SUInstallerProtocol.h
// Sparkle
//
// Created by Mayur Pawashe on 3/12/16.
@@ -10,7 +10,7 @@
NS_ASSUME_NONNULL_BEGIN
@protocol SPUInstallerProtocol <NSObject>
@protocol SUInstallerProtocol <NSObject>
// Any installation work can be done prior to user application being terminated and relaunched
// No UI should occur during this stage (i.e, do not show package installer apps, etc..)
@@ -27,10 +27,6 @@ NS_ASSUME_NONNULL_BEGIN
// Should be thread safe
- (BOOL)canInstallSilently;
// Cleans up work done from the initial or final installation (depending on how far installation gets)
// Should be able to be called from non-main thread
- (void)cleanup;
// The destination and installation path of the bundle being updated
- (NSString *)installationPath;
+2 -2
View File
@@ -7,12 +7,12 @@
//
#import <Foundation/Foundation.h>
#import "SPUInstallerProtocol.h"
#import "SUInstallerProtocol.h"
// This is the deprecated package installation type, aka the "interactive" package installer
// For a more supported package installation, see SUGuidedPackageInstaller
@interface SUPackageInstaller : NSObject <SPUInstallerProtocol>
@interface SUPackageInstaller : NSObject <SUInstallerProtocol>
- (instancetype)initWithPackagePath:(NSString *)packagePath installationPath:(NSString *)installationPath;
-4
View File
@@ -79,8 +79,4 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open";
return NO;
}
- (void)cleanup
{
}
@end
+2 -2
View File
@@ -7,12 +7,12 @@
//
#import <Foundation/Foundation.h>
#import "SPUInstallerProtocol.h"
#import "SUInstallerProtocol.h"
@class SUHost;
@protocol SUVersionComparison;
@interface SUPlainInstaller : NSObject <SPUInstallerProtocol>
@interface SUPlainInstaller : NSObject <SUInstallerProtocol>
/*!
@param host The current (old) bundle host
+3 -31
View File
@@ -25,10 +25,6 @@
@property (nonatomic, copy, readonly) NSString *bundlePath;
@property (nonatomic, copy, readonly) NSString *installationPath;
// Properties that carry over from starting installation to resuming to cleaning up
@property (nonatomic) NSURL *tempOldDirectoryURL;
@property (nonatomic) NSURL *tempNewDirectoryURL;
@end
@implementation SUPlainInstaller
@@ -36,8 +32,6 @@
@synthesize host = _host;
@synthesize bundlePath = _bundlePath;
@synthesize installationPath = _installationPath;
@synthesize tempOldDirectoryURL = _tempOldDirectoryURL;
@synthesize tempNewDirectoryURL = _tempNewDirectoryURL;
- (instancetype)initWithHost:(SUHost *)host bundlePath:(NSString *)bundlePath installationPath:(NSString *)installationPath
{
@@ -179,9 +173,9 @@
return NO;
}
// To carry over when we clean up the installation
self.tempNewDirectoryURL = tempNewDirectoryURL;
self.tempOldDirectoryURL = tempOldDirectoryURL;
// Cleanup
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
return YES;
}
@@ -221,26 +215,4 @@
return YES;
}
- (void)cleanup
{
SUFileManager *fileManager = [[SUFileManager alloc] init];
NSURL *tempOldDirectoryURL = self.tempOldDirectoryURL;
NSURL *tempNewDirectoryURL = self.tempNewDirectoryURL;
// Note: I'm intentionally not checking if an item at the file URLs exist since these methods already do that for us
if (tempOldDirectoryURL != nil) {
// This will remove the old app contained inside the directory as well
[fileManager removeItemAtURL:tempOldDirectoryURL error:NULL];
self.tempOldDirectoryURL = nil;
}
if (tempNewDirectoryURL != nil) {
[fileManager removeItemAtURL:tempNewDirectoryURL error:NULL];
self.tempNewDirectoryURL = nil;
}
}
@end
+2 -2
View File
@@ -999,7 +999,7 @@
7267E5B01D3D8AD500D1BF90 /* SPUMessageTypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SPUMessageTypes.m; path = Autoupdate/SPUMessageTypes.m; sourceTree = SOURCE_ROOT; };
7267E5B41D3D8AEE00D1BF90 /* SPUInstallationInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPUInstallationInfo.h; path = Autoupdate/SPUInstallationInfo.h; sourceTree = SOURCE_ROOT; };
7267E5B51D3D8AEE00D1BF90 /* SPUInstallationInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SPUInstallationInfo.m; path = Autoupdate/SPUInstallationInfo.m; sourceTree = SOURCE_ROOT; };
7267E5B91D3D8B0B00D1BF90 /* SPUInstallerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SPUInstallerProtocol.h; path = Autoupdate/SPUInstallerProtocol.h; sourceTree = SOURCE_ROOT; };
7267E5B91D3D8B0B00D1BF90 /* SUInstallerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUInstallerProtocol.h; path = Autoupdate/SUInstallerProtocol.h; sourceTree = SOURCE_ROOT; };
7267E5BA1D3D8B2700D1BF90 /* SUGuidedPackageInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUGuidedPackageInstaller.h; path = Autoupdate/SUGuidedPackageInstaller.h; sourceTree = SOURCE_ROOT; };
7267E5BB1D3D8B2700D1BF90 /* SUGuidedPackageInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUGuidedPackageInstaller.m; path = Autoupdate/SUGuidedPackageInstaller.m; sourceTree = SOURCE_ROOT; };
7267E5BC1D3D8B2700D1BF90 /* SUInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUInstaller.h; path = Autoupdate/SUInstaller.h; sourceTree = SOURCE_ROOT; };
@@ -1566,7 +1566,7 @@
618FA6DB0DB485440026945C /* Installation */ = {
isa = PBXGroup;
children = (
7267E5B91D3D8B0B00D1BF90 /* SPUInstallerProtocol.h */,
7267E5B91D3D8B0B00D1BF90 /* SUInstallerProtocol.h */,
7267E5BC1D3D8B2700D1BF90 /* SUInstaller.h */,
7267E5BD1D3D8B2700D1BF90 /* SUInstaller.m */,
7267E5C01D3D8B2700D1BF90 /* SUPlainInstaller.h */,
+2 -4
View File
@@ -10,7 +10,7 @@
#import <XCTest/XCTest.h>
#import "SUHost.h"
#import "SUInstaller.h"
#import "SPUInstallerProtocol.h"
#import "SUInstallerProtocol.h"
#import "SPUInstallationType.h"
#import <unistd.h>
@@ -54,7 +54,7 @@
SUHost *host = [[SUHost alloc] initWithBundle:bundle];
NSError *installerError = nil;
id<SPUInstallerProtocol> installer = [SUInstaller installerForHost:host expectedInstallationType:SPUInstallationTypeGuidedPackage updateDirectory:[path stringByDeletingLastPathComponent] error:&installerError];
id<SUInstallerProtocol> installer = [SUInstaller installerForHost:host expectedInstallationType:SPUInstallationTypeGuidedPackage updateDirectory:[path stringByDeletingLastPathComponent] error:&installerError];
if (installer == nil) {
XCTFail(@"Installer is nil with error: %@", installerError);
@@ -73,8 +73,6 @@
return;
}
[installer cleanup];
XCTAssertTrue([fm fileExistsAtPath:expectedDestination isDirectory:nil]);
[fm removeItemAtPath:expectedDestination error:nil];