documentationmogenerator

How do the Mogenerator parameters work, which can I send via Xcode?


The help for Mogenerator is very minimal. What do all the parameters do?


Solution

  • Parameters that work both via the command line utility and Xcode:

    Using relative paths in Xcode for any of the above arguments won't work since the working directory is set to one of the root directories of the system (e.g. Applications, Developer, Library, or System). (I haven't had enough time to figure out which one of these it is exactly.)

    Parameters that cannot be used in Xcode:

    Running and sending parameters to xmod via Xcode:

    (Update: I haven't tried this on Xcode 4, only Xcode 3. For Xcode 4, you can add mogenerator as a build phase instead of following the following steps.)

    1. Go to the info page of the .xcdatamodel file.
    2. Choose the Comments tab.
    3. Add xmod to the comments field, on its own line.
    4. Every time you save the model, it will regenerate the machine files for you.

    To send parameters, they must be on their own line(s):

    This works:

    xmod
    --base-class CLASS
    --template-path PATH
    

    And even this works:

    xmod
    --base-class CLASS --template-path PATH
    

    But, this won't work:

    xmod --base-class CLASS --template-path PATH
    

    Note: You must close the Info window for the settings to take effect.