In our new stagging, development environment documentation is essential.
So we want to have all our classes API generated automatically.
This can be done, fairly easy.
For generation of our php API, I choose for phpDocumentor.
Why? Because it’s easy, has a nice web GUI and command line utility and it does it work assupposed.
First lets install phpDocumentor (on a centos system)
sudo pear install phpdocumentor
Next we are going to setup the phpDocumentor.
Our project is located in the following directory.
project: /svn/builds/nameProject/www/
We create a project config file.
config file: /svn/scripts/phpdoc-config.ini
vi /svn/scripts/phpdoc-config.ini
[Parse Data]
title = Documentation nameProject
hidden = false
parseprivate = off
javadocdesc = off
defaultcategoryname = Documentation
defaultpackagename = nameProject
target = /svn/builds/nameProject/doc/
readmeinstallchangelog = README, INSTALL, FAQ, LICENSE, Release-1.3.1
directory = /svn/builds/nameProject/www/
ignore = pear-*,templates/,Documentation/,test*.php
sourcecode = on
output=HTML:Smarty:PHP
Test your configuration
Create the repertory targets
mkdir -p /svn/builds/nameProject/doc/
then launch
phpdoc -c /svn/scripts/phpdoc-config.ini
Check the /svn/builds/nameProject/doc/ directory, if everything is generated.
Next we are going to let our phpDocumentor do it’s work every night.
So I have written a little plain export script and an extend our nightly build subversion script (see http://thim.trinix.be/2007/06/06/nightly-build-script/)
Plain export
vi /svn/scripts/phpdoc-generate.sh
phpdoc -c /svn/scripts/phpdoc-config.ini
Extend Nightly build script
vi /svn/scripts/svn-phpdoc-generate.sh
phpdoc -c /svn/scripts/phpdoc-config.ini
and edit svn-nightly-build.sh
vi /svn/scripts/svn-nightly-build.sh
and add the following just before the # Create archive section
# Remove old documentation
rm -Rf /svn/builds/nameProject/doc/
# Generate documentation
/svn/scripts/svn-phpdoc-generate.sh
The final step is to setup a cron (crontab -e) or add your script to right /etc/cron.* directory (example /etc/cron.daily)
Recent Comments