tags:

views:

722

answers:

4

I'd like to run a script that builds the documentation for my php project. It is basically just using wget to run phpdoc.

+6  A: 

Here's a fairly extensive tutorial on SVN hooks

Oli
+1  A: 

(Answering my own question, I just thought others would like to know as well). Yes, and also TortoiseSVN supports it. The word you are looking for is 'hooks'.

For TortoiseSVN, open settings and 'Hook Scripts'. Click 'Add...' and chooe post_commit_hook (for running after the commit is done). Then add whatever script you are running and the working path of the script.

I used a batch file and called wget (there is a windows version ported, google it). To get wget to store the log from phpdoc in one specific path, you must specify the full path, else the log will be stored in the current folder from where you committed, so my batch file looks like this:

SET BUILDLOG=%~dp0%build_log.html
rem %~dp0 returns the full working path *of this script*
SET PHPDOCURL=http://localhost/PHPDocumentor/docbuilder
SET PHPDOCCONFIG=yourconfigfile

wget -O %BUILDLOG% "%PHPDOCURL%/builder.php?setting_useconfig=%PHPDOCCONFIG%&setting_output=HTML%3ASmarty%3Adefault&ConverterSetting=HTML%3ASmarty%3Adefault&setting_title=Generated+Documentation&setting_defaultpackagename=default&setting_defaultcategoryname=default&interface=web&dataform=true"

Now, whenever you commit, the batch script will be called. You could of course also use php as a command line tool, but I haven't looked into that with phpdoc - I just took the path of least resistance on this one.

RobbieGee
+2  A: 

You might want to check out Phing for a complete build scripting tool. You can manage commits, documentation and other build related activities in one place.

Eran Galperin
+1  A: 

An alternative to using SVN hooks would be to use a continuous integration engine. Personally, I'm a fan of Hudson. CruiseControl is the classic but there are a plethora of others.

Why use a continuous integration engine? In general, they're more powerful, feature rich and portable than simply using SVN hooks (what if you want to switch to using Mercurial, Git, etc. ?).

Aaron Maenpaa