Skip to content

Latest commit

 

History

History
112 lines (51 loc) · 9.31 KB

README.markdown

File metadata and controls

112 lines (51 loc) · 9.31 KB

#mogenerator + Xmo'd

Visit the project's pretty homepage.

Read the project's backgrounder. Or, for the impatient:

mogenerator is a command-line tool that, given an .xcdatamodel file, will generate two classes per entity. The first class, _MyEntity, is intended solely for machine consumption and will be continuously overwritten to stay in sync with your data model. The second class, MyEntity, subclasses _MyEntity, won't ever be overwritten and is a great place to put your custom logic.

Using Xmo'd

Xmo'd (pronounced ex-mowed) is an Xcode plugin that integrates mogenerator into Xcode. It saves you the hassle of having to write a Run Script Build Phase and/or manually adding+removing source files from your project as you add+remove entities.

Xmo'd works by noticing when your *.xcdatamodel is saved. If the model file's Xcode project item comment contains xmod, an AppleScript is fired that creates a folder based on your model's file name and populates it with derived source code files from your model. It then adds the new folder to your project as a Group Reference and adds all the source files to your project.

Version History

v1.21: Mon Nov 1 2010 download

  • [NEW] Machine templates now include fetched properties by default. (Jonathan del Strother)

  • [NEW] Xmo'd: better support for --(machine|human|output)-dir model option path: now they can be full or relative to the model file. Xcode group and file references are no longer deleted/re-added with every save. (John Turnipseed)

  • [NEW] Xmo'd: --log-command model option. When enabled, Xmo'd will log (to Console.app) the generated+executed mogenerator invocation. Good for automation debugging and also can provide training wheels for using mogenerator directly. (rentzsch)

  • [FIX] Avoid nil substitution dictionary in generated fetch request wrapper code, which resulted in an NSInvalidArgumentException reason "Cannot substitute a nil substitution dictionary." (Anthony Mittaz)

v1.20: Thu Aug 12 2010 download

  • [NEW] Xmo'd: model comments that start with -- are passed as args to mogenerator. This allows accessing command-line options such as --base-class. (David LeBer)

  • [NEW] Forward-declare transformable attribute class types. bug 11 (seanm)

  • [CHANGE] Generated accessors that return BOOLs now return NO instead of 0, avoiding LLVM Static Analyzer warnings. bug 8 (seanm)

  • [CHANGE] Generated value accessors that return ints no longer needlessly check for nil. bug 10 (seanm)

  • [CHANGE] LLVM 2/Xcode 4 doesn't like [NSDictionary dictionaryWithObjectsAndKeys:nil], issuing a "missing sentinel in method dispatch" warning. Add hasBindings to prettyFetchRequests so we can just generate NSDictionary *substitutionVariables = nil in that case. (Anthony Mittaz)

  • [FIX] Variable shadowing bug which would cause v1.19's xcode-select functionality to always fail. (Nikita Zhuk)

v1.19: Sun 4 Jul 2010 download

  • [NEW] Use xcode-select to dynamically discover our way to momc instead of only hard-coding /Developer. (Josh Abernathy)

v1.18: Thu 1 Jul 2010 download

  • [NEW] Xmo'd works with versioned data models. (rentzsch)

  • [NEW] Support for fetched properties (Nikita Zhuk)

  • [NEW] NSParameterAssert(moc) in fetch request wrappers. (rentzsch)

v1.17: Sat 27 Mar 2010 download

  • [NEW] +[Machine entityName] (for @drance) and +[Machine entityInManagedObjectContext:] (Michael Dales).

  • [NEW] --list-source-files option, which lists model-related source files. (rentzsch)

  • [NEW] Add --orphaned option. (rentzsch)

Couple --orphaned with --model to get a listing of source files that no longer have corresponding entities in the model. The intent is to be able to pipe its output to xargs + git to remove deleted and renamed entities in one command, something like:

$ mogenerator --model ../MyModel.xcdatamodel --orphaned | xargs git rm

v1.16: Mon 4 Jan 2010 download

  • [NEW] machine.h template now produces type-safe scalar attribute property declarations. (rentzsch)

  • [CHANGE] Remove machine.m implementations of to-many relationship setters. (rentzsch)

  • [CHANGE] Xmo'd: change file ordering to human.m, human.h, machine.m, machine.h (from human.h, human.m, machine.h, machine.m). (rentzsch)

  • [FIX] Missing space for fetch requests with multiple bindings. (Frederik Seiffert)

v1.15: Mon 2 Nov 2009 download

  • [CHANGE] Xmo'd: now adds .h human+machine header files to project (in addition to current .m + .mm files). (rentzsch)

  • [NEW] Now supports key paths in fetch request predicates so long as they're relationships. (Jon Olson)

  • [FIX] Log fetch-request-wrapper errors to NSLog() on iPhone since it lacks -[NSApp presentError:]. (rentzsch)

  • [NEW] +insertInManagedObjectContext: NSParameterAssert()'s its moc arg. (rentzsch)

v1.14: Fri 9 Oct 2009 download

  • IMPORTANT: 1.14 generates code that may be incompatible with clients of 1.13-or-earlier generated code. +newInManagedObjectContext: has been replaced with +insertInManagedObjectContext: and method implementations have been replaced with @dynamic, which don't work so well with overriding (most of these uses can be replaced with Cocoa Bindings). Upgrade only if you have spare cycles to fix-up existing projects.

  • [CHANGE] changed +newInManagedObjectContext: to +insertInManagedObjectContext: to satisfy the LLVM/clang static analyser. (Ruotger Skupin)

  • [CHANGE] Default machine templates now use @dynamic. The old templates still available in contributed templates/rentzsch non-dynamic. (Pierre Bernard)

  • [CHANGE] Xmo'd included again in default mogenerator installation -- the first time since 1.6. (rentzsch)

  • [CHANGE] Migrated project to github from self-hosted svn+trac installation.

  • [NEW] Xmo'd version checking whitelists Xcode versions 3.1(.x) and 3.2(.x).

  • [NEW] Dropped ppc support for Xmo'd. May reconsider if folks yelp. (rentzsch)