Skip to content

Commit

Permalink
Merge branch 'release/1.23'
Browse files Browse the repository at this point in the history
  • Loading branch information
rentzsch committed Jul 10, 2011
2 parents 0a68234 + a06c725 commit 8207b9c
Show file tree
Hide file tree
Showing 16 changed files with 367 additions and 259 deletions.
30 changes: 30 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,36 @@ Xmo'd works by noticing when your `*.xcdatamodel` is saved. If the model file's

## Version History

### v1.23: Sun Jul 10 2011 [download](http://github.com/downloads/rentzsch/mogenerator/mogenerator-1.23.dmg)

* [NEW] Support for Mac OS X 10.7 Lion's ordered relationships (generated relationship code uses `NSOrderedSet` and `NSMutableOrderedSet`). (rentzsch [1](https://github.com/rentzsch/mogenerator/commit/4e9a045dcbf5af2eefed2ca9cb5fbac8394f9df2) [2](https://github.com/rentzsch/mogenerator/commit/a716c87b88b4614520175694d6e910bd38114602) [3](https://github.com/rentzsch/mogenerator/commit/932c4b382ab086faf76e167d3051bafa087321ae))

* [NEW] Optional support for ARC: pass `--template-var arc=true` to mogenerator. [bug 63](https://github.com/rentzsch/mogenerator/issues/63) ([Adam Cox](https://github.com/rentzsch/mogenerator/pull/64))

* [NEW] New template that dumps a binary .xcdatamodel into a pseudo-ASCII-plist format perfect for diffing. A great way to compare two versions of a data model. ([Brian Webster](https://github.com/rentzsch/mogenerator/pull/61))

* [NEW] Attributes and relationships are now sorted for generation. This should eliminate spurious changes to source files when unrelated model entities are changed. After upgrading to 1.23 you probably want to regenerate all your source files without a model change, just to let things settle in before your next real model change. ([Nikita Zhuk](https://github.com/nzhuk/mogenerator/commit/61450726028585633b93274269eb5c77c7b5c83e))

* [NEW] Support for generation of PONSOs: Plain Old NSObjects. These are in-memory, typesafe non-CoreData classes generated from your Xcode data models. Generate reams of ObjC classes from a single data model. Supports relationships and basic serialization. See `contributed templates/Nikita Zhuk/ponso/README.txt` for details. ([Nikita Zhuk](https://github.com/rentzsch/mogenerator/pull/60))

* [NEW] Support for `momc` error-reporting options: `MOMC_NO_WARNINGS`, `MOMC_NO_INVERSE_RELATIONSHIP_WARNINGS` and `MOMC_SUPPRESS_INVERSE_TRANSIENT_ERROR`. ([Nikita Zhuk](https://github.com/nzhuk/mogenerator/commit/96786d4caf78ea6988ac430191e555350ca468c5))

* [NEW] Now generates output directories if they don't already exist or presents an error message if they cannot be created. ([Scott Little](https://github.com/rentzsch/mogenerator/pull/51))

* [CHANGE] Change `#include` to `#import` in `include.m`. ([Zac Bowling](https://github.com/rentzsch/mogenerator/pull/59))

* [NEW] You can now use `--template-var` to pass arbitrary command-line options through to templates. ([Adam Cox](https://github.com/rentzsch/mogenerator/pull/64))

* [NEW] Update MiscMerge to NS(U)Integer for 64-bit compatibility. ([Nikita Zhuk](https://github.com/nzhuk/mogenerator/commit/a4aa3b943285fd5aaece9a417c5d36d3d1723127))

* [FIX] Memory leaks in MiscMerge. ([Nikita Zhuk](https://github.com/nzhuk/mogenerator/commit/4716a9c43e656ea2fc38e3d9096b8e2f273de109))

* [CHANGE] mogeneratorTestMule's `mogenerate.command` upgraded to use double-dash option names. ([rentzsch](https://github.com/rentzsch/mogenerator/commit/b78d7611dc8819782541fe65e50050173a040d92))

* [FIX] Set mogeneratorTestMule's `mogenerate.command` executable bit. ([rentzsch](https://github.com/rentzsch/mogenerator/commit/83182682d39c3b1f96ac28df5a3ae326418dbfe8))



### v1.22: Wed Mar 2 2011 [download](http://github.com/downloads/rentzsch/mogenerator/mogenerator-1.22.dmg)

* [FIX] Xmo'd 1.21 introduced a bug where it would no longer create a source folder for your data model (it would work fine it one already existed). [bug 43](https://github.com/rentzsch/mogenerator/issues/43) ([rentzsch](https://github.com/rentzsch/mogenerator/commit/462a485f0686b44fbaabad875ee8a21e3e0f61bc))
Expand Down
10 changes: 9 additions & 1 deletion mogenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
- (NSArray*)entitiesWithACustomSubclassVerbose:(BOOL)verbose_;
@end


@interface NSEntityDescription (customBaseClass)
- (BOOL)hasCustomSuperentity;
- (NSString*)customSuperentity;
Expand All @@ -36,6 +35,15 @@
- (BOOL)hasTransformableAttributeType;
@end

@interface NSRelationshipDescription (collectionClassName)
- (NSString*)mutableCollectionClassName;
- (NSString*)immutableCollectionClassName;
- (BOOL)_jr_isOrdered;
@end
@interface NSObject (JustHereToSuppressIsOrderedNotImplementedCompilerWarning)
- (BOOL)isOrdered;
@end

@interface NSString (camelCaseString)
- (NSString*)camelCaseString;
@end
Expand Down
22 changes: 21 additions & 1 deletion mogenerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,26 @@ - (BOOL)hasTransformableAttributeType {

@end

@implementation NSRelationshipDescription (collectionClassName)

- (NSString*)mutableCollectionClassName {
return [self _jr_isOrdered] ? @"NSMutableOrderedSet" : @"NSMutableSet";
}

- (NSString*)immutableCollectionClassName {
return [self _jr_isOrdered] ? @"NSOrderedSet" : @"NSSet";
}

- (BOOL)_jr_isOrdered {
if ([self respondsToSelector:@selector(isOrdered)]) {
return [self isOrdered];
} else {
return NO;
}
}

@end

@implementation NSString (camelCaseString)
- (NSString*)camelCaseString {
NSArray *lowerCasedWordArray = [[self wordArray] arrayByMakingObjectsPerformSelector:@selector(lowercaseString)];
Expand Down Expand Up @@ -508,7 +528,7 @@ - (int) application: (DDCliApplication *) app
}

if (_version) {
printf("mogenerator 1.22. By Jonathan 'Wolf' Rentzsch + friends.\n");
printf("mogenerator 1.23. By Jonathan 'Wolf' Rentzsch + friends.\n");
return EXIT_SUCCESS;
}

Expand Down
2 changes: 2 additions & 0 deletions mogenerator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@
buildSettings = {
COPY_PHASE_STRIP = NO;
DEPLOYMENT_LOCATION = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_OPTIMIZATION_LEVEL = 0;
Expand All @@ -469,6 +470,7 @@
buildSettings = {
DEPLOYMENT_LOCATION = NO;
DEPLOYMENT_POSTPROCESSING = NO;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = mogenerator_Prefix.pch;
Expand Down
4 changes: 4 additions & 0 deletions mogeneratorTestMule/MOs/_ChildMO.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@




@property (nonatomic, retain) NSString *childName;


//- (BOOL)validateChildName:(id*)value_ error:(NSError**)error_;





@property (nonatomic, retain) ParentMO* parent;

//- (BOOL)validateParent:(id*)value_ error:(NSError**)error_;


Expand Down
22 changes: 14 additions & 8 deletions mogeneratorTestMule/MOs/_HumanMO.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,30 @@






@property (nonatomic, retain) NSData *hairColorStorage;


//- (BOOL)validateHairColorStorage:(id*)value_ error:(NSError**)error_;




@property (nonatomic, retain) NSString *humanName;

//- (BOOL)validateHumanName:(id*)value_ error:(NSError**)error_;

//- (BOOL)validateHumanName:(id*)value_ error:(NSError**)error_;





@property (nonatomic, retain) NSManagedObject* meaninglessRelationship;
//- (BOOL)validateMeaninglessRelationship:(id*)value_ error:(NSError**)error_;



//- (BOOL)validateMeaninglessRelationship:(id*)value_ error:(NSError**)error_;

+ (NSArray*)fetchByHumanName:(NSManagedObjectContext*)moc_ humanName:(NSString*)humanName_ ;
+ (NSArray*)fetchByHumanName:(NSManagedObjectContext*)moc_ humanName:(NSString*)humanName_ error:(NSError**)error_;



Expand All @@ -57,6 +58,11 @@



+ (NSArray*)fetchByHumanName:(NSManagedObjectContext*)moc_ humanName:(NSString*)humanName_ ;
+ (NSArray*)fetchByHumanName:(NSManagedObjectContext*)moc_ humanName:(NSString*)humanName_ error:(NSError**)error_;



@end

@interface _HumanMO (CoreDataGeneratedAccessors)
Expand All @@ -66,6 +72,8 @@
@interface _HumanMO (CoreDataGeneratedPrimitiveAccessors)




- (NSData*)primitiveHairColorStorage;
- (void)setPrimitiveHairColorStorage:(NSData*)value;

Expand All @@ -79,8 +87,6 @@





- (NSManagedObject*)primitiveMeaninglessRelationship;
- (void)setPrimitiveMeaninglessRelationship:(NSManagedObject*)value;

Expand Down
74 changes: 37 additions & 37 deletions mogeneratorTestMule/MOs/_HumanMO.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {



@dynamic hairColorStorage;


@dynamic hairColorStorage;




@dynamic humanName;


@dynamic humanName;



Expand All @@ -61,41 +61,6 @@ + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key {



+ (NSArray*)fetchByHumanName:(NSManagedObjectContext*)moc_ humanName:(NSString*)humanName_ {
NSError *error = nil;
NSArray *result = [self fetchByHumanName:moc_ humanName:humanName_ error:&error];
if (error) {
#if TARGET_OS_IPHONE
NSLog(@"error: %@", error);
#else
[NSApp presentError:error];
#endif
}
return result;
}
+ (NSArray*)fetchByHumanName:(NSManagedObjectContext*)moc_ humanName:(NSString*)humanName_ error:(NSError**)error_ {
NSParameterAssert(moc_);
NSError *error = nil;

NSManagedObjectModel *model = [[moc_ persistentStoreCoordinator] managedObjectModel];

NSDictionary *substitutionVariables = [NSDictionary dictionaryWithObjectsAndKeys:

humanName_, @"humanName",

nil];

NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"byHumanName"
substitutionVariables:substitutionVariables];
NSAssert(fetchRequest, @"Can't find fetch request named \"byHumanName\".");

NSArray *result = [moc_ executeFetchRequest:fetchRequest error:&error];
if (error_) *error_ = error;
return result;
}



+ (id)fetchOneByHumanName:(NSManagedObjectContext*)moc_ humanName:(NSString*)humanName_ {
NSError *error = nil;
id result = [self fetchOneByHumanName:moc_ humanName:humanName_ error:&error];
Expand Down Expand Up @@ -179,4 +144,39 @@ + (NSArray*)fetchAllHumans:(NSManagedObjectContext*)moc_ error:(NSError**)error_
}



+ (NSArray*)fetchByHumanName:(NSManagedObjectContext*)moc_ humanName:(NSString*)humanName_ {
NSError *error = nil;
NSArray *result = [self fetchByHumanName:moc_ humanName:humanName_ error:&error];
if (error) {
#if TARGET_OS_IPHONE
NSLog(@"error: %@", error);
#else
[NSApp presentError:error];
#endif
}
return result;
}
+ (NSArray*)fetchByHumanName:(NSManagedObjectContext*)moc_ humanName:(NSString*)humanName_ error:(NSError**)error_ {
NSParameterAssert(moc_);
NSError *error = nil;

NSManagedObjectModel *model = [[moc_ persistentStoreCoordinator] managedObjectModel];

NSDictionary *substitutionVariables = [NSDictionary dictionaryWithObjectsAndKeys:

humanName_, @"humanName",

nil];

NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"byHumanName"
substitutionVariables:substitutionVariables];
NSAssert(fetchRequest, @"Can't find fetch request named \"byHumanName\".");

NSArray *result = [moc_ executeFetchRequest:fetchRequest error:&error];
if (error_) *error_ = error;
return result;
}


@end
Loading

0 comments on commit 8207b9c

Please sign in to comment.