Warning! This page has the following tags:
- This page needs to be merged with docbook documentation.
build.properties
As you maybe know from other phing projects, you can use a so called "property file" to specify some of the properties of the phing script. Now you can do this also with agavi. To use these features, simply create a file called "build.properties" in your project directory besides your webapp/, www/ and tests/ directory. The things stored there are simple key/value pairs like this:
# this is a comment inside the build.properties key=value
For further reading, see Property File Format
per-project code templates
To use the so-called per-project code templates is an really easy feature. If you don't know what'ts about it, let me show you a little example. Lets say you want to add some commands to every View class in your project but don't want to copy them by yourself into every new View. With this way, we create a new directory for our templates. For example in our project dir and we call the templates-dir something like "mycodetemplates" Now we copy the specific templates from <insert_your_agavi_installation_path_here/buildtools/code_templates to <insert_your_project_path_here>/mycodetemplates. ;) In the case of our example, we only copy the View.class.php.tmpl. Now edit the template in your mycodetemplates-dir for your needs. But at the moment there is a little problem. The agavi-script does not know about our own code-templates. And here we can use the build.properties file. Just create it in your project dir and fill it with something like this:
templates.dir = /my/project/path/mycodetemplates
Lets run the "agavi" script and create a new Action with its specific views. And?? Great...agavi used our own code templates to create the new things :)
per-module code templates
Often you have to use your templates not project-wide but only per module. It's a bit different than the method before but also damn easy.
Just create a directory called "modules" in your code templates dir (eg. mycodetemplates). In this modules-directory, you can create more directorys with the names of your modules.
myproject
- mycodetemplates
-View.class.php.tmpl
-modules
-Frontend
-Action.class.php.tmpl
-Backend
-Default
- tests
- webapp
- www
Now you can copy every template you want into the <modulename>-directory in the modules-folder. Lets say you have a Action.class.php.tmpl in the <projectdir>/mycodetemplates/modules/Default folder. Every action build by the agavi-script will use this Action-template to create a new action...wonderfull ;) Now you would say: Hey, I only have a template of the View-class in my module-specific folder. What about the others? Will they be empty? No, calm down. The agavi-scripts uses the per-module templates first, if there isn't a template for a specific task, it will look into you own codetemplates-folder set by the build.properties. If there is also no template to use, it'll do the task with the default-templates from your agavi-installation.

