From 1493a4a6b928254ea86e49b63231f15e6cd96430 Mon Sep 17 00:00:00 2001 From: rentzsch Date: Wed, 11 Apr 2012 21:10:48 -0500 Subject: [PATCH 01/10] [NEW] Build in default templates into the mogenerator binary itself. --- build-mogenerator-Info-plist.sh | 8 +++ mogenerator.h | 2 - mogenerator.m | 89 ++++++++++++++++++++++----- mogenerator.xcodeproj/project.pbxproj | 29 +++++++++ 4 files changed, 112 insertions(+), 16 deletions(-) create mode 100644 build-mogenerator-Info-plist.sh diff --git a/build-mogenerator-Info-plist.sh b/build-mogenerator-Info-plist.sh new file mode 100644 index 00000000..ff11ae66 --- /dev/null +++ b/build-mogenerator-Info-plist.sh @@ -0,0 +1,8 @@ +rm -f /tmp/mogenerator-Info.plist +/usr/libexec/PlistBuddy \ + -c "Clear" \ + -c "Import :human.h.motemplate templates/human.h.motemplate" \ + -c "Import :human.m.motemplate templates/human.m.motemplate" \ + -c "Import :machine.h.motemplate templates/machine.h.motemplate" \ + -c "Import :machine.m.motemplate templates/machine.m.motemplate" \ + /tmp/mogenerator-Info.plist diff --git a/mogenerator.h b/mogenerator.h index d1f50787..ea16bbb6 100644 --- a/mogenerator.h +++ b/mogenerator.h @@ -70,6 +70,4 @@ BOOL _orphaned; NSMutableDictionary *templateVar; } - -- (NSString*)appSupportFileNamed:(NSString*)fileName_; @end \ No newline at end of file diff --git a/mogenerator.m b/mogenerator.m index 38f00b64..5e64e296 100644 --- a/mogenerator.m +++ b/mogenerator.m @@ -363,10 +363,29 @@ - (NSString*)camelCaseString { } @end -static MiscMergeEngine* engineWithTemplatePath(NSString *templatePath_) { +@interface MogeneratorTemplateDesc : NSObject { + NSString *templateName; + NSString *templatePath; +} +- (id)initWithName:(NSString*)name_ path:(NSString*)path_; +- (NSString*)templateName; +- (void)setTemplateName:(NSString*)name_; +- (NSString*)templatePath; +- (void)setTemplatePath:(NSString*)path_; +@end + +static MiscMergeEngine* engineWithTemplateDesc(MogeneratorTemplateDesc *templateDesc_) { MiscMergeTemplate *template = [[[MiscMergeTemplate alloc] init] autorelease]; [template setStartDelimiter:@"<$" endDelimiter:@"$>"]; - [template parseContentsOfFile:templatePath_]; + if ([templateDesc_ templatePath]) { + [template parseContentsOfFile:[templateDesc_ templatePath]]; + } else { + NSData *templateData = [[NSBundle mainBundle] objectForInfoDictionaryKey:[templateDesc_ templateName]]; + assert(templateData); + NSString *templateString = [[[NSString alloc] initWithData:templateData encoding:NSASCIIStringEncoding] autorelease]; + [template setFilename:[@"x-__info_plist://" stringByAppendingString:[templateDesc_ templateName]]]; + [template parseString:templateString]; + } return [[[MiscMergeEngine alloc] initWithTemplate:template] autorelease]; } @@ -387,35 +406,36 @@ - (void)dealloc { } NSString *ApplicationSupportSubdirectoryName = @"mogenerator"; -- (NSString*)appSupportFileNamed:(NSString*)fileName_ { +- (MogeneratorTemplateDesc*)templateDescNamed:(NSString*)fileName_ { NSFileManager *fileManager = [NSFileManager defaultManager]; BOOL isDirectory; if (templatePath) { if ([fileManager fileExistsAtPath:templatePath isDirectory:&isDirectory] && isDirectory) { - return [templatePath stringByAppendingPathComponent:fileName_]; + return [[[MogeneratorTemplateDesc alloc] initWithName:fileName_ + path:[templatePath stringByAppendingPathComponent:fileName_]] autorelease]; } - } else { + } else if (templateGroup) { NSArray *appSupportDirectories = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask+NSLocalDomainMask, YES); assert(appSupportDirectories); nsenumerate (appSupportDirectories, NSString*, appSupportDirectory) { if ([fileManager fileExistsAtPath:appSupportDirectory isDirectory:&isDirectory]) { NSString *appSupportSubdirectory = [appSupportDirectory stringByAppendingPathComponent:ApplicationSupportSubdirectoryName]; - if (templateGroup) { - appSupportSubdirectory = [appSupportSubdirectory stringByAppendingPathComponent:templateGroup]; - } + appSupportSubdirectory = [appSupportSubdirectory stringByAppendingPathComponent:templateGroup]; if ([fileManager fileExistsAtPath:appSupportSubdirectory isDirectory:&isDirectory] && isDirectory) { NSString *appSupportFile = [appSupportSubdirectory stringByAppendingPathComponent:fileName_]; if ([fileManager fileExistsAtPath:appSupportFile isDirectory:&isDirectory] && !isDirectory) { - return appSupportFile; + return [[[MogeneratorTemplateDesc alloc] initWithName:fileName_ path:appSupportFile] autorelease]; } } } } + } else { + return [[[MogeneratorTemplateDesc alloc] initWithName:fileName_ path:nil] autorelease]; } - ddprintf(@"appSupportFileNamed:@\"%@\": file not found", fileName_); + ddprintf(@"templateDescNamed:@\"%@\": file not found", fileName_); exit(EXIT_FAILURE); return nil; } @@ -688,13 +708,13 @@ - (int) application: (DDCliApplication *) app int humanFilesGenerated = 0; if (model) { - MiscMergeEngine *machineH = engineWithTemplatePath([self appSupportFileNamed:@"machine.h.motemplate"]); + MiscMergeEngine *machineH = engineWithTemplateDesc([self templateDescNamed:@"machine.h.motemplate"]); assert(machineH); - MiscMergeEngine *machineM = engineWithTemplatePath([self appSupportFileNamed:@"machine.m.motemplate"]); + MiscMergeEngine *machineM = engineWithTemplateDesc([self templateDescNamed:@"machine.m.motemplate"]); assert(machineM); - MiscMergeEngine *humanH = engineWithTemplatePath([self appSupportFileNamed:@"human.h.motemplate"]); + MiscMergeEngine *humanH = engineWithTemplateDesc([self templateDescNamed:@"human.h.motemplate"]); assert(humanH); - MiscMergeEngine *humanM = engineWithTemplatePath([self appSupportFileNamed:@"human.m.motemplate"]); + MiscMergeEngine *humanM = engineWithTemplateDesc([self templateDescNamed:@"human.m.motemplate"]); assert(humanM); // Add the template var dictionary to each of the merge engines @@ -826,6 +846,47 @@ - (int) application: (DDCliApplication *) app @end +@implementation MogeneratorTemplateDesc + +- (id)initWithName:(NSString*)name_ path:(NSString*)path_ { + self = [super init]; + if (self) { + templateName = [name_ retain]; + templatePath = [path_ retain]; + } + return self; +} + +- (void)dealloc { + [templateName release]; + [templatePath release]; + [super dealloc]; +} + +- (NSString*)templateName { + return templateName; +} + +- (void)setTemplateName:(NSString*)name_ { + if (templateName != name_) { + [templateName release]; + templateName = [name_ retain]; + } +} + +- (NSString*)templatePath { + return templatePath; +} + +- (void)setTemplatePath:(NSString*)path_ { + if (templatePath != path_) { + [templatePath release]; + templatePath = [path_ retain]; + } +} + +@end + int main (int argc, char * const * argv) { return DDCliAppRunWithClass([MOGeneratorApp class]); diff --git a/mogenerator.xcodeproj/project.pbxproj b/mogenerator.xcodeproj/project.pbxproj index dda65312..89dd9e18 100644 --- a/mogenerator.xcodeproj/project.pbxproj +++ b/mogenerator.xcodeproj/project.pbxproj @@ -352,6 +352,7 @@ isa = PBXNativeTarget; buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "mogenerator" */; buildPhases = ( + 7956A85B152E4A500081B5CA /* ShellScript */, 8DD76F990486AA7600D96B5E /* Sources */, 8DD76F9B0486AA7600D96B5E /* Frameworks */, ); @@ -386,6 +387,22 @@ }; /* End PBXProject section */ +/* Begin PBXShellScriptBuildPhase section */ + 7956A85B152E4A500081B5CA /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "sh build-mogenerator-Info-plist.sh\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 8DD76F990486AA7600D96B5E /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -460,6 +477,12 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; INSTALL_PATH = "$(HOME)/bin"; + OTHER_LDFLAGS = ( + "-sectcreate", + __TEXT, + __info_plist, + "/tmp/mogenerator-Info.plist", + ); PRODUCT_NAME = mogenerator; WARNING_CFLAGS = "-Wall"; }; @@ -477,6 +500,12 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; INSTALL_PATH = "$(HOME)/bin"; + OTHER_LDFLAGS = ( + "-sectcreate", + __TEXT, + __info_plist, + "/tmp/mogenerator-Info.plist", + ); PRODUCT_NAME = mogenerator; WARNING_CFLAGS = "-Wall"; }; From 55d73085874ccfe93298691464d19413faf0e980 Mon Sep 17 00:00:00 2001 From: rentzsch Date: Wed, 11 Apr 2012 21:21:22 -0500 Subject: [PATCH 02/10] [DEV] Bump copyright year. --- mogenerator.h | 2 +- mogenerator.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mogenerator.h b/mogenerator.h index 5d432efa..cede1f25 100644 --- a/mogenerator.h +++ b/mogenerator.h @@ -1,6 +1,6 @@ /******************************************************************************* mogenerator.h - - Copyright (c) 2006-2011 Jonathan 'Wolf' Rentzsch: + Copyright (c) 2006-2012 Jonathan 'Wolf' Rentzsch: Some rights reserved: ***************************************************************************/ diff --git a/mogenerator.m b/mogenerator.m index e332ec78..817d1d1e 100644 --- a/mogenerator.m +++ b/mogenerator.m @@ -1,6 +1,6 @@ /******************************************************************************* mogenerator.m - - Copyright (c) 2006-2011 Jonathan 'Wolf' Rentzsch: + Copyright (c) 2006-2012 Jonathan 'Wolf' Rentzsch: Some rights reserved: ***************************************************************************/ From af693b319e82053f16f6b757e5ceb437e4621d78 Mon Sep 17 00:00:00 2001 From: rentzsch Date: Thu, 12 Apr 2012 21:10:16 -0500 Subject: [PATCH 03/10] [NEW] Make attribute type naming smarter, especially in regards to attributeValueClassName. `Class` and `id` get passed through unmolested into Obj-C code, NSObject is promoted into `id` and everything else gets an asterisk tacked onto the end of it. --- mogenerator.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mogenerator.m b/mogenerator.m index 817d1d1e..571661fb 100644 --- a/mogenerator.m +++ b/mogenerator.m @@ -323,9 +323,14 @@ - (NSString*)objectAttributeClassName { } - (NSString*)objectAttributeType { NSString *result = [self objectAttributeClassName]; - result = [result stringByAppendingString:@" *"]; - if ([result isEqualToString:@"NSObject *"]) { + if ([result isEqualToString:@"Class"]) { + // `Class` (don't append asterisk). + } else if ([result rangeOfString:@"<"].location != NSNotFound) { + // `id` (don't append asterisk). + } else if ([result isEqualToString:@"NSObject"]) { result = @"id"; + } else { + result = [result stringByAppendingString:@"*"]; // Make it a pointer. } return result; } From 74cf7a827f46e5e2b5bcb86009c4950b95abbf71 Mon Sep 17 00:00:00 2001 From: rentzsch Date: Thu, 12 Apr 2012 21:19:53 -0500 Subject: [PATCH 04/10] [DEV] Regenerated TestMule files. --- mogeneratorTestMule/MOs/_ChildMO.h | 7 +-- mogeneratorTestMule/MOs/_ChildMO.m | 1 + mogeneratorTestMule/MOs/_HumanMO.h | 13 ++--- mogeneratorTestMule/MOs/_HumanMO.m | 1 + mogeneratorTestMule/MOs/_ParentMO.h | 81 +++++++++++++++-------------- mogeneratorTestMule/MOs/_ParentMO.m | 1 + 6 files changed, 55 insertions(+), 49 deletions(-) diff --git a/mogeneratorTestMule/MOs/_ChildMO.h b/mogeneratorTestMule/MOs/_ChildMO.h index 59e59e1f..9b9bd2ba 100644 --- a/mogeneratorTestMule/MOs/_ChildMO.h +++ b/mogeneratorTestMule/MOs/_ChildMO.h @@ -31,7 +31,7 @@ extern const struct ChildMOFetchedProperties { -@property (nonatomic, retain) NSString *childName; +@property (nonatomic, retain) NSString* childName; //- (BOOL)validateChildName:(id*)value_ error:(NSError**)error_; @@ -52,6 +52,7 @@ extern const struct ChildMOFetchedProperties { + @end @interface _ChildMO (CoreDataGeneratedAccessors) @@ -61,8 +62,8 @@ extern const struct ChildMOFetchedProperties { @interface _ChildMO (CoreDataGeneratedPrimitiveAccessors) -- (NSString *)primitiveChildName; -- (void)setPrimitiveChildName:(NSString *)value; +- (NSString*)primitiveChildName; +- (void)setPrimitiveChildName:(NSString*)value; diff --git a/mogeneratorTestMule/MOs/_ChildMO.m b/mogeneratorTestMule/MOs/_ChildMO.m index dfbd06e7..1aa7764a 100644 --- a/mogeneratorTestMule/MOs/_ChildMO.m +++ b/mogeneratorTestMule/MOs/_ChildMO.m @@ -97,4 +97,5 @@ + (NSArray*)fetchByParent:(NSManagedObjectContext*)moc_ parent:(ParentMO*)parent } + @end diff --git a/mogeneratorTestMule/MOs/_HumanMO.h b/mogeneratorTestMule/MOs/_HumanMO.h index 0583bfc6..3f457e1c 100644 --- a/mogeneratorTestMule/MOs/_HumanMO.h +++ b/mogeneratorTestMule/MOs/_HumanMO.h @@ -37,7 +37,7 @@ extern const struct HumanMOFetchedProperties { -@property (nonatomic, retain) NSData *hairColorStorage; +@property (nonatomic, retain) NSData* hairColorStorage; //- (BOOL)validateHairColorStorage:(id*)value_ error:(NSError**)error_; @@ -45,7 +45,7 @@ extern const struct HumanMOFetchedProperties { -@property (nonatomic, retain) NSString *humanName; +@property (nonatomic, retain) NSString* humanName; //- (BOOL)validateHumanName:(id*)value_ error:(NSError**)error_; @@ -76,6 +76,7 @@ extern const struct HumanMOFetchedProperties { + @end @interface _HumanMO (CoreDataGeneratedAccessors) @@ -87,14 +88,14 @@ extern const struct HumanMOFetchedProperties { -- (NSData *)primitiveHairColorStorage; -- (void)setPrimitiveHairColorStorage:(NSData *)value; +- (NSData*)primitiveHairColorStorage; +- (void)setPrimitiveHairColorStorage:(NSData*)value; -- (NSString *)primitiveHumanName; -- (void)setPrimitiveHumanName:(NSString *)value; +- (NSString*)primitiveHumanName; +- (void)setPrimitiveHumanName:(NSString*)value; diff --git a/mogeneratorTestMule/MOs/_HumanMO.m b/mogeneratorTestMule/MOs/_HumanMO.m index 4fd00cd6..f2be4ae0 100644 --- a/mogeneratorTestMule/MOs/_HumanMO.m +++ b/mogeneratorTestMule/MOs/_HumanMO.m @@ -192,4 +192,5 @@ + (NSArray*)fetchByHumanName:(NSManagedObjectContext*)moc_ humanName:(NSString*) } + @end diff --git a/mogeneratorTestMule/MOs/_ParentMO.h b/mogeneratorTestMule/MOs/_ParentMO.h index 551ef140..5e9d8ca4 100644 --- a/mogeneratorTestMule/MOs/_ParentMO.h +++ b/mogeneratorTestMule/MOs/_ParentMO.h @@ -57,7 +57,7 @@ extern const struct ParentMOFetchedProperties { -@property (nonatomic, retain) NSData *myBinaryData; +@property (nonatomic, retain) NSData* myBinaryData; //- (BOOL)validateMyBinaryData:(id*)value_ error:(NSError**)error_; @@ -65,7 +65,7 @@ extern const struct ParentMOFetchedProperties { -@property (nonatomic, retain) NSNumber *myBoolean; +@property (nonatomic, retain) NSNumber* myBoolean; @property BOOL myBooleanValue; @@ -77,7 +77,7 @@ extern const struct ParentMOFetchedProperties { -@property (nonatomic, retain) NSDate *myDate; +@property (nonatomic, retain) NSDate* myDate; //- (BOOL)validateMyDate:(id*)value_ error:(NSError**)error_; @@ -85,7 +85,7 @@ extern const struct ParentMOFetchedProperties { -@property (nonatomic, retain) NSDecimalNumber *myDecimal; +@property (nonatomic, retain) NSDecimalNumber* myDecimal; //- (BOOL)validateMyDecimal:(id*)value_ error:(NSError**)error_; @@ -93,7 +93,7 @@ extern const struct ParentMOFetchedProperties { -@property (nonatomic, retain) NSNumber *myDouble; +@property (nonatomic, retain) NSNumber* myDouble; @property double myDoubleValue; @@ -105,7 +105,7 @@ extern const struct ParentMOFetchedProperties { -@property (nonatomic, retain) NSNumber *myFloat; +@property (nonatomic, retain) NSNumber* myFloat; @property float myFloatValue; @@ -117,7 +117,7 @@ extern const struct ParentMOFetchedProperties { -@property (nonatomic, retain) NSNumber *myInt16; +@property (nonatomic, retain) NSNumber* myInt16; @property int16_t myInt16Value; @@ -129,7 +129,7 @@ extern const struct ParentMOFetchedProperties { -@property (nonatomic, retain) NSNumber *myInt16Transient; +@property (nonatomic, retain) NSNumber* myInt16Transient; @property int16_t myInt16TransientValue; @@ -141,7 +141,7 @@ extern const struct ParentMOFetchedProperties { -@property (nonatomic, retain) NSNumber *myInt32; +@property (nonatomic, retain) NSNumber* myInt32; @property int32_t myInt32Value; @@ -153,7 +153,7 @@ extern const struct ParentMOFetchedProperties { -@property (nonatomic, retain) NSNumber *myInt64; +@property (nonatomic, retain) NSNumber* myInt64; @property int64_t myInt64Value; @@ -165,7 +165,7 @@ extern const struct ParentMOFetchedProperties { -@property (nonatomic, retain) NSString *myString; +@property (nonatomic, retain) NSString* myString; //- (BOOL)validateMyString:(id*)value_ error:(NSError**)error_; @@ -173,7 +173,7 @@ extern const struct ParentMOFetchedProperties { -@property (nonatomic, retain) idmyTransformableSansClassName; +@property (nonatomic, retain) id myTransformableSansClassName; //- (BOOL)validateMyTransformableSansClassName:(id*)value_ error:(NSError**)error_; @@ -181,7 +181,7 @@ extern const struct ParentMOFetchedProperties { -@property (nonatomic, retain) NSColor *myTransformableWithClassName; +@property (nonatomic, retain) NSColor* myTransformableWithClassName; //- (BOOL)validateMyTransformableWithClassName:(id*)value_ error:(NSError**)error_; @@ -189,7 +189,7 @@ extern const struct ParentMOFetchedProperties { -@property (nonatomic, retain) NSString *parentName; +@property (nonatomic, retain) NSString* parentName; //- (BOOL)validateParentName:(id*)value_ error:(NSError**)error_; @@ -205,6 +205,7 @@ extern const struct ParentMOFetchedProperties { + @end @interface _ParentMO (CoreDataGeneratedAccessors) @@ -219,14 +220,14 @@ extern const struct ParentMOFetchedProperties { @interface _ParentMO (CoreDataGeneratedPrimitiveAccessors) -- (NSData *)primitiveMyBinaryData; -- (void)setPrimitiveMyBinaryData:(NSData *)value; +- (NSData*)primitiveMyBinaryData; +- (void)setPrimitiveMyBinaryData:(NSData*)value; -- (NSNumber *)primitiveMyBoolean; -- (void)setPrimitiveMyBoolean:(NSNumber *)value; +- (NSNumber*)primitiveMyBoolean; +- (void)setPrimitiveMyBoolean:(NSNumber*)value; - (BOOL)primitiveMyBooleanValue; - (void)setPrimitiveMyBooleanValue:(BOOL)value_; @@ -234,20 +235,20 @@ extern const struct ParentMOFetchedProperties { -- (NSDate *)primitiveMyDate; -- (void)setPrimitiveMyDate:(NSDate *)value; +- (NSDate*)primitiveMyDate; +- (void)setPrimitiveMyDate:(NSDate*)value; -- (NSDecimalNumber *)primitiveMyDecimal; -- (void)setPrimitiveMyDecimal:(NSDecimalNumber *)value; +- (NSDecimalNumber*)primitiveMyDecimal; +- (void)setPrimitiveMyDecimal:(NSDecimalNumber*)value; -- (NSNumber *)primitiveMyDouble; -- (void)setPrimitiveMyDouble:(NSNumber *)value; +- (NSNumber*)primitiveMyDouble; +- (void)setPrimitiveMyDouble:(NSNumber*)value; - (double)primitiveMyDoubleValue; - (void)setPrimitiveMyDoubleValue:(double)value_; @@ -255,8 +256,8 @@ extern const struct ParentMOFetchedProperties { -- (NSNumber *)primitiveMyFloat; -- (void)setPrimitiveMyFloat:(NSNumber *)value; +- (NSNumber*)primitiveMyFloat; +- (void)setPrimitiveMyFloat:(NSNumber*)value; - (float)primitiveMyFloatValue; - (void)setPrimitiveMyFloatValue:(float)value_; @@ -264,8 +265,8 @@ extern const struct ParentMOFetchedProperties { -- (NSNumber *)primitiveMyInt16; -- (void)setPrimitiveMyInt16:(NSNumber *)value; +- (NSNumber*)primitiveMyInt16; +- (void)setPrimitiveMyInt16:(NSNumber*)value; - (int16_t)primitiveMyInt16Value; - (void)setPrimitiveMyInt16Value:(int16_t)value_; @@ -273,8 +274,8 @@ extern const struct ParentMOFetchedProperties { -- (NSNumber *)primitiveMyInt16Transient; -- (void)setPrimitiveMyInt16Transient:(NSNumber *)value; +- (NSNumber*)primitiveMyInt16Transient; +- (void)setPrimitiveMyInt16Transient:(NSNumber*)value; - (int16_t)primitiveMyInt16TransientValue; - (void)setPrimitiveMyInt16TransientValue:(int16_t)value_; @@ -282,8 +283,8 @@ extern const struct ParentMOFetchedProperties { -- (NSNumber *)primitiveMyInt32; -- (void)setPrimitiveMyInt32:(NSNumber *)value; +- (NSNumber*)primitiveMyInt32; +- (void)setPrimitiveMyInt32:(NSNumber*)value; - (int32_t)primitiveMyInt32Value; - (void)setPrimitiveMyInt32Value:(int32_t)value_; @@ -291,8 +292,8 @@ extern const struct ParentMOFetchedProperties { -- (NSNumber *)primitiveMyInt64; -- (void)setPrimitiveMyInt64:(NSNumber *)value; +- (NSNumber*)primitiveMyInt64; +- (void)setPrimitiveMyInt64:(NSNumber*)value; - (int64_t)primitiveMyInt64Value; - (void)setPrimitiveMyInt64Value:(int64_t)value_; @@ -300,8 +301,8 @@ extern const struct ParentMOFetchedProperties { -- (NSString *)primitiveMyString; -- (void)setPrimitiveMyString:(NSString *)value; +- (NSString*)primitiveMyString; +- (void)setPrimitiveMyString:(NSString*)value; @@ -312,14 +313,14 @@ extern const struct ParentMOFetchedProperties { -- (NSColor *)primitiveMyTransformableWithClassName; -- (void)setPrimitiveMyTransformableWithClassName:(NSColor *)value; +- (NSColor*)primitiveMyTransformableWithClassName; +- (void)setPrimitiveMyTransformableWithClassName:(NSColor*)value; -- (NSString *)primitiveParentName; -- (void)setPrimitiveParentName:(NSString *)value; +- (NSString*)primitiveParentName; +- (void)setPrimitiveParentName:(NSString*)value; diff --git a/mogeneratorTestMule/MOs/_ParentMO.m b/mogeneratorTestMule/MOs/_ParentMO.m index c29dd4cb..bf9e53ef 100644 --- a/mogeneratorTestMule/MOs/_ParentMO.m +++ b/mogeneratorTestMule/MOs/_ParentMO.m @@ -336,4 +336,5 @@ - (NSMutableSet*)childrenSet { + @end From be275de56aa70fe760a0a64c924e8c6127c0223d Mon Sep 17 00:00:00 2001 From: rentzsch Date: Thu, 12 Apr 2012 21:39:05 -0500 Subject: [PATCH 05/10] [VERSION] 1.26 --- mogenerator.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mogenerator.m b/mogenerator.m index 571661fb..f17b870a 100644 --- a/mogenerator.m +++ b/mogenerator.m @@ -631,7 +631,7 @@ - (int) application: (DDCliApplication *) app } if (_version) { - printf("mogenerator 1.25. By Jonathan 'Wolf' Rentzsch + friends.\n"); + printf("mogenerator 1.26. By Jonathan 'Wolf' Rentzsch + friends.\n"); return EXIT_SUCCESS; } From 77656d3a07b885fce2109f58cac9155dc292fd04 Mon Sep 17 00:00:00 2001 From: rentzsch Date: Thu, 12 Apr 2012 21:48:30 -0500 Subject: [PATCH 06/10] [CHANGE] Installer: don't install templates any more (the standard templates are now integrated into the mogenerator binary itself). --- installer/make_installer.command | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installer/make_installer.command b/installer/make_installer.command index 196da766..64a9eac9 100755 --- a/installer/make_installer.command +++ b/installer/make_installer.command @@ -8,7 +8,8 @@ mkdir -p 'build/root/Library/Application Support/mogenerator' cd .. xcodebuild -configuration Release CONFIGURATION_BUILD_DIR="$PWD/installer/build/root/usr/bin/" -cp templates/*.motemplate "$PWD/installer/build/root/Library/Application Support/mogenerator/" +# The standard templates are now integrated into mogenerator's binary itself. +# cp templates/*.motemplate "$PWD/installer/build/root/Library/Application Support/mogenerator/" cd installer VERSION=`build/root/usr/bin/mogenerator --version|head -n 1|sed -E 's/mogenerator ([0-9]+\.[0-9]+(\.[0-9]+)?).+/\1/g'` From 63429912fef5172c2a84bb923b23a6e955182f6d Mon Sep 17 00:00:00 2001 From: rentzsch Date: Thu, 12 Apr 2012 21:54:07 -0500 Subject: [PATCH 07/10] [CHANGE] Installer: don't install Xmo'd any more since 1) Xmo'd doesn't work with Xcode 4 yet and 2) Xcode.app now lives in /Applications, so the installer needs to get smarter to cope. --- installer/make_installer.command | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/installer/make_installer.command b/installer/make_installer.command index 64a9eac9..4f534784 100755 --- a/installer/make_installer.command +++ b/installer/make_installer.command @@ -19,9 +19,9 @@ MINOR_VERSION=`echo $VERSION|sed -E 's/[0-9]+\.([0-9]+).*/\1/g'` sed -E "s/VERSION/$VERSION/g" < Description.plist > 'build/Description.plist' sed -e "s/MAJOR_VERSION/$MAJOR_VERSION/g" -e "s/MINOR_VERSION/$MINOR_VERSION/g" -e "s/VERSION/$VERSION/g" < Info.plist > 'build/Info.plist' -cd ../Xmod -xcodebuild -configuration Release CONFIGURATION_BUILD_DIR="`dirname $PWD`/installer/build/root/Developer/Library/Xcode/Plug-ins/" -cd ../installer +# cd ../Xmod +# xcodebuild -configuration Release CONFIGURATION_BUILD_DIR="`dirname $PWD`/installer/build/root/Developer/Library/Xcode/Plug-ins/" +# cd ../installer sudo chown -R root 'build/root' sudo chgrp -R admin 'build/root' From 9ad831b684a5c248cacbd5013603ca77432e28b2 Mon Sep 17 00:00:00 2001 From: rentzsch Date: Thu, 12 Apr 2012 21:55:19 -0500 Subject: [PATCH 08/10] [DEV] Bump copyright year in installer file (it was waaaay out of date). --- installer/Info.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/Info.plist b/installer/Info.plist index e09e4521..7cd39eab 100644 --- a/installer/Info.plist +++ b/installer/Info.plist @@ -3,7 +3,7 @@ CFBundleGetInfoString - VERSION, Copyright © 2006-2007 Jonathan 'Wolf' Rentzsch + VERSION, Copyright © 2006-2012 Jonathan 'Wolf' Rentzsch CFBundleIdentifier com.rentzsch.mogenerator CFBundleShortVersionString From 3c371bcedc5a3e21fd8f90d261f7260117d81d9a Mon Sep 17 00:00:00 2001 From: rentzsch Date: Thu, 12 Apr 2012 21:58:40 -0500 Subject: [PATCH 09/10] [CHANGE] Installer: don't install templates any more (the standard templates are now integrated into the mogenerator binary itself). --- installer/Description.plist | 2 +- installer/make_installer.command | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/installer/Description.plist b/installer/Description.plist index 90528be3..9f5e6b85 100644 --- a/installer/Description.plist +++ b/installer/Description.plist @@ -5,6 +5,6 @@ IFPkgDescriptionDescription Implements generation gap codegen pattern for Core Data. Inspired by eogenerator. IFPkgDescriptionTitle - mogenerator + Xmo'd VERSION + mogenerator VERSION diff --git a/installer/make_installer.command b/installer/make_installer.command index 4f534784..31410dff 100755 --- a/installer/make_installer.command +++ b/installer/make_installer.command @@ -4,11 +4,11 @@ cd "`dirname \"$0\"`" sudo echo sudo rm -rf 'build' -mkdir -p 'build/root/Library/Application Support/mogenerator' cd .. xcodebuild -configuration Release CONFIGURATION_BUILD_DIR="$PWD/installer/build/root/usr/bin/" # The standard templates are now integrated into mogenerator's binary itself. +# mkdir -p 'build/root/Library/Application Support/mogenerator' # cp templates/*.motemplate "$PWD/installer/build/root/Library/Application Support/mogenerator/" cd installer From 4fd6f8d061dbc9d88a5251de167a1c2c778036f6 Mon Sep 17 00:00:00 2001 From: rentzsch Date: Thu, 12 Apr 2012 22:46:14 -0500 Subject: [PATCH 10/10] [CHANGELOG] 1.26 --- README.markdown | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.markdown b/README.markdown index 41a5d9ac..24be1303 100644 --- a/README.markdown +++ b/README.markdown @@ -20,6 +20,20 @@ Xmo'd works by noticing when your `*.xcdatamodel` is saved. If the model file's ## Version History +### v1.26: Thu Apr 12 2012 [download](http://github.com/downloads/rentzsch/mogenerator/mogenerator-1.26.dmg) + +* [FIX] Missing space in transformable attribute codegen. [issue 89](https://github.com/rentzsch/mogenerator/issues/89) ([Daniel Tull](https://github.com/rentzsch/mogenerator/issues/89), [Kris Markel](https://github.com/rentzsch/mogenerator/pull/99), [Whitney Young](https://github.com/rentzsch/mogenerator/pull/101)) + +* [NEW] mogenerator's standard templates are now bundled into the mogenerator binary itself. This should solve the problem of templates growing out of sync with the intended version of mogenerator ([exacerbated](https://github.com/rentzsch/mogenerator/issues/93#issuecomment-4059248) by the now-popular homebrew installer). You can still use your own templates with the `--template-path` and `--template-group` parameters. [issue 79](https://github.com/rentzsch/mogenerator/pull/79) (Ingvar Nedrebo, rentzsch). + +* [NEW] Support for per-entity custom base classes, set via `mogenerator.customBaseClass` key in the entity's user info. ([Trevor Squires](https://github.com/rentzsch/mogenerator/pull/94)) + +* [CHANGE] mogenerator installer no longer installs separate template files (but it won't touch those already installed). + +* [CHANGE] mogenerator's .pkg installer no longer includes Xmo'd since 1) Xmo'd doesn't work with Xcode 4 yet and 2) Xcode.app now lives in /Applications, so the installer needs to get smarter to cope. + + + ### v1.25: Thu Feb 16 2012 [download](http://github.com/downloads/rentzsch/mogenerator/mogenerator-1.25.dmg) * [NEW] Support for Xcode 4.3 and it's relocation of `momc` into its bundle. Only supports /Applications/Xcode.app for now. ([Matt McGlincy](https://github.com/rentzsch/mogenerator/pull/90))