Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[

Create a tmp directory (or something similar):

$ mkdir tmp
$ cd tmp

Check out the source for both Zend Tool and the current Standard Library

~/tmp$ svn co http://framework.zend.com/svn/framework/standard/branches/user/ralph/ZendTool
~/tmp$ svn co http://framework.zend.com/svn/framework/standard/trunk/library ./trunk-library
~/tmp$ ls
ZendTool trunk-library

Find your PATH, and create a symlink to the zf.sh executable.

~/tmp$ env | grep "PATH"
MANPATH=/usr/share/man:/usr/local/share/man:/usr/X11/man
PATH=/Users/ralphschindler/.bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

~/tmp$ ln -s /Users/ralphschindler/tmp/ZendTool/bin/zf.sh /Users/ralphschindler/.bin/zf
~/tmp$ chmod 755 ZendTool/bin/zf.sh

Set an environment variable ZF_PATH to point to the newly checked out trunk-library

~/tmp$ export ZF_PATH="/Users/ralphschindler/tmp/trunk-library/"

Lets show the version:

~/tmp$ zf show version
Zend Framework Version: 1.5.2

Lets try variations of the show version command:

~/tmp$ zf show version -n 0
1.5.2

~/tmp$ zf show version.major-part
ZF Major Version: 1

~/tmp$ zf show version.minor-part
ZF Minor Version: 5

~/tmp$ zf show version.mini-part
ZF Mini Version: 2

~/tmp$ zf show version -m major
Zend Framework Version: 1

~/tmp$ zf show version -m minor -n 0
1.5

~/tmp$ zf show version -m major -n 0
1

Lets create a project now, and check out what it created:

~/tmp/scratch$ zf create project
creating project at /Users/ralphschindler/tmp/scratch

~/tmp/scratch$ ls -la
total 8
drwxr-xr-x 6 ralphschindler staff 204 Jun 3 01:28 .
drwxr-xr-x 5 ralphschindler staff 170 Jun 3 01:28 ..
rw-rr- 1 ralphschindler staff 1562 Jun 3 01:28 .zfproject.xml
drwxr-xr-x 7 ralphschindler staff 238 Jun 3 01:28 application
drwxr-xr-x 3 ralphschindler staff 102 Jun 3 01:28 library
drwxr-xr-x 4 ralphschindler staff 136 Jun 3 01:28 public

~/tmp/scratch$ find .
.
./.zfproject.xml
./application
./application/bootstrap.php
./application/configs
./application/controllers
./application/controllers/ErrorController.php
./application/controllers/IndexController.php
./application/models
./application/views
./application/views/helpers
./application/views/scripts
./application/views/scripts/index
./application/views/scripts/index/index.phtml
./library
./library/Zend
./public
./public/.htaccess
./public/index.php

~/tmp/scratch$ cat .zfproject.xml
<?xml version="1.0"?>
<projectProfile>
<projectDirectory>
<projectProfileFile/>
<applicationDirectory>
<apisDirectory enabled="false"/>
<configsDirectory/>
<controllersDirectory>
<controllerFile controllerName="index"/>
<controllerFile controllerName="error"/>
</controllersDirectory>
<layoutsDirectory enabled="false"/>
<modelsDirectory/>
<modulesDirectory enabled="false"/>
<viewsDirectory>
<viewScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="index">
<viewScriptFile scriptName="index"/>
</viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
<viewFiltersDirectory enabled="false"/>
</viewsDirectory>
<bootstrapFile/>
</applicationDirectory>
<dataDirectory enabled="false">
<cacheDirectory enabled="false"/>
<searchIndexesDirectory enabled="false"/>
<localesDirectory enabled="false"/>
<logsDirectory enabled="false"/>
<sessionsDirectory enabled="false"/>
<uploadsDirectory enabled="false"/>
</dataDirectory>
<libraryDirectory>
<zfStandardLibraryDirectory/>
</libraryDirectory>
<publicDirectory>
<publicStylesheetsDirectory enabled="false"/>
<publicScriptsDirectory enabled="false"/>
<publicImagesDirectory enabled="false"/>
<publicIndexFile/>
<htaccessFile/>
</publicDirectory>
<providersDirectory enabled="false"/>
</projectDirectory>
</projectProfile>

Lets add a controller:

~/tmp/scratch$ zf create controller --name foo
Creating new controller named 'foo'
Updating project profile '/Users/ralphschindler/tmp/scratch/.zfproject.xml'
Creating a view script.
Updating project profile '/Users/ralphschindler/tmp/scratch/.zfproject.xml'

~/tmp/scratch$ find .
.
./.zfproject.xml
./application
./application/bootstrap.php
./application/configs
./application/controllers
./application/controllers/ErrorController.php
./application/controllers/FooController.php
./application/controllers/IndexController.php
./application/models
./application/views
./application/views/helpers
./application/views/scripts
./application/views/scripts/foo
./application/views/scripts/foo/index.phtml
./application/views/scripts/index
./application/views/scripts/index/index.phtml
./library
./library/Zend
./public
./public/.htaccess
./public/index.php

~/tmp/scratch$ cat .zfproject.xml
<?xml version="1.0"?>
<projectProfile>
<projectDirectory>
<projectProfileFile/>
<applicationDirectory>
<apisDirectory enabled="false"/>
<configsDirectory/>
<controllersDirectory>
<controllerFile controllerName="index"/>
<controllerFile controllerName="error"/>
<controllerFile controllerName="foo"/>
</controllersDirectory>
<layoutsDirectory enabled="false"/>
<modelsDirectory/>
<modulesDirectory enabled="false"/>
<viewsDirectory>
<viewScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="index">
<viewScriptFile scriptName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="foo">
<viewScriptFile scriptName="index"/>
</viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
<viewFiltersDirectory enabled="false"/>
</viewsDirectory>
<bootstrapFile/>
</applicationDirectory>
<dataDirectory enabled="false">
<cacheDirectory enabled="false"/>
<searchIndexesDirectory enabled="false"/>
<localesDirectory enabled="false"/>
<logsDirectory enabled="false"/>
<sessionsDirectory enabled="false"/>
<uploadsDirectory enabled="false"/>
</dataDirectory>
<libraryDirectory>
<zfStandardLibraryDirectory/>
</libraryDirectory>
<publicDirectory>
<publicStylesheetsDirectory enabled="false"/>
<publicScriptsDirectory enabled="false"/>
<publicImagesDirectory enabled="false"/>
<publicIndexFile/>
<htaccessFile/>
</publicDirectory>
<providersDirectory enabled="false"/>
</projectDirectory>
</projectProfile>

~/tmp/scratch$ zf create controller -n bar -v 0
Creating new controller named 'bar'
Updating project profile '/Users/ralphschindler/tmp/scratch/.zfproject.xml'

~/tmp/scratch$ find .
.
./.zfproject.xml
./application
./application/bootstrap.php
./application/configs
./application/controllers
./application/controllers/BarController.php
./application/controllers/ErrorController.php
./application/controllers/FooController.php
./application/controllers/IndexController.php
./application/models
./application/views
./application/views/helpers
./application/views/scripts
./application/views/scripts/foo
./application/views/scripts/foo/index.phtml
./application/views/scripts/index
./application/views/scripts/index/index.phtml
./library
./library/Zend
./public
./public/.htaccess
./public/index.php
~/tmp/scratch$ cat .zfproject.xml
<?xml version="1.0"?>
<projectProfile>
<projectDirectory>
<projectProfileFile/>
<applicationDirectory>
<apisDirectory enabled="false"/>
<configsDirectory/>
<controllersDirectory>
<controllerFile controllerName="index"/>
<controllerFile controllerName="error"/>
<controllerFile controllerName="foo"/>
<controllerFile controllerName="bar"/>
</controllersDirectory>
<layoutsDirectory enabled="false"/>
<modelsDirectory/>
<modulesDirectory enabled="false"/>
<viewsDirectory>
<viewScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="index">
<viewScriptFile scriptName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="foo">
<viewScriptFile scriptName="index"/>
</viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
<viewFiltersDirectory enabled="false"/>
</viewsDirectory>
<bootstrapFile/>
</applicationDirectory>
<dataDirectory enabled="false">
<cacheDirectory enabled="false"/>
<searchIndexesDirectory enabled="false"/>
<localesDirectory enabled="false"/>
<logsDirectory enabled="false"/>
<sessionsDirectory enabled="false"/>
<uploadsDirectory enabled="false"/>
</dataDirectory>
<libraryDirectory>
<zfStandardLibraryDirectory/>
</libraryDirectory>
<publicDirectory>
<publicStylesheetsDirectory enabled="false"/>
<publicScriptsDirectory enabled="false"/>
<publicImagesDirectory enabled="false"/>
<publicIndexFile/>
<htaccessFile/>
</publicDirectory>
<providersDirectory enabled="false"/>
</projectDirectory>
</projectProfile>

]]></ac:plain-text-body></ac:macro>

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jun 05, 2008

    <p>I'm curious about the schema defintion for the .xml files. Wouldn't a single <directory name="...."> tag make a whole lot more sense? Similarly... <file> <link> etc.... ?</p>

    1. Jun 06, 2008

      <p>Well, I think this current structure calls out the fact that there is a one to one relationship with the name of the node and the contextual class that creates it. For example, for <applicationDirectory>, there is a class called Zend_Tool_Project_Structure_Context_Zf_ApplicationDirectory, which consequently extends Zend_Tool_Project_Structure_Context_Filesystem_Directory.</p>

      <p>Moving forward, this project structure will be able to handle more than just filesystem artifacts, for example, database artifacts or perhaps information that might be required to know how to manage a Zend Search Index.</p>

      <p>-ralph</p>

    2. Jul 01, 2008

      <p>I agree with Kevin on this. Something like this (maybe not this exactly) shows the relationships and is a whole lot easier to script against.</p>

      <ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
      <?xml version="1.0"?>
      <project name="MyProject.com">
      <directory name="myproject.com">
      <directory name="application" type="application">
      <directory name="apis" type="api"/>
      <directory name="configs" type="configuration"/>
      <directory name="controllers" type="controller">
      <controller name="index"/>
      <controller name="error"/>
      <controller name="foo"/>
      <controller name="bar"/>
      </directory>
      <directory name="layouts" type="layout"/>
      <directory name="models" type="model"/>
      <directory name="views" type="view">
      <directory name="scripts" type="script">
      <directory name="index" rel="index">
      <view name="index"/>
      </directory>
      <directory name="foo" rel="foo">
      <view name="index"/>
      </directory>
      </directory>
      <directory name="helpers" type="helper"/>
      </directory>
      <bootstrap name="bootstrap"/>
      </directory>
      <directory name="data" type="data">
      <directory name="cache" type="cache"/>
      <directory name="locales" type="locale"/>
      <directory name="logs" type="log"/>
      <directory name="sessions" type="session"/>
      </directory>
      <directory name="library" type="library">
      <library name="Zend"/>
      </directory>
      <directory name="public" type="public">
      <directory name="styles"/>
      <directory name="scripts"/>
      <directory name="images"/>
      <index/>
      <htaccess/>
      </directory>
      </directory>
      </project>
      ]]></ac:plain-text-body></ac:macro>

      <p>Also, the extension should be configurable. If I am on a shared host and need to use .php5, I should be able to do so.</p>

      1. Jul 11, 2008

        <p>Just to echo Matthew - the original schema seems too wordy. It would be a lot easier to manipulate using simpler naming with a reliance on attributes to drive properties like name, extension, type, etc. Even if you need to push out the mapping to classnames from your current setup, it would be worth the cost in exchange for a simpler schema...</p>