PHP Objects, Patterns and Practice (3rd edition)

(Barry) #1
CHAPTER 20 ■ CONTINUOUS INTEGRATION

$ phpuc --usage


Usage: phpuc.php
For single command help type:
phpuc.php --help
Available commands:



  • clean Removes old build artifacts and logs for a specified project.

  • delete Deletes a CruiseControl project with all logs and artifacts.

  • example Creates a small CruiseControl example.

  • graph Generates the metric graphs with ezcGraph

  • install Installs the CruiseControl patches.

  • merge-phpunit Merges a set of PHPUnit logs into a single new file.

  • project Creates a new CruiseControl project.


So, I’ve already installed the package onto my system. Now I need to amend the CruiseControl
environment to support phpUnderControl. As you can see, phpuc provides a second installation step: a
command named install.


■Note This two-part installation mechanism is a useful one. PEAR is good at getting library code, runnable


scripts, and supporting data files in place. When it comes to complex installation for things like Web applications


and database driven systems, it’s often a good idea to provide a configurable installation command as part of your


application. Of course, Phing would be a good choice for this secondary installation. Most users won’t have Phing


to hand though, so it can be better to build the installation logic into an application command.


$ phpuc install /usr/local/cruisecontrol/


Now to restart CruiseControl

$ cd /usr/local/cruisecontrol/
$ kill cat cc.pid
$ ./cruisecontrol.sh


CruiseControl stores its process id in a file called cc.pid. I use that to kill the current process, then I
run the cruisecontrol.sh script to restart. Now, I can visit http://localhost:8080/cruisecontrol/ to
confirm that CruiseControl had been rebranded. You can see the new interface in Figure 20–5.

Free download pdf