Compare commits
2
Commits
0.3.2
...
single-domain
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b12e8faa7 | ||
|
|
e8c0e4748e |
@@ -16,6 +16,9 @@
|
||||
53710D7417D8F59700A992DE /* SQRLDeepCodesignSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 53710D7317D8F59700A992DE /* SQRLDeepCodesignSpec.m */; };
|
||||
53710D8417D8F5CB00A992DE /* deep-codesign in Resources */ = {isa = PBXBuildFile; fileRef = 53710D7F17D8F5C300A992DE /* deep-codesign */; };
|
||||
5395C0E317E9D013001648E8 /* SQRLUpdateSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5395C0E217E9D013001648E8 /* SQRLUpdateSpec.m */; };
|
||||
53A60408182134F9002DB2C7 /* Squirrel-Constants.h in Headers */ = {isa = PBXBuildFile; fileRef = 53A60406182134F9002DB2C7 /* Squirrel-Constants.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
53A60409182134F9002DB2C7 /* Squirrel-Constants.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A60407182134F9002DB2C7 /* Squirrel-Constants.m */; };
|
||||
53A6040A182134F9002DB2C7 /* Squirrel-Constants.m in Sources */ = {isa = PBXBuildFile; fileRef = 53A60407182134F9002DB2C7 /* Squirrel-Constants.m */; };
|
||||
53AACF4B17E9CA0500B41027 /* SQRLUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = 53AACF4917E9CA0500B41027 /* SQRLUpdate.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
53AACF4C17E9CA0500B41027 /* SQRLUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 53AACF4A17E9CA0500B41027 /* SQRLUpdate.m */; };
|
||||
D000218F17BACEFF0050109A /* SQRLZipArchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = D000218D17BACEFF0050109A /* SQRLZipArchiver.m */; };
|
||||
@@ -391,6 +394,8 @@
|
||||
53710D8217D8F5C300A992DE /* targets.awk */ = {isa = PBXFileReference; lastKnownFileType = text; path = targets.awk; sourceTree = "<group>"; };
|
||||
53710D8317D8F5C300A992DE /* xcodebuild.awk */ = {isa = PBXFileReference; lastKnownFileType = text; path = xcodebuild.awk; sourceTree = "<group>"; };
|
||||
5395C0E217E9D013001648E8 /* SQRLUpdateSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SQRLUpdateSpec.m; sourceTree = "<group>"; };
|
||||
53A60406182134F9002DB2C7 /* Squirrel-Constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Squirrel-Constants.h"; sourceTree = "<group>"; };
|
||||
53A60407182134F9002DB2C7 /* Squirrel-Constants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Squirrel-Constants.m"; sourceTree = "<group>"; };
|
||||
53AACF4917E9CA0500B41027 /* SQRLUpdate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQRLUpdate.h; sourceTree = "<group>"; };
|
||||
53AACF4A17E9CA0500B41027 /* SQRLUpdate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SQRLUpdate.m; sourceTree = "<group>"; };
|
||||
D000218C17BACEFF0050109A /* SQRLZipArchiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQRLZipArchiver.h; sourceTree = "<group>"; };
|
||||
@@ -591,6 +596,15 @@
|
||||
path = script;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
53A603F7182134D3002DB2C7 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
53A60406182134F9002DB2C7 /* Squirrel-Constants.h */,
|
||||
53A60407182134F9002DB2C7 /* Squirrel-Constants.m */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D00F5B8217E82CFB009A4818 /* Extensions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -705,9 +719,9 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D0A56BA41804B1FD00A84EDC /* Mantle.framework */,
|
||||
D0A56BA61804B1FD00A84EDC /* Mantle Mac Tests.octest */,
|
||||
D0A56BA61804B1FD00A84EDC /* Mantle Tests.octest */,
|
||||
D0A56BA81804B1FD00A84EDC /* libMantle-iOS.a */,
|
||||
D0A56BAA1804B1FD00A84EDC /* Mantle iOS Tests.octest */,
|
||||
D0A56BAA1804B1FD00A84EDC /* Mantle-iOS Tests.octest */,
|
||||
D0A56BAC1804B1FD00A84EDC /* libMantle-Mac.a */,
|
||||
);
|
||||
name = Products;
|
||||
@@ -926,6 +940,7 @@
|
||||
D0A56BF61804BABB00A84EDC /* Code Signing */,
|
||||
D0A56BE71804BA2400A84EDC /* State */,
|
||||
D06B58BC18032BE800656D97 /* Transactions */,
|
||||
53A603F7182134D3002DB2C7 /* Supporting Files */,
|
||||
);
|
||||
name = Shared;
|
||||
path = Squirrel;
|
||||
@@ -979,6 +994,7 @@
|
||||
D0C22C52179CC23900158214 /* Squirrel.h in Headers */,
|
||||
D0964B3817F2E01500D88BF7 /* SQRLDownloadedUpdate.h in Headers */,
|
||||
53AACF4B17E9CA0500B41027 /* SQRLUpdate.h in Headers */,
|
||||
53A60408182134F9002DB2C7 /* Squirrel-Constants.h in Headers */,
|
||||
D00F5B8B17E82D15009A4818 /* NSProcessInfo+SQRLVersionExtensions.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -1153,10 +1169,9 @@
|
||||
remoteRef = D0A56BA31804B1FD00A84EDC /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
D0A56BA61804B1FD00A84EDC /* Mantle Mac Tests.octest */ = {
|
||||
D0A56BA61804B1FD00A84EDC /* Mantle Tests.octest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
name = "Mantle Mac Tests.octest";
|
||||
path = "Mantle Tests.octest";
|
||||
remoteRef = D0A56BA51804B1FD00A84EDC /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
@@ -1168,10 +1183,9 @@
|
||||
remoteRef = D0A56BA71804B1FD00A84EDC /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
D0A56BAA1804B1FD00A84EDC /* Mantle iOS Tests.octest */ = {
|
||||
D0A56BAA1804B1FD00A84EDC /* Mantle-iOS Tests.octest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
name = "Mantle iOS Tests.octest";
|
||||
path = "Mantle-iOS Tests.octest";
|
||||
remoteRef = D0A56BA91804B1FD00A84EDC /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
@@ -1361,6 +1375,7 @@
|
||||
D014AC0517B97885007D79D0 /* ShipIt-main.m in Sources */,
|
||||
D014AC1917B979A8007D79D0 /* SQRLCodeSignature.m in Sources */,
|
||||
D06B58B618032B1500656D97 /* RACSignal+SQRLTransactionExtensions.m in Sources */,
|
||||
53A6040A182134F9002DB2C7 /* Squirrel-Constants.m in Sources */,
|
||||
D014AC1A17B979AA007D79D0 /* NSError+SQRLVerbosityExtensions.m in Sources */,
|
||||
D0D2B6271804E903000EA901 /* SQRLDirectoryManager.m in Sources */,
|
||||
D0964B3E17F2E20B00D88BF7 /* NSBundle+SQRLVersionExtensions.m in Sources */,
|
||||
@@ -1391,6 +1406,7 @@
|
||||
D0EDBE9D17B0C68E0058BC3C /* NSError+SQRLVerbosityExtensions.m in Sources */,
|
||||
53AACF4C17E9CA0500B41027 /* SQRLUpdate.m in Sources */,
|
||||
D0A56BEB1804BA3C00A84EDC /* SQRLShipItState.m in Sources */,
|
||||
53A60409182134F9002DB2C7 /* Squirrel-Constants.m in Sources */,
|
||||
D00F5B8C17E82D15009A4818 /* NSProcessInfo+SQRLVersionExtensions.m in Sources */,
|
||||
D06B58B518032B1500656D97 /* RACSignal+SQRLTransactionExtensions.m in Sources */,
|
||||
);
|
||||
|
||||
@@ -9,16 +9,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Mantle/Mantle.h>
|
||||
|
||||
// The domain for errors originating within SQRLCodeSignature.
|
||||
extern NSString * const SQRLCodeSignatureErrorDomain;
|
||||
|
||||
// The bundle did not pass codesign verification.
|
||||
extern const NSInteger SQRLCodeSignatureErrorDidNotPass;
|
||||
|
||||
// A static code object could not be created for the target bundle or running
|
||||
// code.
|
||||
extern const NSInteger SQRLCodeSignatureErrorCouldNotCreateStaticCode;
|
||||
|
||||
@class RACSignal;
|
||||
|
||||
// Implements the verification of Apple code signatures.
|
||||
|
||||
@@ -10,11 +10,7 @@
|
||||
#import <ReactiveCocoa/EXTScope.h>
|
||||
#import <ReactiveCocoa/ReactiveCocoa.h>
|
||||
#import <Security/Security.h>
|
||||
|
||||
NSString * const SQRLCodeSignatureErrorDomain = @"SQRLCodeSignatureErrorDomain";
|
||||
|
||||
const NSInteger SQRLCodeSignatureErrorDidNotPass = -1;
|
||||
const NSInteger SQRLCodeSignatureErrorCouldNotCreateStaticCode = -2;
|
||||
#import "Squirrel-Constants.h"
|
||||
|
||||
@interface SQRLCodeSignature ()
|
||||
|
||||
@@ -99,7 +95,7 @@ const NSInteger SQRLCodeSignatureErrorCouldNotCreateStaticCode = -2;
|
||||
NSString *failureReason = CFBridgingRelease(SecCopyErrorMessageString(result, NULL));
|
||||
if (failureReason != nil) userInfo[NSLocalizedFailureReasonErrorKey] = failureReason;
|
||||
|
||||
[subscriber sendError:[NSError errorWithDomain:SQRLCodeSignatureErrorDomain code:SQRLCodeSignatureErrorCouldNotCreateStaticCode userInfo:userInfo]];
|
||||
[subscriber sendError:[NSError errorWithDomain:SQRLErrorDomain code:SQRLCodeSignatureErrorCouldNotCreateStaticCode userInfo:userInfo]];
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -118,7 +114,7 @@ const NSInteger SQRLCodeSignatureErrorCouldNotCreateStaticCode = -2;
|
||||
if (failureReason != nil) userInfo[NSLocalizedFailureReasonErrorKey] = failureReason;
|
||||
if (validityError != NULL) userInfo[NSUnderlyingErrorKey] = (__bridge NSError *)validityError;
|
||||
|
||||
[subscriber sendError:[NSError errorWithDomain:SQRLCodeSignatureErrorDomain code:SQRLCodeSignatureErrorDidNotPass userInfo:userInfo]];
|
||||
[subscriber sendError:[NSError errorWithDomain:SQRLErrorDomain code:SQRLCodeSignatureErrorDidNotPass userInfo:userInfo]];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// The domain for errors originating within SQRLInstaller.
|
||||
extern NSString * const SQRLInstallerErrorDomain;
|
||||
|
||||
// There was an error copying the target bundle to the backup location.
|
||||
extern const NSInteger SQRLInstallerErrorBackupFailed;
|
||||
|
||||
|
||||
@@ -18,8 +18,7 @@
|
||||
#import <ReactiveCocoa/EXTScope.h>
|
||||
#import <ReactiveCocoa/ReactiveCocoa.h>
|
||||
#import <sys/xattr.h>
|
||||
|
||||
NSString * const SQRLInstallerErrorDomain = @"SQRLInstallerErrorDomain";
|
||||
#import "Squirrel-Constants.h"
|
||||
|
||||
const NSInteger SQRLInstallerErrorBackupFailed = -1;
|
||||
const NSInteger SQRLInstallerErrorReplacingTarget = -2;
|
||||
@@ -236,7 +235,7 @@ typedef struct {
|
||||
NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"Try installing the update again.", nil)
|
||||
};
|
||||
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLInstallerErrorDomain code:SQRLInstallerErrorInvalidState userInfo:userInfo]];
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLErrorDomain code:SQRLInstallerErrorInvalidState userInfo:userInfo]];
|
||||
}
|
||||
|
||||
SEL selector = dispatchTable[tableIndex].selector;
|
||||
@@ -619,7 +618,7 @@ typedef struct {
|
||||
NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"Try installing the update again.", nil)
|
||||
};
|
||||
|
||||
return [NSError errorWithDomain:SQRLInstallerErrorDomain code:SQRLInstallerErrorMissingInstallationData userInfo:userInfo];
|
||||
return [NSError errorWithDomain:SQRLErrorDomain code:SQRLInstallerErrorMissingInstallationData userInfo:userInfo];
|
||||
}
|
||||
|
||||
- (NSError *)errorByAddingDescription:(NSString *)description code:(NSInteger)code toError:(NSError *)error {
|
||||
@@ -628,7 +627,7 @@ typedef struct {
|
||||
if (description != nil) userInfo[NSLocalizedDescriptionKey] = description;
|
||||
if (error != nil) userInfo[NSUnderlyingErrorKey] = error;
|
||||
|
||||
return [NSError errorWithDomain:SQRLInstallerErrorDomain code:code userInfo:userInfo];
|
||||
return [NSError errorWithDomain:SQRLErrorDomain code:code userInfo:userInfo];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -10,12 +10,6 @@
|
||||
|
||||
@class RACSignal;
|
||||
|
||||
// The domain for errors originating within SQRLShipItLauncher.
|
||||
extern NSString * const SQRLShipItLauncherErrorDomain;
|
||||
|
||||
// The ShipIt service could not be started.
|
||||
extern const NSInteger SQRLShipItLauncherErrorCouldNotStartService;
|
||||
|
||||
// Responsible for launching the ShipIt service to actually install an update.
|
||||
@interface SQRLShipItLauncher : NSObject
|
||||
|
||||
|
||||
@@ -13,10 +13,7 @@
|
||||
#import <Security/Security.h>
|
||||
#import <ServiceManagement/ServiceManagement.h>
|
||||
#import <launch.h>
|
||||
|
||||
NSString * const SQRLShipItLauncherErrorDomain = @"SQRLShipItLauncherErrorDomain";
|
||||
|
||||
const NSInteger SQRLShipItLauncherErrorCouldNotStartService = 1;
|
||||
#import "Squirrel-Constants.h"
|
||||
|
||||
@implementation SQRLShipItLauncher
|
||||
|
||||
|
||||
@@ -8,22 +8,6 @@
|
||||
|
||||
#import <Mantle/Mantle.h>
|
||||
|
||||
// The domain for errors originating within `SQRLShipItState`.
|
||||
extern NSString * const SQRLShipItStateErrorDomain;
|
||||
|
||||
// A required property was `nil` upon initialization.
|
||||
//
|
||||
// The `userInfo` dictionary for this error will contain
|
||||
// `SQRLShipItStatePropertyErrorKey`.
|
||||
extern const NSInteger SQRLShipItStateErrorMissingRequiredProperty;
|
||||
|
||||
// The saved state on disk could not be unarchived, possibly because it's
|
||||
// invalid.
|
||||
extern const NSInteger SQRLShipItStateErrorUnarchiving;
|
||||
|
||||
// The state object could not be archived.
|
||||
extern const NSInteger SQRLShipItStateErrorArchiving;
|
||||
|
||||
// Associated with an NSString indicating the required property key that did not
|
||||
// have a value upon initialization.
|
||||
extern NSString * const SQRLShipItStatePropertyErrorKey;
|
||||
|
||||
@@ -8,14 +8,10 @@
|
||||
|
||||
#import "SQRLShipItState.h"
|
||||
#import <ReactiveCocoa/ReactiveCocoa.h>
|
||||
#import "Squirrel-Constants.h"
|
||||
|
||||
NSString * const SQRLShipItStateErrorDomain = @"SQRLShipItStateErrorDomain";
|
||||
NSString * const SQRLShipItStatePropertyErrorKey = @"SQRLShipItStatePropertyErrorKey";
|
||||
|
||||
const NSInteger SQRLShipItStateErrorMissingRequiredProperty = 1;
|
||||
const NSInteger SQRLShipItStateErrorUnarchiving = 2;
|
||||
const NSInteger SQRLShipItStateErrorArchiving = 3;
|
||||
|
||||
@implementation SQRLShipItState
|
||||
|
||||
#pragma mark Lifecycle
|
||||
@@ -33,7 +29,7 @@ const NSInteger SQRLShipItStateErrorArchiving = 3;
|
||||
NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:NSLocalizedString(@"\"%@\" must not be set to nil.", nil), key]
|
||||
};
|
||||
|
||||
*error = [NSError errorWithDomain:SQRLShipItStateErrorDomain code:SQRLShipItStateErrorMissingRequiredProperty userInfo:userInfo];
|
||||
*error = [NSError errorWithDomain:SQRLErrorDomain code:SQRLShipItStateErrorMissingRequiredProperty userInfo:userInfo];
|
||||
}
|
||||
|
||||
return NO;
|
||||
@@ -78,7 +74,7 @@ const NSInteger SQRLShipItStateErrorArchiving = 3;
|
||||
NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"An unknown error occurred while unarchiving.", nil)
|
||||
};
|
||||
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLShipItStateErrorDomain code:SQRLShipItStateErrorUnarchiving userInfo:userInfo]];
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLErrorDomain code:SQRLShipItStateErrorUnarchiving userInfo:userInfo]];
|
||||
}
|
||||
|
||||
return [RACSignal return:state];
|
||||
@@ -97,7 +93,7 @@ const NSInteger SQRLShipItStateErrorArchiving = 3;
|
||||
NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"An unknown error occurred while archiving.", nil)
|
||||
};
|
||||
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLShipItStateErrorDomain code:SQRLShipItStateErrorArchiving userInfo:userInfo]];
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLErrorDomain code:SQRLShipItStateErrorArchiving userInfo:userInfo]];
|
||||
}
|
||||
|
||||
return [RACSignal return:data];
|
||||
|
||||
@@ -6,30 +6,6 @@
|
||||
// Copyright (c) 2013 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
// The domain for errors originating within SQRLUpdater.
|
||||
extern NSString * const SQRLUpdaterErrorDomain;
|
||||
|
||||
// The downloaded update does not contain an app bundle, or it was deleted on
|
||||
// disk before we could get to it.
|
||||
extern const NSInteger SQRLUpdaterErrorMissingUpdateBundle;
|
||||
|
||||
// An error occurred in the out-of-process updater while it was setting up.
|
||||
extern const NSInteger SQRLUpdaterErrorPreparingUpdateJob;
|
||||
|
||||
// The code signing requirement for the running application could not be
|
||||
// retrieved.
|
||||
extern const NSInteger SQRLUpdaterErrorRetrievingCodeSigningRequirement;
|
||||
|
||||
// The server sent a response that we didn't understand.
|
||||
//
|
||||
// Includes `SQRLUpdaterServerDataErrorKey` in the error's `userInfo`.
|
||||
extern const NSInteger SQRLUpdaterErrorInvalidServerResponse;
|
||||
|
||||
// The server sent update JSON that we didn't understand.
|
||||
//
|
||||
// Includes `SQRLUpdaterJSONObjectErrorKey` in the error's `userInfo`.
|
||||
extern const NSInteger SQRLUpdaterErrorInvalidJSON;
|
||||
|
||||
// Associated with the `NSData` received from the server when an error with code
|
||||
// `SQRLUpdaterErrorInvalidServerResponse` is generated.
|
||||
extern NSString * const SQRLUpdaterServerDataErrorKey;
|
||||
|
||||
+5
-11
@@ -20,17 +20,11 @@
|
||||
#import "SQRLZipArchiver.h"
|
||||
#import <ReactiveCocoa/EXTScope.h>
|
||||
#import <ReactiveCocoa/ReactiveCocoa.h>
|
||||
#import "Squirrel-Constants.h"
|
||||
|
||||
NSString * const SQRLUpdaterErrorDomain = @"SQRLUpdaterErrorDomain";
|
||||
NSString * const SQRLUpdaterServerDataErrorKey = @"SQRLUpdaterServerDataErrorKey";
|
||||
NSString * const SQRLUpdaterJSONObjectErrorKey = @"SQRLUpdaterJSONObjectErrorKey";
|
||||
|
||||
const NSInteger SQRLUpdaterErrorMissingUpdateBundle = 2;
|
||||
const NSInteger SQRLUpdaterErrorPreparingUpdateJob = 3;
|
||||
const NSInteger SQRLUpdaterErrorRetrievingCodeSigningRequirement = 4;
|
||||
const NSInteger SQRLUpdaterErrorInvalidServerResponse = 5;
|
||||
const NSInteger SQRLUpdaterErrorInvalidJSON = 6;
|
||||
|
||||
@interface SQRLUpdater ()
|
||||
|
||||
// The code signature for the running application, used to check updates before
|
||||
@@ -222,7 +216,7 @@ const NSInteger SQRLUpdaterErrorInvalidJSON = 6;
|
||||
userInfo[SQRLUpdaterServerDataErrorKey] = data;
|
||||
if (error != nil) userInfo[NSUnderlyingErrorKey] = error;
|
||||
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLUpdaterErrorDomain code:SQRLUpdaterErrorInvalidServerResponse userInfo:userInfo]];
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLErrorDomain code:SQRLUpdaterErrorInvalidServerResponse userInfo:userInfo]];
|
||||
}
|
||||
|
||||
Class updateClass = self.updateClass;
|
||||
@@ -239,7 +233,7 @@ const NSInteger SQRLUpdaterErrorInvalidJSON = 6;
|
||||
userInfo[SQRLUpdaterJSONObjectErrorKey] = JSON;
|
||||
if (error != nil) userInfo[NSUnderlyingErrorKey] = error;
|
||||
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLUpdaterErrorDomain code:SQRLUpdaterErrorInvalidJSON userInfo:userInfo]];
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLErrorDomain code:SQRLUpdaterErrorInvalidJSON userInfo:userInfo]];
|
||||
}
|
||||
|
||||
return [RACSignal return:update];
|
||||
@@ -375,7 +369,7 @@ const NSInteger SQRLUpdaterErrorInvalidJSON = 6;
|
||||
NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedString(@"Could not locate update bundle for %@ within %@", nil), NSRunningApplication.currentApplication.bundleIdentifier, directory],
|
||||
};
|
||||
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLUpdaterErrorDomain code:SQRLUpdaterErrorMissingUpdateBundle userInfo:userInfo]];
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLErrorDomain code:SQRLUpdaterErrorMissingUpdateBundle userInfo:userInfo]];
|
||||
}
|
||||
}]
|
||||
map:^(NSURL *URL) {
|
||||
@@ -423,7 +417,7 @@ const NSInteger SQRLUpdaterErrorInvalidJSON = 6;
|
||||
NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:NSLocalizedString(@"An update for %@ is already in progress.", nil), NSRunningApplication.currentApplication.bundleIdentifier],
|
||||
};
|
||||
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLUpdaterErrorDomain code:SQRLUpdaterErrorPreparingUpdateJob userInfo:userInfo]];
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLErrorDomain code:SQRLUpdaterErrorPreparingUpdateJob userInfo:userInfo]];
|
||||
}
|
||||
|
||||
return [RACSignal empty];
|
||||
|
||||
@@ -10,17 +10,10 @@
|
||||
|
||||
@class RACSignal;
|
||||
|
||||
extern NSString * const SQRLZipArchiverErrorDomain;
|
||||
|
||||
// Associated with an NSNumber containing the code that a shell task exited
|
||||
// with.
|
||||
extern NSString * const SQRLZipArchiverExitCodeErrorKey;
|
||||
|
||||
// `SQRLZipArchiver` tried to invoke the shell and failed.
|
||||
//
|
||||
// Contains `SQRLZipArchiverExitStatusErrorKey` in the `userInfo` dictionary.
|
||||
extern const NSInteger SQRLZipArchiverShellTaskFailed;
|
||||
|
||||
// Uses `ditto` on the command line to zip and unzip archives.
|
||||
@interface SQRLZipArchiver : NSObject
|
||||
|
||||
|
||||
@@ -9,10 +9,9 @@
|
||||
#import "SQRLZipArchiver.h"
|
||||
#import <ReactiveCocoa/EXTScope.h>
|
||||
#import <ReactiveCocoa/ReactiveCocoa.h>
|
||||
#import "Squirrel-Constants.h"
|
||||
|
||||
NSString * const SQRLZipArchiverErrorDomain = @"SQRLZipArchiverErrorDomain";
|
||||
NSString * const SQRLZipArchiverExitCodeErrorKey = @"SQRLZipArchiverExitCodeErrorKey";
|
||||
const NSInteger SQRLZipArchiverShellTaskFailed = 1;
|
||||
|
||||
@interface SQRLZipArchiver () {
|
||||
RACSubject *_taskTerminated;
|
||||
@@ -143,7 +142,7 @@ const NSInteger SQRLZipArchiverShellTaskFailed = 1;
|
||||
errorString = [errorString stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
|
||||
if (errorString.length > 0) userInfo[NSLocalizedDescriptionKey] = errorString;
|
||||
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLZipArchiverErrorDomain code:SQRLZipArchiverShellTaskFailed userInfo:userInfo]];
|
||||
return [RACSignal error:[NSError errorWithDomain:SQRLErrorDomain code:SQRLZipArchiverShellTaskFailed userInfo:userInfo]];
|
||||
}];
|
||||
}]
|
||||
take:1]
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
// updating will abort.
|
||||
static const NSUInteger SQRLShipItMaximumInstallationAttempts = 3;
|
||||
|
||||
// The domain for errors generated here.
|
||||
static NSString * const SQRLShipItErrorDomain = @"SQRLShipItErrorDomain";
|
||||
|
||||
// Waits for all instances of the target application (as described in the
|
||||
// `state`) to exit, then sends completed.
|
||||
static RACSignal *waitForTerminationIfNecessary(SQRLShipItState *state) {
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// Squirrel-Constants.h
|
||||
// Squirrel
|
||||
//
|
||||
// Created by Keith Duncan on 30/10/2013.
|
||||
// Copyright (c) 2013 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// Error domain for errors originating in Squirrel.
|
||||
extern NSString * const SQRLErrorDomain;
|
||||
|
||||
// Error codes for errors originating in Squirrel.
|
||||
//
|
||||
// SQRLCodeSignatureErrorDidNotPass - The bundle did not pass codesign
|
||||
// verification.
|
||||
//
|
||||
// SQRLCodeSignatureErrorCouldNotCreateStaticCode - A static code object could
|
||||
// not be created for the target bundle or running code.
|
||||
//
|
||||
// SQRLShipItStateErrorMissingRequiredProperty - A required property was `nil`
|
||||
// upon initialization. Includes `SQRLShipItStatePropertyErrorKey` in the
|
||||
// error's `userInfo` dictionary.
|
||||
//
|
||||
// SQRLShipItStateErrorUnarchiving - The saved state on disk could not be
|
||||
// unarchived, possibly because it's invalid.
|
||||
//
|
||||
// SQRLShipItStateErrorArchiving - The state object could not be archived.
|
||||
//
|
||||
// SQRLUpdaterErrorMissingUpdateBundle - The downloaded update does not contain
|
||||
// an app bundle, or it was deleted on disk before we could get to it.
|
||||
//
|
||||
// SQRLUpdaterErrorPreparingUpdateJob - An error occurred in the out-of-process
|
||||
// updater while it was setting up.
|
||||
//
|
||||
// SQRLUpdaterErrorRetrievingCodeSigningRequirement - The code signing
|
||||
// requirement for the running application could not be retrieved.
|
||||
//
|
||||
// SQRLUpdaterErrorInvalidServerResponse - The server sent a response that we
|
||||
// didn't understand. Includes `SQRLUpdaterServerDataErrorKey` in the error's
|
||||
// `userInfo` dictionary.
|
||||
//
|
||||
// SQRLUpdaterErrorInvalidJSON - The server sent update JSON that we didn't
|
||||
// understand. Includes `SQRLUpdaterJSONObjectErrorKey` in the error's
|
||||
// `userInfo` dictionary.
|
||||
//
|
||||
// SQRLZipArchiverShellTaskFailed - `SQRLZipArchiver` tried to invoke the shell
|
||||
// and failed. Includes `SQRLZipArchiverExitStatusErrorKey` in the error's
|
||||
// `userInfo` dictionary.
|
||||
//
|
||||
// SQRLShipItLauncherErrorCouldNotStartService - The ShipIt service could not be
|
||||
// started.
|
||||
typedef enum : NSInteger {
|
||||
SQRLCodeSignatureErrorDidNotPass = -1,
|
||||
SQRLCodeSignatureErrorCouldNotCreateStaticCode = -2,
|
||||
|
||||
SQRLShipItStateErrorMissingRequiredProperty = -100,
|
||||
SQRLShipItStateErrorUnarchiving = -101,
|
||||
SQRLShipItStateErrorArchiving = -102,
|
||||
|
||||
SQRLUpdaterErrorMissingUpdateBundle = -200,
|
||||
SQRLUpdaterErrorPreparingUpdateJob = -201,
|
||||
SQRLUpdaterErrorRetrievingCodeSigningRequirement = -202,
|
||||
SQRLUpdaterErrorInvalidServerResponse = -203,
|
||||
SQRLUpdaterErrorInvalidJSON = -204,
|
||||
|
||||
SQRLZipArchiverShellTaskFailed = -300,
|
||||
|
||||
SQRLShipItLauncherErrorCouldNotStartService = -400,
|
||||
} SQRLErrorCode;
|
||||
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// Squirrel-Constants.m
|
||||
// Squirrel
|
||||
//
|
||||
// Created by Keith Duncan on 30/10/2013.
|
||||
// Copyright (c) 2013 GitHub. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Squirrel-Constants.h"
|
||||
|
||||
NSString * const SQRLErrorDomain = @"SQRLErrorDomain";
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#import "SQRLCodeSignature.h"
|
||||
#import "Squirrel-Constants.h"
|
||||
|
||||
SpecBegin(SQRLCodeSignature)
|
||||
|
||||
@@ -54,7 +55,7 @@ describe(@"code signature changes", ^{
|
||||
expect(success).to.beFalsy();
|
||||
|
||||
expect(error).notTo.beNil();
|
||||
expect(error.domain).to.equal(SQRLCodeSignatureErrorDomain);
|
||||
expect(error.domain).to.equal(SQRLErrorDomain);
|
||||
expect(error.code).to.equal(SQRLCodeSignatureErrorDidNotPass);
|
||||
});
|
||||
|
||||
@@ -66,7 +67,7 @@ describe(@"code signature changes", ^{
|
||||
expect(success).to.beFalsy();
|
||||
|
||||
expect(error).notTo.beNil();
|
||||
expect(error.domain).to.equal(SQRLCodeSignatureErrorDomain);
|
||||
expect(error.domain).to.equal(SQRLErrorDomain);
|
||||
expect(error.code).to.equal(SQRLCodeSignatureErrorDidNotPass);
|
||||
});
|
||||
});
|
||||
@@ -80,7 +81,7 @@ describe(@"main executable changes", ^{
|
||||
expect(success).to.beFalsy();
|
||||
|
||||
expect(error).notTo.beNil();
|
||||
expect(error.domain).to.equal(SQRLCodeSignatureErrorDomain);
|
||||
expect(error.domain).to.equal(SQRLErrorDomain);
|
||||
expect(error.code).to.equal(SQRLCodeSignatureErrorCouldNotCreateStaticCode);
|
||||
});
|
||||
|
||||
@@ -92,7 +93,7 @@ describe(@"main executable changes", ^{
|
||||
expect(success).to.beFalsy();
|
||||
|
||||
expect(error).notTo.beNil();
|
||||
expect(error.domain).to.equal(SQRLCodeSignatureErrorDomain);
|
||||
expect(error.domain).to.equal(SQRLErrorDomain);
|
||||
expect(error.code).to.equal(SQRLCodeSignatureErrorDidNotPass);
|
||||
});
|
||||
});
|
||||
@@ -113,7 +114,7 @@ describe(@"helper executable changes", ^{
|
||||
expect(success).to.beFalsy();
|
||||
|
||||
expect(error).notTo.beNil();
|
||||
expect(error.domain).to.equal(SQRLCodeSignatureErrorDomain);
|
||||
expect(error.domain).to.equal(SQRLErrorDomain);
|
||||
expect(error.code).to.equal(SQRLCodeSignatureErrorDidNotPass);
|
||||
});
|
||||
|
||||
@@ -125,7 +126,7 @@ describe(@"helper executable changes", ^{
|
||||
expect(success).to.beFalsy();
|
||||
|
||||
expect(error).notTo.beNil();
|
||||
expect(error.domain).to.equal(SQRLCodeSignatureErrorDomain);
|
||||
expect(error.domain).to.equal(SQRLErrorDomain);
|
||||
expect(error.code).to.equal(SQRLCodeSignatureErrorDidNotPass);
|
||||
});
|
||||
});
|
||||
@@ -146,7 +147,7 @@ describe(@"resource changes", ^{
|
||||
expect(success).to.beFalsy();
|
||||
|
||||
expect(error).notTo.beNil();
|
||||
expect(error.domain).to.equal(SQRLCodeSignatureErrorDomain);
|
||||
expect(error.domain).to.equal(SQRLErrorDomain);
|
||||
expect(error.code).to.equal(SQRLCodeSignatureErrorDidNotPass);
|
||||
});
|
||||
|
||||
@@ -158,7 +159,7 @@ describe(@"resource changes", ^{
|
||||
expect(success).to.beFalsy();
|
||||
|
||||
expect(error).notTo.beNil();
|
||||
expect(error.domain).to.equal(SQRLCodeSignatureErrorDomain);
|
||||
expect(error.domain).to.equal(SQRLErrorDomain);
|
||||
expect(error.code).to.equal(SQRLCodeSignatureErrorDidNotPass);
|
||||
});
|
||||
});
|
||||
@@ -178,7 +179,7 @@ describe(@"framework changes", ^{
|
||||
expect(success).to.beFalsy();
|
||||
|
||||
expect(error).notTo.beNil();
|
||||
expect(error.domain).to.equal(SQRLCodeSignatureErrorDomain);
|
||||
expect(error.domain).to.equal(SQRLErrorDomain);
|
||||
expect(error.code).to.equal(SQRLCodeSignatureErrorDidNotPass);
|
||||
});
|
||||
|
||||
@@ -190,7 +191,7 @@ describe(@"framework changes", ^{
|
||||
expect(success).to.beFalsy();
|
||||
|
||||
expect(error).notTo.beNil();
|
||||
expect(error.domain).to.equal(SQRLCodeSignatureErrorDomain);
|
||||
expect(error.domain).to.equal(SQRLErrorDomain);
|
||||
expect(error.code).to.equal(SQRLCodeSignatureErrorDidNotPass);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#import "SQRLCodeSignature.h"
|
||||
#import "SQRLZipArchiver.h"
|
||||
#import "Squirrel-Constants.h"
|
||||
|
||||
SpecBegin(SQRLZipArchiver)
|
||||
|
||||
@@ -35,7 +36,7 @@ it(@"should fail to extract a nonexistent zip archive", ^{
|
||||
NSLog(@"%@", error);
|
||||
|
||||
expect(error).notTo.beNil();
|
||||
expect(error.domain).to.equal(SQRLZipArchiverErrorDomain);
|
||||
expect(error.domain).to.equal(SQRLErrorDomain);
|
||||
expect(error.code).to.equal(SQRLZipArchiverShellTaskFailed);
|
||||
expect(error.userInfo[SQRLZipArchiverExitCodeErrorKey]).notTo.equal(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user