Skip to content
This repository

Fix to issue 69 #71

Merged
merged 2 commits into from over 2 years ago

2 participants

Joe Carroll Jonathan 'Wolf' Rentzsch
Joe Carroll

Managed to get a little free time and noticed that change I made wasnt too drastic. I added functionality to force base class to be set even if the user has entities with parent entities (--base-class-force). If the user just chooses --base-class there will be no changes in behavior from what they are used to.

added some commits August 28, 2011
resolving build path issues, changed from Current Mac OS to Latest Ma…
…c OS X
0a9bbd6
adding a base-class-force option that will use user provided base cla…
…ss even if a super entity exists. Base-class will still function normally
49824e8
Jonathan 'Wolf' Rentzsch rentzsch merged commit d032e96 into from August 28, 2011
Jonathan 'Wolf' Rentzsch rentzsch closed this August 28, 2011
Jonathan 'Wolf' Rentzsch
Owner

Looks good, pulled. It will be in the next release. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Aug 28, 2011
resolving build path issues, changed from Current Mac OS to Latest Ma…
…c OS X
0a9bbd6
adding a base-class-force option that will use user provided base cla…
…ss even if a super entity exists. Base-class will still function normally
49824e8
This page is out of date. Refresh to see the latest.
1  mogenerator.h
@@ -53,6 +53,7 @@
53 53
 	NSString				*tempMOMPath;
54 54
 	NSManagedObjectModel	*model;
55 55
 	NSString				*baseClass;
  56
+	NSString				*baseClassForce;
56 57
 	NSString				*includem;
57 58
 	NSString				*includeh;
58 59
 	NSString				*templatePath;
25  mogenerator.m
@@ -10,6 +10,7 @@
10 10
 
11 11
 static NSString *kTemplateVar = @"TemplateVar";
12 12
 NSString	*gCustomBaseClass;
  13
+NSString	*gCustomBaseClassForced;
13 14
 
14 15
 @interface NSEntityDescription (fetchedPropertiesAdditions)
15 16
 - (NSDictionary *)fetchedPropertiesByName;
@@ -66,11 +67,15 @@ - (BOOL)hasCustomSuperentity {
66 67
 	}
67 68
 }
68 69
 - (NSString*)customSuperentity {
69  
-	NSEntityDescription *superentity = [self superentity];
70  
-	if (superentity) {
71  
-		return [superentity managedObjectClassName];
  70
+	if(!gCustomBaseClassForced) {
  71
+		NSEntityDescription *superentity = [self superentity];
  72
+		if (superentity) {
  73
+			return [superentity managedObjectClassName];
  74
+		} else {
  75
+			return gCustomBaseClass ? gCustomBaseClass : @"NSManagedObject";
  76
+		}
72 77
 	} else {
73  
-		return gCustomBaseClass ? gCustomBaseClass : @"NSManagedObject";
  78
+		return gCustomBaseClassForced;
74 79
 	}
75 80
 }
76 81
 /** @TypeInfo NSAttributeDescription */
@@ -361,6 +366,7 @@ - (void) application: (DDCliApplication *) app
361 366
     // Long					Short   Argument options
362 367
     {@"model",				'm',    DDGetoptRequiredArgument},
363 368
     {@"base-class",			0,     DDGetoptRequiredArgument},
  369
+	{@"base-class-force",	0,     DDGetoptRequiredArgument},
364 370
     // For compatibility:
365 371
     {@"baseClass",			0,      DDGetoptRequiredArgument},
366 372
     {@"includem",			0,      DDGetoptRequiredArgument},
@@ -389,6 +395,7 @@ - (void) printUsage;
389 395
     printf("\n"
390 396
            "  -m, --model MODEL             Path to model\n"
391 397
            "      --base-class CLASS        Custom base class\n"
  398
+		   "      --base-class-force CLASS  Same as --base-class except will force all entities to have the specified base class. Even if a super entity exists\n"
392 399
            "      --includem FILE           Generate aggregate include file for .m files for both human and machine generated source files\n"
393 400
            "      --includeh FILE           Generate aggregate include file for .h files for human generated source files only\n"
394 401
            "      --template-path PATH      Path to templates (absolute or relative to model path)\n"
@@ -531,8 +538,14 @@ - (int) application: (DDCliApplication *) app
531 538
         printf("mogenerator 1.23. By Jonathan 'Wolf' Rentzsch + friends.\n");
532 539
         return EXIT_SUCCESS;
533 540
     }
534  
-	
535  
-    gCustomBaseClass = [baseClass retain];
  541
+
  542
+	if(baseClassForce) {
  543
+		gCustomBaseClassForced = [baseClassForce retain];
  544
+		gCustomBaseClass = gCustomBaseClassForced;
  545
+	} else {
  546
+		gCustomBaseClass = [baseClass retain];
  547
+	}
  548
+
536 549
     NSString * mfilePath = includem;
537 550
 	NSString * hfilePath = includeh;
538 551
 	
2  mogenerator.xcodeproj/project.pbxproj
@@ -486,6 +486,7 @@
486 486
 			isa = XCBuildConfiguration;
487 487
 			buildSettings = {
488 488
 				ARCHS = "$(NATIVE_ARCH_ACTUAL)";
  489
+				SDKROOT = macosx;
489 490
 			};
490 491
 			name = Debug;
491 492
 		};
@@ -493,6 +494,7 @@
493 494
 			isa = XCBuildConfiguration;
494 495
 			buildSettings = {
495 496
 				ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
  497
+				SDKROOT = macosx;
496 498
 			};
497 499
 			name = Release;
498 500
 		};
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.