Skip to content

Commit

Permalink
Merge pull request #37 from ChristianKienle/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Christian Kienle authored Nov 20, 2016
2 parents 717ecbf + 14e8533 commit ecf66a4
Show file tree
Hide file tree
Showing 110 changed files with 3,116 additions and 5,289 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Core Data Editor/Core Data Editor.xcodeproj/xcuserdata
CDE-Workspace.xcworkspace/xcuserdata/*
# OS X
.DS_Store

Expand Down
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
osx_image: xcode8.2
language: objective-c
osx_image: xcode8
before_install:
- brew update
- if brew outdated | grep -qx xctool; then brew upgrade xctool; fi
script: xcodebuild -workspace CDE-Workspace.xcworkspace -scheme CDETests test
script: xcodebuild -verbose -scheme "Core Data Editor" -workspace CDE-Workspace.xcworkspace build
37 changes: 9 additions & 28 deletions CDE-Workspace.xcworkspace/xcshareddata/xcschemes/CDETests.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0810"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -32,22 +32,13 @@
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AB7EF6AD1DB4028C0062DD0C"
BuildableName = "CDETests.xctest"
BlueprintName = "CDETests"
BlueprintIdentifier = "ABBEA8C0176620E10024A9D2"
BuildableName = "Core Data Editor Tests.xctest"
BlueprintName = "Core Data Editor Tests"
ReferencedContainer = "container:Core Data Editor/Core Data Editor.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ABBEA7D51765CB730024A9D2"
BuildableName = "Core Data Editor.app"
BlueprintName = "Core Data Editor"
ReferencedContainer = "container:Core Data Editor/Core Data Editor.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
Expand All @@ -62,16 +53,15 @@
debugXPCServices = "NO"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ABBEA7D51765CB730024A9D2"
BuildableName = "Core Data Editor.app"
BlueprintName = "Core Data Editor"
BlueprintIdentifier = "ABBEA8C0176620E10024A9D2"
BuildableName = "Core Data Editor Tests.xctest"
BlueprintName = "Core Data Editor Tests"
ReferencedContainer = "container:Core Data Editor/Core Data Editor.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
Expand All @@ -81,15 +71,6 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ABBEA8C0176620E10024A9D2"
BuildableName = "Core Data Editor Tests.xctest"
BlueprintName = "Core Data Editor Tests"
ReferencedContainer = "container:Core Data Editor/Core Data Editor.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0810"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -28,16 +28,6 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AB7EF6AD1DB4028C0062DD0C"
BuildableName = "CDETests.xctest"
BlueprintName = "CDETests"
ReferencedContainer = "container:Core Data Editor/Core Data Editor.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0810"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
23 changes: 7 additions & 16 deletions CDEKit/CDEKit/NSEntityDescription+CDEAdditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,15 @@
@interface NSEntityDescription (CDEAdditions)

#pragma mark - Convenience
- (NSArray *)supportedAttributes_cde;
- (NSArray *)toManyRelationships_cde;
- (NSDictionary *)toManyRelationshipsByName_cde;
- (NSArray *)sortedToManyRelationshipNames_cde;
- (NSArray *)sortedToManyRelationships_cde;
- (NSArray *)sortedToOneRelationships_cde;
- (NSArray *)sortedRelationships_cde;
//@property (nonatomic, readonly) NSString *nameForDisplay_cde;
- (NSArray<NSAttributeDescription*> *)supportedAttributes_cde;
- (NSArray<NSRelationshipDescription*> *)toManyRelationships_cde;
- (NSDictionary<NSString*, NSRelationshopDescription*>*)toManyRelationshipsByName_cde;
- (NSArray<NSString*> *)sortedToManyRelationshipNames_cde;
- (NSArray<NSRelationshipDescription*> *)sortedToManyRelationships_cde;
- (NSArray<NSRelationshipDescription*> *)sortedToOneRelationships_cde;
- (NSArray<NSRelationshipDescription*> *)sortedRelationships_cde;
- (NSAttributeDescription *)attributeDescriptionForName_cde:(NSString *)attributeName;

#pragma mark - CSV
//// returns an array of arrays
//- (NSArray *)CSVValuesForEachManagedObjectInArray_cde:(NSArray *)objects;
//
//// This method filters out any non supported property names and also respects the sorting of propertyNames
//- (NSArray *)CSVValuesForEachManagedObjectInArray:(NSArray *)objects forPropertyNames:(NSArray *)propertyNames includeHeaderValues_cde:(BOOL)includeHeaderValues;
//- (NSArray *)supportedCSVAttributes_cde;

#pragma mark - UI
- (UIImage *)icon_cde;

Expand Down
188 changes: 64 additions & 124 deletions CDEKit/CDEKit/NSEntityDescription+CDEAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,151 +4,91 @@
@implementation NSEntityDescription (CDEAdditions)

#pragma mark - Convenience
- (NSArray *)supportedAttributes_cde {
NSMutableArray *result = [NSMutableArray new];
for(NSAttributeDescription *attribute in [[self attributesByName] allValues]) {
// Ignore transient properties
if(attribute.isTransient) {
continue;
}
if(!attribute.isSupportedAttribute_cde) {
continue;
}

[result addObject:attribute];
- (NSArray<NSAttributeDescription*> *)supportedAttributes_cde {
NSMutableArray *result = [NSMutableArray new];
for(NSAttributeDescription *attribute in [[self attributesByName] allValues]) {
// Ignore transient properties
if(attribute.isTransient) {
continue;
}
return result;
if(!attribute.isSupportedAttribute_cde) {
continue;
}

[result addObject:attribute];
}
return result;
}

- (NSArray *)toManyRelationships_cde {
NSMutableArray *result = [NSMutableArray new];
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(id key, NSRelationshipDescription *relation, BOOL *stop) {
if(relation.isToMany == NO) {
return;
}
[result addObject:relation];
}];
return result;
- (NSArray<NSRelationshipDescription*> *)toManyRelationships_cde {
NSMutableArray *result = [NSMutableArray new];
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(id key, NSRelationshipDescription *relation, BOOL *stop) {
if(relation.isToMany == NO) {
return;
}
[result addObject:relation];
}];
return result;
}

- (NSDictionary *)toManyRelationshipsByName_cde {
NSMutableDictionary *result = [NSMutableDictionary new];
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(NSString *name, NSRelationshipDescription *relation, BOOL *stop) {
if(relation.isToMany == NO) {
return;
}
result[name] = relation;
}];
return result;
- (NSDictionary<NSString*, NSRelationshopDescription*> *)toManyRelationshipsByName_cde {
NSMutableDictionary *result = [NSMutableDictionary new];
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(NSString *name, NSRelationshipDescription *relation, BOOL *stop) {
if(relation.isToMany == NO) {
return;
}
result[name] = relation;
}];
return result;
}

- (NSArray *)sortedToManyRelationshipNames_cde {
NSArray *unsorted = [[self toManyRelationshipsByName_cde] allKeys];
return [unsorted sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSString *relationA, NSString *relationB) {
return [relationA localizedStandardCompare:relationB];
}];
- (NSArray<NSString*> *)sortedToManyRelationshipNames_cde {
NSArray *unsorted = [[self toManyRelationshipsByName_cde] allKeys];
return [unsorted sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSString *relationA, NSString *relationB) {
return [relationA localizedStandardCompare:relationB];
}];
}

- (NSArray *)sortedToManyRelationships_cde {
NSMutableArray *result = [NSMutableArray new];
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(id key, NSRelationshipDescription *relation, BOOL *stop) {
if(relation.isToMany == NO) {
return;
}
[result addObject:relation];
}];
return [result sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSRelationshipDescription *relationA, NSRelationshipDescription *relationB) {
return [relationA.name localizedStandardCompare:relationB.name];
}];
- (NSArray<NSRelationshipDescription*> *)sortedToManyRelationships_cde {
NSMutableArray *result = [NSMutableArray new];
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(id key, NSRelationshipDescription *relation, BOOL *stop) {
if(relation.isToMany == NO) {
return;
}
[result addObject:relation];
}];
return [result sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSRelationshipDescription *relationA, NSRelationshipDescription *relationB) {
return [relationA.name localizedStandardCompare:relationB.name];
}];
}

- (NSArray *)sortedToOneRelationships_cde {
NSMutableArray *result = [NSMutableArray new];
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(id key, NSRelationshipDescription *relation, BOOL *stop) {
if(relation.isToMany) {
return;
}
[result addObject:relation];
}];
return [result sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSRelationshipDescription *relationA, NSRelationshipDescription *relationB) {
return [relationA.name localizedStandardCompare:relationB.name];
}];
- (NSArray<NSRelationshipDescription*> *)sortedToOneRelationships_cde {
NSMutableArray *result = [NSMutableArray new];
[self.relationshipsByName enumerateKeysAndObjectsUsingBlock:^(id key, NSRelationshipDescription *relation, BOOL *stop) {
if(relation.isToMany) {
return;
}
[result addObject:relation];
}];
return [result sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSRelationshipDescription *relationA, NSRelationshipDescription *relationB) {
return [relationA.name localizedStandardCompare:relationB.name];
}];
}

- (NSArray *)sortedRelationships_cde {
return [self.relationshipsByName.allValues sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSRelationshipDescription *relationA, NSRelationshipDescription *relationB) {
return [relationA.name localizedStandardCompare:relationB.name];
}];
- (NSArray<NSRelationshipDescription*> *)sortedRelationships_cde {
return [self.relationshipsByName.allValues sortedArrayWithOptions:NSSortStable usingComparator:^NSComparisonResult(NSRelationshipDescription *relationA, NSRelationshipDescription *relationB) {
return [relationA.name localizedStandardCompare:relationB.name];
}];
}

//- (NSString *)nameForDisplay_cde {
// return [self.name humanReadableStringAccordingToUserDefaults_cde];
//}

- (NSAttributeDescription *)attributeDescriptionForName_cde:(NSString *)attributeName {
NSParameterAssert(attributeName);
return self.attributesByName[attributeName];
NSParameterAssert(attributeName);
return self.attributesByName[attributeName];
}

//#pragma mark - CSV
//// returns an array of arrays
//- (NSArray *)CSVValuesForEachManagedObjectInArray_cde:(NSArray *)objects {
// NSParameterAssert(objects);
// NSArray *supportedAttributes = self.supportedCSVAttributes_cde;
// NSArray *supportedAttributeNames = [supportedAttributes valueForKey:@"name"];
// return [self CSVValuesForEachManagedObjectInArray:objects forPropertyNames:supportedAttributeNames includeHeaderValues_cde:NO];
//}
//
//// This method filters out any non supported property names and also respects the sorting of propertyNames
//- (NSArray *)CSVValuesForEachManagedObjectInArray:(NSArray *)objects forPropertyNames:(NSArray *)propertyNames includeHeaderValues_cde:(BOOL)includeHeaderValues {
// NSParameterAssert(objects);
// NSParameterAssert(propertyNames);
//
// NSMutableArray *supportedAttributeNames = [NSMutableArray new];
// for(NSString *propertyName in propertyNames) {
// if([propertyName isEqualToString:@"objectID"]) {
// [supportedAttributeNames addObject:propertyName];
// continue;
// }
// NSAttributeDescription *attribute = self.attributesByName[propertyName];
// if(attribute == nil) {
// continue;
// }
// if(!attribute.isSupportedAttribute_cde || !attribute.isSupportedCSVAttribute_cde) {
// continue;
// }
// [supportedAttributeNames addObject:attribute.name];
// }
//
// NSMutableArray *result = [NSMutableArray arrayWithCapacity:objects.count + 1];
//
// if(includeHeaderValues) {
// [result addObject:supportedAttributeNames];
// }
//
// for(NSManagedObject *object in objects) {
// NSAssert([object.entity isKindOfEntity:self], @"Entity mismatch");
// NSArray *values = [object CSVValuesForAttributeNames_cde:supportedAttributeNames];
// [result addObject:values];
// }
//
// return result;
//}
//
//- (NSArray *)supportedCSVAttributes_cde {
// NSMutableArray *result = [NSMutableArray new];
// for(NSAttributeDescription *attribute in self.supportedAttributes_cde) {
// if(attribute.isSupportedCSVAttribute_cde) {
// [result addObject:attribute];
// }
// }
// return result;
//}

#pragma mark - UI
- (UIImage *)icon_cde {
return nil;
// return [UIImage imageNamed:@"entity-icon-small"];
}

@end
Loading

0 comments on commit ecf66a4

Please sign in to comment.