./script/solar make-vendor
VendorName
make-vendor命令为一个新的工作区创建所有的基本源代码文件。基本思想是:当你开始一个新项目的时候,你将会使用新的工作区来组织控制器、模型、视图和其他应用组件。你要以创建多个工作区,只要他们的名字不同即可。
要创建一个新的工作区,输入以下代码:
$ ./script/solar make-vendor VendorName Making vendor source directories. Creating SYSTEM/source/vendor-name/config. Creating SYSTEM/source/vendor-name/docs. Creating SYSTEM/source/vendor-name/script. Creating SYSTEM/source/vendor-name/tests. Creating SYSTEM/source/vendor-name/tests/Mock. Creating SYSTEM/source/vendor-name/tests/Mock/VendorName. Creating SYSTEM/source/vendor-name/tests/Test. Creating SYSTEM/source/vendor-name/tests/Test/VendorName. Creating SYSTEM/source/vendor-name/VendorName/Cli/Help. Creating SYSTEM/source/vendor-name/VendorName/Cli/Help/Info. Creating SYSTEM/source/vendor-name/VendorName/Cli/Help/Locale. Creating SYSTEM/source/vendor-name/VendorName/Controller/Bread/Locale. Creating SYSTEM/source/vendor-name/VendorName/Controller/Bread/Public. Creating SYSTEM/source/vendor-name/VendorName/Controller/Bread/View. Creating SYSTEM/source/vendor-name/VendorName/Controller/Command/Info. Creating SYSTEM/source/vendor-name/VendorName/Controller/Command/Locale. Creating SYSTEM/source/vendor-name/VendorName/Controller/Page/Layout. Creating SYSTEM/source/vendor-name/VendorName/Controller/Page/Locale. Creating SYSTEM/source/vendor-name/VendorName/Controller/Page/Public. Creating SYSTEM/source/vendor-name/VendorName/Controller/Page/View. Creating SYSTEM/source/vendor-name/VendorName/Model. Writing SYSTEM/source/vendor-name/VendorName/Cli/Help.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Cli/Help/Info/options.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/Locale/en_US.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/_item.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/_list.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/add.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/browse.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/delete.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/edit.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/read.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Controller/Bread/View/search.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Controller/Command.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Controller/Page.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Filter.php ... done. Making directory SYSTEM/source/vendor-name/VendorName/Sql ... done. Writing SYSTEM/source/vendor-name/VendorName/Sql/Model.php ... done. Making directory SYSTEM/source/vendor-name/VendorName/Sql/Model ... done. Writing SYSTEM/source/vendor-name/VendorName/Sql/Model/Collection.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Sql/Model/Metadata.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Sql/Model/Record.php ... done. Writing SYSTEM/source/vendor-name/config/default.php ... done. Writing SYSTEM/source/vendor-name/config/run-tests.php ... done. Writing SYSTEM/source/vendor-name/VendorName/Cli/Help/Info/help.txt ... done. Making links for vendor 'VendorName' ... Making link 'include/VendorName' ... done. Making link 'include/Test/VendorName' ... done. Making link 'include/Mock/VendorName' ... done. Making link 'script/vendor-name' ... done. ... done. Making public symlinks for 'VendorName' ... Making public directory docroot/public/VendorName/Controller ... done. Making public symlink for VendorName_Controller_Bread ... done. Making public symlink for VendorName_Controller_Page ... done. ... done. Remember to add 'VendorName_App' to the ['Solar_Controller_Front']['classes'] element in your config file so that it finds your apps. Remember to add 'VendorName_Model' to the ['Solar_Sql_Model_Catalog']['classes'] element in your config file so that it finds your models. $
上面的命令做了些什么?
-
该命令为
vendor-name
创建了新的源代码目录,并且在该目录中创建了几个标准的子目录:config
目录用于存放默认的配置文件,docs
目录用于存放文档文件,script
目录用于存放vendor-name
的命令行工具,tests
目录用于存放集成的测试示例以及VendorName
目录用于存放PHP类。 -
该命令为
VendorName
创建一系列的基础类和目录:一个最小的页面控制器,一个插删改查(browse/read/edit/add/delete, 简称"BREAD")模板控制器,以VendorName
命名的基础模型类,用于存放视图辅助类和具体模型类的子目录等等。 -
最后,该命令还创建从source目录到Solar系统其他位置的符号链接,这样的话当源码改变时,你就不需要在目录之前拷贝源码了。