Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "jspahrsummers/xcconfigs" >= 0.7.1
github "Quick/Quick" ~> 0.6
github "Quick/Nimble" ~> 2.0
github "ZipArchive/ZipArchive" ~> 0.3
github "Quick/Quick" ~> 0.9.1
github "Quick/Nimble" ~> 3.1
github "ZipArchive/ZipArchive" == 1.0.1
8 changes: 4 additions & 4 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "Quick/Nimble" "v2.0.0"
github "Quick/Quick" "v0.6.0"
github "ZipArchive/ZipArchive" "v0.3.3"
github "jspahrsummers/xcconfigs" "0.8.1"
github "Quick/Nimble" "v3.1.0"
github "Quick/Quick" "v0.9.1"
github "ZipArchive/ZipArchive" "v1.0.1"
github "jspahrsummers/xcconfigs" "0.9"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Nimble
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Quick
Submodule Quick updated 109 files
2 changes: 1 addition & 1 deletion Carthage/Checkouts/ZipArchive
Submodule ZipArchive updated 72 files
+13 −1 .gitignore
+581 −0 ObjectiveCExample/ObjectiveCExample.xcodeproj/project.pbxproj
+7 −0 ObjectiveCExample/ObjectiveCExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+10 −0 ObjectiveCExample/ObjectiveCExample.xcworkspace/contents.xcworkspacedata
+17 −0 ObjectiveCExample/ObjectiveCExample/AppDelegate.h
+45 −0 ObjectiveCExample/ObjectiveCExample/AppDelegate.m
+68 −0 ObjectiveCExample/ObjectiveCExample/Assets.xcassets/AppIcon.appiconset/Contents.json
+27 −0 ObjectiveCExample/ObjectiveCExample/Base.lproj/LaunchScreen.storyboard
+25 −0 ObjectiveCExample/ObjectiveCExample/Base.lproj/Main.storyboard
+9 −7 ObjectiveCExample/ObjectiveCExample/Info.plist
+15 −0 ObjectiveCExample/ObjectiveCExample/ViewController.h
+27 −0 ObjectiveCExample/ObjectiveCExample/ViewController.m
+16 −0 ObjectiveCExample/ObjectiveCExample/main.m
+1 −0 ObjectiveCExample/ObjectiveCExampleTests/CollectingDelegate.h
+0 −1 ObjectiveCExample/ObjectiveCExampleTests/CollectingDelegate.m
+ ObjectiveCExample/ObjectiveCExampleTests/Fixtures/IncorrectHeaders.zip
+0 −0 ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/Info.plist
+ ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/MacOS/TestProject
+0 −0 ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/PkgInfo
+ ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/Resources/Assets.car
+ ...eCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/Resources/Base.lproj/MainMenu.nib
+0 −0 ...tiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/Resources/en.lproj/Credits.rtf
+ ...xample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/Resources/en.lproj/InfoPlist.strings
+ ObjectiveCExample/ObjectiveCExampleTests/Fixtures/RelativeSymbolicLink.zip
+ ObjectiveCExample/ObjectiveCExampleTests/Fixtures/SymbolicLink.zip
+ ObjectiveCExample/ObjectiveCExampleTests/Fixtures/TestArchive.zip
+ ObjectiveCExample/ObjectiveCExampleTests/Fixtures/TestPasswordArchive.zip
+ ObjectiveCExample/ObjectiveCExampleTests/Fixtures/Unicode.zip
+ ObjectiveCExample/ObjectiveCExampleTests/Fixtures/hello.zip
+4 −2 ObjectiveCExample/ObjectiveCExampleTests/Info.plist
+ ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/0.m4a
+ ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/1.m4a
+ ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/2.m4a
+ ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/3.m4a
+ ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/4.m4a
+ ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/5.m4a
+ ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/6.m4a
+ ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/7.m4a
+97 −113 ObjectiveCExample/ObjectiveCExampleTests/SSZipArchiveTests.m
+8 −0 ObjectiveCExample/Podfile
+14 −0 ObjectiveCExample/Podfile.lock
+39 −30 README.md
+2 −1 SSZipArchive.podspec
+0 −569 SSZipArchive.xcodeproj/project.pbxproj
+0 −96 SSZipArchive.xcodeproj/xcshareddata/xcschemes/SSZipArchive.xcscheme
+43 −0 SSZipArchive/Common.h
+2 −2 SSZipArchive/SSZipArchive.h
+2 −0 SSZipArchive/SSZipArchive.m
+1 −39 SSZipArchive/minizip/unzip.h
+0 −11 Sample Application/SSAppDelegate.h
+0 −19 Sample Application/SSAppDelegate.m
+ Sample Application/Supporting Files/[email protected]
+0 −16 Sample Application/Supporting Files/SSZipArchive-Prefix.pch
+0 −15 Sample Application/Supporting Files/main.m
+8 −0 SwiftExample/Podfile
+14 −0 SwiftExample/Podfile.lock
+528 −0 SwiftExample/SwiftExample.xcodeproj/project.pbxproj
+1 −1 SwiftExample/SwiftExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+10 −0 SwiftExample/SwiftExample.xcworkspace/contents.xcworkspacedata
+46 −0 SwiftExample/SwiftExample/AppDelegate.swift
+68 −0 SwiftExample/SwiftExample/Assets.xcassets/AppIcon.appiconset/Contents.json
+27 −0 SwiftExample/SwiftExample/Base.lproj/LaunchScreen.storyboard
+83 −0 SwiftExample/SwiftExample/Base.lproj/Main.storyboard
+47 −0 SwiftExample/SwiftExample/Info.plist
+9 −0 SwiftExample/SwiftExample/Sample Data/China to ban ivory trade.md
+9 −0 SwiftExample/SwiftExample/Sample Data/Kerry in Syria.md
+ SwiftExample/SwiftExample/Sample Data/wapo twitter banner.png
+120 −0 SwiftExample/SwiftExample/ViewController.swift
+24 −0 SwiftExample/SwiftExampleTests/Info.plist
+36 −0 SwiftExample/SwiftExampleTests/SwiftExampleTests.swift
+ Tests/Fixtures/SymbolicLink.zip
+0 −366 Tests/SSZipArchive.xcodeproj/project.pbxproj
2 changes: 1 addition & 1 deletion Carthage/Checkouts/xcconfigs
53 changes: 47 additions & 6 deletions ObjectiveGitFramework.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@
2089E43C17D9A58000F451DA /* GTTagSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 2089E43B17D9A58000F451DA /* GTTagSpec.m */; };
20F43DE318A2F668007D3621 /* GTRepository+Blame.h in Headers */ = {isa = PBXBuildFile; fileRef = 20F43DE118A2F667007D3621 /* GTRepository+Blame.h */; settings = {ATTRIBUTES = (Public, ); }; };
20F43DE618A2F668007D3621 /* GTRepository+Blame.m in Sources */ = {isa = PBXBuildFile; fileRef = 20F43DE218A2F667007D3621 /* GTRepository+Blame.m */; };
23BB67B91C7DF3B600A37A66 /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D007801B4F9758009A8DAF /* SSZipArchive.m */; };
23BB67BA1C7DF3BC00A37A66 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007841B4F97F9009A8DAF /* unzip.c */; };
23BB67BC1C7DF45300A37A66 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BB67BB1C7DF45300A37A66 /* libz.tbd */; };
23BB67BD1C7DF49500A37A66 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007851B4F97F9009A8DAF /* zip.c */; };
23BB67BE1C7DF4B100A37A66 /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007831B4F97F9009A8DAF /* mztools.c */; };
23BB67BF1C7DF4CD00A37A66 /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007821B4F97F9009A8DAF /* ioapi.c */; };
23BB67C11C7DF60300A37A66 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; };
23BB67C21C7DF60400A37A66 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; };
3011D86B1668E48500CE3409 /* GTDiffFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 3011D8691668E48500CE3409 /* GTDiffFile.h */; settings = {ATTRIBUTES = (Public, ); }; };
3011D86D1668E48500CE3409 /* GTDiffFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 3011D86A1668E48500CE3409 /* GTDiffFile.m */; };
3011D8711668E78500CE3409 /* GTDiffHunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 3011D86F1668E78500CE3409 /* GTDiffHunk.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -363,7 +371,6 @@
F8D1BDF01B31FE7C00CDEC90 /* GTRepository+Pull.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */; };
F8D1BDF11B31FE7C00CDEC90 /* GTRepository+Pull.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */; };
F8E4A2911A170CA6006485A8 /* GTRemotePushSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8E4A2901A170CA6006485A8 /* GTRemotePushSpec.m */; };
F8EFA0371B405020000FF7D0 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; };
F8EFA03A1B4059ED000FF7D0 /* GTUtilityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0391B4059ED000FF7D0 /* GTUtilityFunctions.m */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -444,6 +451,7 @@
2089E43B17D9A58000F451DA /* GTTagSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTTagSpec.m; sourceTree = "<group>"; };
20F43DE118A2F667007D3621 /* GTRepository+Blame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+Blame.h"; sourceTree = "<group>"; };
20F43DE218A2F667007D3621 /* GTRepository+Blame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+Blame.m"; sourceTree = "<group>"; };
23BB67BB1C7DF45300A37A66 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
3011D8691668E48500CE3409 /* GTDiffFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTDiffFile.h; sourceTree = "<group>"; };
3011D86A1668E48500CE3409 /* GTDiffFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTDiffFile.m; sourceTree = "<group>"; };
3011D86F1668E78500CE3409 /* GTDiffHunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTDiffHunk.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -648,6 +656,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
23BB67BC1C7DF45300A37A66 /* libz.tbd in Frameworks */,
D0A0128A19F98475007F1914 /* Quick.framework in Frameworks */,
88F05A9E16011F6E00B7AD1D /* ObjectiveGit.framework in Frameworks */,
D0A0128C19F9853D007F1914 /* Nimble.framework in Frameworks */,
Expand Down Expand Up @@ -704,6 +713,7 @@
0867D691FE84028FC02AAC07 /* ObjectiveGitFramework */ = {
isa = PBXGroup;
children = (
23BB67BB1C7DF45300A37A66 /* libz.tbd */,
BDD8AB01130F01AB00CB5D40 /* README.md */,
887B948D1A3A38130070D41D /* ObjectiveGit.modulemap */,
BDE4C05E130EFE2C00851650 /* ObjectiveGit */,
Expand Down Expand Up @@ -1387,6 +1397,12 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
23BB67BF1C7DF4CD00A37A66 /* ioapi.c in Sources */,
23BB67BE1C7DF4B100A37A66 /* mztools.c in Sources */,
23BB67BD1C7DF49500A37A66 /* zip.c in Sources */,
23BB67BA1C7DF3BC00A37A66 /* unzip.c in Sources */,
23BB67B91C7DF3B600A37A66 /* SSZipArchive.m in Sources */,
23BB67C11C7DF60300A37A66 /* GTRepository+PullSpec.m in Sources */,
D0751CD918BE520400134314 /* GTFilterListSpec.m in Sources */,
200578C518932A82001C06C3 /* GTBlameSpec.m in Sources */,
4D1C40D8182C006D00BE2960 /* GTBlobSpec.m in Sources */,
Expand All @@ -1408,7 +1424,6 @@
D0AC906C172F941F00347DC4 /* GTRepositorySpec.m in Sources */,
D01EFDA0195DEF2200838D24 /* NSDataGitSpec.m in Sources */,
30A269AD17B4878C000FE64E /* GTRepository+StatusSpec.m in Sources */,
F8EFA0371B405020000FF7D0 /* GTRepository+PullSpec.m in Sources */,
307623AB17C6C8BD00E2CDF1 /* NSArray+StringArraySpec.m in Sources */,
8832811F173D8816006D7DCF /* GTIndexSpec.m in Sources */,
D0F4E28A17C7F24200BBDE30 /* NSErrorGitSpec.m in Sources */,
Expand Down Expand Up @@ -1555,6 +1570,7 @@
F8D007761B4F7D10009A8DAF /* GTTimeAdditionsSpec.m in Sources */,
F8D007921B4FA03B009A8DAF /* GTIndexSpec.m in Sources */,
F8D007711B4F7CB0009A8DAF /* NSDataGitSpec.m in Sources */,
23BB67C21C7DF60400A37A66 /* GTRepository+PullSpec.m in Sources */,
F8D007A11B4FA03B009A8DAF /* GTRepositoryStashingSpec.m in Sources */,
F8D007A31B4FA03B009A8DAF /* GTFilterListSpec.m in Sources */,
F8D0079D1B4FA03B009A8DAF /* GTTreeBuilderSpec.m in Sources */,
Expand Down Expand Up @@ -1808,6 +1824,16 @@
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"NOUNCRYPT=1",
"NOCRYPT=1",
);
HEADER_SEARCH_PATHS = (
External/libgit2/include,
/usr/local/include,
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
);
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.9;
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
Expand All @@ -1823,6 +1849,11 @@
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
HEADER_SEARCH_PATHS = (
External/libgit2/include,
/usr/local/include,
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
);
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.9;
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
Expand Down Expand Up @@ -1892,6 +1923,11 @@
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
HEADER_SEARCH_PATHS = (
External/libgit2/include,
/usr/local/include,
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
);
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.9;
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
Expand Down Expand Up @@ -2125,6 +2161,11 @@
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
HEADER_SEARCH_PATHS = (
External/libgit2/include,
/usr/local/include,
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
);
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.9;
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
Expand Down Expand Up @@ -2227,7 +2268,7 @@
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
);
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
.,
Expand Down Expand Up @@ -2279,7 +2320,7 @@
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
);
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
.,
Expand Down Expand Up @@ -2332,7 +2373,7 @@
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
);
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
.,
Expand Down Expand Up @@ -2385,7 +2426,7 @@
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
);
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
.,
Expand Down
3 changes: 0 additions & 3 deletions ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion ObjectiveGitTests/GTRepository+PullSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
[NSFileManager.defaultManager removeItemAtURL:remoteRepoURL error:NULL];
[NSFileManager.defaultManager removeItemAtURL:localRepoURL error:NULL];
error = NULL;
[self tearDown];
});

context(@"when the local and remote branches are in sync", ^{
Expand Down
52 changes: 17 additions & 35 deletions ObjectiveGitTests/QuickSpec+GTFixtures.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
#import <ObjectiveGit/ObjectiveGit.h>
#import "QuickSpec+GTFixtures.h"
#import <objc/runtime.h>

#if TARGET_OS_IPHONE
#import "SSZipArchive.h"
#endif

static const NSInteger FixturesErrorUnzipFailed = 666;

Expand Down Expand Up @@ -67,8 +64,12 @@ - (void)cleanUp {

#pragma mark Fixtures

- (NSString *)rootTempDirectory {
return [NSTemporaryDirectory() stringByAppendingPathComponent:@"com.libgit2.objectivegit"];
}

- (void)setUpTempDirectoryPath {
self.tempDirectoryPath = [[NSTemporaryDirectory() stringByAppendingPathComponent:@"com.libgit2.objectivegit"] stringByAppendingPathComponent:NSProcessInfo.processInfo.globallyUniqueString];
self.tempDirectoryPath = [self.rootTempDirectory stringByAppendingPathComponent:NSProcessInfo.processInfo.globallyUniqueString];

NSError *error = nil;
BOOL success = [NSFileManager.defaultManager createDirectoryAtPath:self.tempDirectoryPath withIntermediateDirectories:YES attributes:nil error:&error];
Expand All @@ -87,9 +88,15 @@ - (void)setUpRepositoryFixtureIfNeeded:(NSString *)repositoryName {

NSString *zippedRepositoriesPath = [[NSBundle bundleForClass:self.class] pathForResource:@"fixtures" ofType:@"zip"];

error = nil;
success = [self unzipFile:repositoryName fromArchiveAtPath:zippedRepositoriesPath intoDirectory:self.repositoryFixturesPath error:&error];
XCTAssertTrue(success, @"Couldn't unzip fixture \"%@\" from %@ to %@: %@", repositoryName, zippedRepositoriesPath, self.repositoryFixturesPath, error);
NSString *cleanRepositoryPath = [self.rootTempDirectory stringByAppendingPathComponent:@"clean_repository"];
if (![NSFileManager.defaultManager fileExistsAtPath:cleanRepositoryPath isDirectory:nil]) {
error = nil;
success = [self unzipFromArchiveAtPath:zippedRepositoriesPath intoDirectory:cleanRepositoryPath error:&error];
XCTAssertTrue(success, @"Couldn't unzip fixture \"%@\" from %@ to %@: %@", repositoryName, zippedRepositoriesPath, cleanRepositoryPath, error);
}

success = [[NSFileManager defaultManager] copyItemAtPath:[cleanRepositoryPath stringByAppendingPathComponent:repositoryName] toPath:path error:&error];
XCTAssertTrue(success, @"Couldn't copy directory %@", error);
}

- (NSString *)pathForFixtureRepositoryNamed:(NSString *)repositoryName {
Expand All @@ -98,13 +105,7 @@ - (NSString *)pathForFixtureRepositoryNamed:(NSString *)repositoryName {
return [self.repositoryFixturesPath stringByAppendingPathComponent:repositoryName];
}

- (BOOL)unzipFile:(NSString *)member fromArchiveAtPath:(NSString *)zipPath intoDirectory:(NSString *)destinationPath error:(NSError **)error {

#if TARGET_OS_IPHONE
// iOS: unzip in-process using SSZipArchive
//
// system() and NSTask() are not available when running tests in the iOS simulator

- (BOOL)unzipFromArchiveAtPath:(NSString *)zipPath intoDirectory:(NSString *)destinationPath error:(NSError **)error {
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:destinationPath overwrite:YES password:nil error:error];

if (!success) {
Expand All @@ -113,32 +114,13 @@ - (BOOL)unzipFile:(NSString *)member fromArchiveAtPath:(NSString *)zipPath intoD
}

return YES;

#else
// OS X: shell out to unzip using NSTask

NSTask *task = [[NSTask alloc] init];
task.launchPath = @"/usr/bin/unzip";
task.arguments = @[ @"-qq", @"-d", destinationPath, zipPath, [member stringByAppendingString:@"*"] ];

[task launch];
[task waitUntilExit];

BOOL success = (task.terminationStatus == 0);
if (!success) {
if (error != NULL) *error = [NSError errorWithDomain:FixturesErrorDomain code:FixturesErrorUnzipFailed userInfo:@{ NSLocalizedDescriptionKey: NSLocalizedString(@"Unzip failed", @"") }];
}

return success;

#endif

}

#pragma mark API

- (GTRepository *)fixtureRepositoryNamed:(NSString *)name {
GTRepository *repository = [[GTRepository alloc] initWithURL:[NSURL fileURLWithPath:[self pathForFixtureRepositoryNamed:name]] error:NULL];
NSURL *url = [NSURL fileURLWithPath:[self pathForFixtureRepositoryNamed:name]];
GTRepository *repository = [[GTRepository alloc] initWithURL:url error:NULL];
XCTAssertNotNil(repository, @"Couldn't create a repository for %@", name);
return repository;
}
Expand Down