Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
76 changed files
with
3,655 additions
and
5 deletions.
There are no files selected for viewing
Submodule ExpressiveCasting
updated
from 5721b2 to 72e487
Submodule ExpressiveCocoa
updated
from 3c5eb9 to e9b4af
Submodule ExpressiveCollections
updated
from 996c4f to 68a65d
Submodule FSMonitoringKit
updated
21 files
+425 −0 | FSEventsFix/FSEventsFix.c | |
+54 −0 | FSEventsFix/FSEventsFix.h | |
+97 −0 | FSEventsFix/README.md | |
+20 −0 | FSMonitoringKit.podspec | |
+462 −0 | FSMonitoringKit.xcodeproj/project.pbxproj | |
+7 −0 | FSMonitoringKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata | |
+24 −0 | Metadata/Info-Tests.plist | |
+28 −0 | Metadata/Info.plist | |
+5 −0 | README.md | |
+13 −0 | Source/FSChange.h | |
+22 −0 | Source/FSChange.m | |
+58 −0 | Source/FSMonitor.h | |
+249 −0 | Source/FSMonitor.m | |
+13 −0 | Source/FSMonitoringKit.h | |
+33 −0 | Source/FSTree.h | |
+290 −0 | Source/FSTree.m | |
+22 −0 | Source/FSTreeDiffer.h | |
+46 −0 | Source/FSTreeDiffer.m | |
+20 −0 | Source/FSTreeFilter.h | |
+53 −0 | Source/FSTreeFilter.m | |
+31 −0 | Tests/FSMonitoringKitTests.m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>FMWK</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>$(CURRENT_PROJECT_VERSION)</string> | ||
<key>NSHumanReadableCopyright</key> | ||
<string>Copyright © 2015 Andrey Tarantsov. All rights reserved.</string> | ||
<key>NSPrincipalClass</key> | ||
<string></string> | ||
</dict> | ||
</plist> |
728 changes: 728 additions & 0 deletions
728
PackageManagerKit/PackageManagerKit.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# PackageManagerKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
|
||
@class LRVersion; | ||
@class LRPackageContainer; | ||
|
||
|
||
@interface LRPackage : NSObject | ||
|
||
- (instancetype)initWithName:(NSString *)name version:(LRVersion *)version container:(LRPackageContainer *)container sourceFolderURL:(NSURL *)sourceFolderURL; | ||
|
||
@property(nonatomic, readonly) NSString *name; | ||
@property(nonatomic, readonly) LRVersion *version; | ||
@property(nonatomic, readonly, weak) LRPackageContainer *container; | ||
@property(nonatomic, readonly) NSURL *sourceFolderURL; | ||
|
||
@property(nonatomic, readonly) NSString *identifier; // type:name | ||
@property(nonatomic, readonly) NSString *identifierIncludingVersion; // type:name:version | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
#import "LRPackage.h" | ||
#import "LRPackageContainer.h" | ||
#import "LRPackageType.h" | ||
@import ATVersionKit; | ||
|
||
|
||
@interface LRPackage () | ||
|
||
@end | ||
|
||
|
||
@implementation LRPackage | ||
|
||
- (instancetype)initWithName:(NSString *)name version:(LRVersion *)version container:(LRPackageContainer *)container sourceFolderURL:(NSURL *)sourceFolderURL { | ||
self = [super init]; | ||
if (self) { | ||
_name = [name copy]; | ||
_version = version; | ||
_container = container; | ||
_sourceFolderURL = sourceFolderURL; | ||
_identifier = [_container.packageType identifierOfPackageNamed:_name]; | ||
_identifierIncludingVersion = [NSString stringWithFormat:@"%@:%@", _identifier, _version.description]; | ||
} | ||
return self; | ||
} | ||
|
||
- (NSString *)description { | ||
return [NSString stringWithFormat:@"%@(%@ %@)", NSStringFromClass(self.class), _name, _version]; | ||
} | ||
|
||
@end |
45 changes: 45 additions & 0 deletions
45
PackageManagerKit/Source/GenericPackages/LRPackageContainer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
|
||
@class LRPackageType; | ||
@class LRPackageReference; | ||
@class LRPackage; | ||
@class RuntimeInstance; | ||
|
||
|
||
extern NSString *const LRPackageContainerDidChangePackageListNotification; | ||
|
||
|
||
typedef enum { | ||
LRPackageContainerTypeBundled, | ||
LRPackageContainerTypeRuntimeInstance, | ||
LRPackageContainerTypeOptionalSet, | ||
LRPackageContainerTypeProjectLocal | ||
} LRPackageContainerType; | ||
|
||
|
||
@interface LRPackageContainer : NSObject | ||
|
||
- (instancetype)initWithPackageType:(LRPackageType *)packageType; | ||
|
||
@property(nonatomic, readonly) LRPackageType *packageType; | ||
|
||
@property(nonatomic, readonly) NSArray *packages; | ||
|
||
@property(nonatomic) LRPackageContainerType containerType; | ||
@property(nonatomic, strong) RuntimeInstance *runtimeInstance; | ||
|
||
- (NSArray *)packagesMatchingReference:(LRPackageReference *)reference; | ||
- (LRPackage *)bestPackageMatchingReference:(LRPackageReference *)reference; | ||
|
||
- (void)startTrackingPackages; | ||
- (void)endTrackingPackages; | ||
|
||
// for subclasses | ||
@property(nonatomic, readonly, getter=isUpdateInProgress) BOOL updateInProgress; | ||
- (void)doUpdate; | ||
- (void)updateSucceededWithPackages:(NSArray *)packages; | ||
- (void)updateFailedWithError:(NSError *)error; | ||
|
||
@end |
75 changes: 75 additions & 0 deletions
75
PackageManagerKit/Source/GenericPackages/LRPackageContainer.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
|
||
#import "LRPackageContainer.h" | ||
#import "LRPackageReference.h" | ||
|
||
|
||
NSString *const LRPackageContainerDidChangePackageListNotification = @"LRPackageContainerDidChangePackageList"; | ||
|
||
|
||
@interface LRPackageContainer () | ||
|
||
@end | ||
|
||
|
||
@implementation LRPackageContainer | ||
|
||
- (instancetype)initWithPackageType:(LRPackageType *)packageType { | ||
self = [super init]; | ||
if (self) { | ||
_packageType = packageType; | ||
} | ||
return self; | ||
} | ||
|
||
- (NSArray *)packagesMatchingReference:(LRPackageReference *)reference { | ||
NSMutableArray *result = [NSMutableArray new]; | ||
for (LRPackage *package in _packages) { | ||
if ([reference matchesPackage:package]) { | ||
[result addObject:package]; | ||
} | ||
} | ||
return result; | ||
} | ||
|
||
- (LRPackage *)bestPackageMatchingReference:(LRPackageReference *)reference { | ||
NSArray *choices = [self packagesMatchingReference:reference]; | ||
if (choices.count == 0) | ||
return nil; | ||
else | ||
return [choices firstObject]; // TODO return the best object | ||
} | ||
|
||
- (void)startTrackingPackages { | ||
[self _updatePackages]; | ||
} | ||
|
||
- (void)endTrackingPackages { | ||
|
||
} | ||
|
||
- (void)_updatePackages { | ||
if (_updateInProgress) | ||
return; | ||
|
||
_updateInProgress = YES; | ||
NSLog(@"%@: updating", self); | ||
[self doUpdate]; | ||
} | ||
|
||
- (void)doUpdate { | ||
[self updateSucceededWithPackages:@[]]; | ||
} | ||
|
||
- (void)updateSucceededWithPackages:(NSArray *)packages { | ||
NSLog(@"%@: update succeeded, found %d packages: %@", self, (int)packages.count, [packages componentsJoinedByString:@", "]); | ||
_packages = packages; | ||
_updateInProgress = NO; | ||
[[NSNotificationCenter defaultCenter] postNotificationName:LRPackageContainerDidChangePackageListNotification object:self]; | ||
} | ||
|
||
- (void)updateFailedWithError:(NSError *)error { | ||
NSLog(@"%@: update failed: %@ - %ld - %@", self, error.domain, (long)error.code, error.localizedDescription); | ||
_updateInProgress = NO; | ||
} | ||
|
||
@end |
23 changes: 23 additions & 0 deletions
23
PackageManagerKit/Source/GenericPackages/LRPackageManager.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
|
||
@class LRPackageType; | ||
@class LRPackageContainer; | ||
@class LRPackageReference; | ||
|
||
|
||
@interface LRPackageManager : NSObject | ||
|
||
- (void)addPackageType:(LRPackageType *)type; | ||
- (LRPackageType *)packageTypeNamed:(NSString *)name; | ||
|
||
@property(nonatomic, readonly) NSArray *packageTypes; | ||
|
||
- (void)addPackageContainer:(LRPackageContainer *)container; | ||
- (void)removePackageContainer:(LRPackageContainer *)container; | ||
|
||
- (LRPackageReference *)packageReferenceWithDictionary:(NSDictionary *)dictionary; | ||
- (LRPackageReference *)packageReferenceWithString:(NSString *)string; | ||
|
||
@end |
79 changes: 79 additions & 0 deletions
79
PackageManagerKit/Source/GenericPackages/LRPackageManager.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
|
||
#import "LRPackageManager.h" | ||
#import "LRPackageType.h" | ||
#import "LRPackageReference.h" | ||
@import ATVersionKit; | ||
|
||
|
||
@interface LRPackageManager () | ||
|
||
@end | ||
|
||
|
||
@implementation LRPackageManager { | ||
NSMutableArray *_packageTypes; | ||
NSMutableDictionary *_packageTypesByName; | ||
} | ||
|
||
- (id)init { | ||
self = [super init]; | ||
if (self) { | ||
_packageTypes = [NSMutableArray new]; | ||
_packageTypesByName = [NSMutableDictionary new]; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)addPackageType:(LRPackageType *)type { | ||
[_packageTypes addObject:type]; | ||
_packageTypesByName[type.name] = type; | ||
} | ||
|
||
- (LRPackageType *)packageTypeNamed:(NSString *)name { | ||
return _packageTypesByName[name]; | ||
} | ||
|
||
- (NSArray *)packageTypes { | ||
return [_packageTypes copy]; | ||
} | ||
|
||
- (void)addPackageContainer:(LRPackageContainer *)container { | ||
|
||
} | ||
|
||
- (void)removePackageContainer:(LRPackageContainer *)container { | ||
|
||
} | ||
|
||
- (LRPackageReference *)packageReferenceWithDictionary:(NSDictionary *)dictionary { | ||
NSString *typeName = dictionary[@"type"]; | ||
if (!typeName) | ||
return nil; | ||
LRPackageType *type = [self packageTypeNamed:typeName]; | ||
if (!type) | ||
return nil; | ||
|
||
NSString *name = dictionary[@"name"]; | ||
if (!name) | ||
return nil; | ||
|
||
NSString *versionSpec = dictionary[@"version"]; | ||
LRVersionSet *versionSet = nil; | ||
if (versionSpec) { | ||
versionSet = [type.versionSpace versionSetWithString:versionSpec]; | ||
if (!versionSet.valid) { | ||
NSLog(@"Package '%@' version spec problem: %@", name, versionSet.error.localizedDescription); | ||
} | ||
} | ||
|
||
return [[LRPackageReference alloc] initWithType:type name:name versionSpec:versionSet]; | ||
} | ||
|
||
- (LRPackageReference *)packageReferenceWithString:(NSString *)string { | ||
NSArray *components = [string componentsSeparatedByString:@":"]; | ||
if (components.count != 3) | ||
return nil; | ||
return [self packageReferenceWithDictionary:@{@"type": components[0], @"name": components[1], @"version": components[2]}]; | ||
} | ||
|
||
@end |
20 changes: 20 additions & 0 deletions
20
PackageManagerKit/Source/GenericPackages/LRPackageReference.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
|
||
@class LRPackageType; | ||
@class LRVersionSet; | ||
@class LRPackage; | ||
|
||
|
||
@interface LRPackageReference : NSObject | ||
|
||
- (instancetype)initWithType:(LRPackageType *)type name:(NSString *)name versionSpec:(LRVersionSet *)versionSet; | ||
|
||
@property(nonatomic, readonly) LRPackageType *type; | ||
@property(nonatomic, readonly) NSString *name; | ||
@property(nonatomic, readonly) LRVersionSet *versionSpec; | ||
|
||
- (BOOL)matchesPackage:(LRPackage *)package; | ||
|
||
@end |
Oops, something went wrong.