Mogenerator参数如何工作,我可以通过Xcode发送? [英] How do the Mogenerator parameters work, which can I send via Xcode?

查看:131
本文介绍了Mogenerator参数如何工作,我可以通过Xcode发送?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

摩根大通的帮助非常小。所有参数都做了什么?

解决方案

通过命令行实用程序和Xcode工作的参数:




  • - base-class :私有类(例如 _MyObject.h )将继承自。这也将以 #importMyManagedObject.h的形式添加到相同的 .h 文件的导入。提示:如果要继承的类位于库中,那么默认的import语句将不起作用。作为解决方法,您可以为您创建的每个项目提供额外的继承级别,并使该类从库继承(例如将基类设置为 MyProjectManagedObject ,您将创建它手动并继承自 MyLibManagedObject )。

  • - template-path 到达4 .motemplate 文件所在的路径。如果没有提供,它将查看所​​有的应用程序支持目录(例如/ Library / Application Support / mogenerator /)。

  • - template-group :要使用的 template-path 目录下的子目录名称。 / li>
  • - template-var arc = true 必需文件在使用ARC时进行编译。

  • - output-dir :所有生成的输出目录文件

  • - 机器目录 _< ; class> .h _< class> .m 将被输出。如果--output-dir也被定义,这个参数优先。

  • - human-dir < class> .h < class> .m 将被输出。如果--output-dir也被定义,则该参数优先。

  • - includem :文件的完整路径将包含创建的所有 .h 文件的所有 #import 。此文件不需要存在(即,如果没有)将创建该文件。此文件不会自动包含在项目中。您必须通过将其拖动到组&您的项目的文件列表。



使用Xcode中的任何上述参数的相对路径将不起作用,因为工作目录已设置到系统的一个根目录(例如Applications,Developer,Library或System)。 (我没有足够的时间弄清楚其中的哪一个是正确的。)



在Xcode中无法使用的参数:




  • - 模型:不能在Xcode中设置.xcdatamodel文件的路径。

  • - list-source-files

  • - 孤立的

  • - 版本化

  • 帮助



通过Xcode运行和发送参数到xmod:



(更新:我没有在Xcode 4上尝试过,只有Xcode 3.对于Xcode 4,你可以添加mogenerator作为构建阶段,而不是按照以下步骤。)


  1. 转到信息

  2. 选择评论标签

  3. 添加 xmod 到注释字段,自行。

  4. 每次保存模型时,它将为您重新生成机器文件。

要发送参数,它们必须在自己的行上:



这样做:

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

甚至这样做:

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

但是,这不行:

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

注意:您必须关闭设置的信息窗口生效。


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

解决方案

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

  • --base-class: The name af the base class which the "private class" (e.g. _MyObject.h) will inherit from. This will also add an import in the form of #import "MyManagedObject.h" to the same .h file. Tip: if the class you want to inherit from is located in a library, the default import statement won't work. As a workaround, you could have an extra level of inheritance for each project you create and have that class inherit from the library on (e.g. set the base class to MyProjectManagedObject which you create manually and inherit from MyLibManagedObject).
  • --template-path: The path to where the 4 .motemplate files are located. When this is not provided, it will look at all the "app support directories" (e.g. "/Library/Application Support/mogenerator/").
  • --template-group: A subdirectory name underneath the template-path directory to use.
  • --template-var arc=true: Required for the generated files to compile while using ARC.
  • --output-dir: The output directory for all generated files.
  • --machine-dir: The directory where the _<class>.h and _<class>.m will be output to. If --output-dir is also defined, this parameter takes precedence.
  • --human-dir: The directory where the <class>.h and <class>.m will be output to. If --output-dir is also defined, this parameter takes precedence.
  • --includem: the full path to a file that will include all the #import for all the .h files that are created. This file does not need to exist (i.e. it will be created for you if it doesn't). This file, will not be included in the project automatically for you. You must include it manually by dragging it into the Groups & Files list of your project.

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:

  • --model: The path to the .xcdatamodel file, cannot be set in Xcode.
  • --list-source-files
  • --orphaned
  • --versioned
  • --help

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.

这篇关于Mogenerator参数如何工作,我可以通过Xcode发送?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆