<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>João Prado Maia's Weblog &#187; debian</title>
	<atom:link href="http://pessoal.org/blog/category/debian/feed/" rel="self" type="application/rss+xml" />
	<link>http://pessoal.org/blog</link>
	<description></description>
	<lastBuildDate>Tue, 11 Aug 2009 00:42:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting up phpUnderControl (and CruiseControl) under debian etch</title>
		<link>http://pessoal.org/blog/2009/08/10/setting-up-phpundercontrol-and-cruisecontrol-under-debian-etch/</link>
		<comments>http://pessoal.org/blog/2009/08/10/setting-up-phpundercontrol-and-cruisecontrol-under-debian-etch/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 00:42:33 +0000</pubDate>
		<dc:creator>jpm</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[cruisecontrol]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[phpundercontrol]]></category>

		<guid isPermaLink="false">http://pessoal.org/blog/?p=212</guid>
		<description><![CDATA[This might not be as useful since we finally have debian lenny available, but then again, maybe it will be useful for some people out there.
I had to setup phpUnderControl (and CruiseControl) at my job to manage our day to day work, and it took quite a bit of time to figure out how to [...]]]></description>
			<content:encoded><![CDATA[<p>This might not be as useful since we finally have debian lenny available, but then again, maybe it will be useful for some people out there.</p>
<p>I had to setup phpUnderControl (and CruiseControl) at my job to manage our day to day work, and it took quite a bit of time to figure out how to setup everything properly from the ground up. This post is derived from my notes that we keep in our internal wiki.</p>
<ol>
<li>Edit /etc/apt/sources.list and make sure the unstable repo is listed in there
<pre>
deb http://ftp.debian.org/debian/ unstable non-free
deb-src http://ftp.debian.org/debian/ unstable non-free
</pre>
</li>
<li>apt-get update</li>
<li>apt-get -t unstable install sun-java6-jre sun-java6-jdk</li>
<li>Run &#8220;java -version&#8221; to verify the installation
<pre>
root@etch-64-dev-ui:~# java -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)
</pre>
</li>
<li>Add JAVA_HOME to /etc/environment:
<pre>
JAVA_HOME="/usr/lib/jvm/java-6-sun"
</pre>
</li>
<li>source /etc/environment</li>
<li>Download binary distribution of CruiseControl (available here:  http://cruisecontrol.sourceforge.net/download.html)</li>
<li>Install CruiseControl:
<pre>
$ unzip cruisecontrol-bin-2.7.3.zip -d /opt
$ ln -s /opt/cruisecontrol-bin-2.7.3 /opt/cruisecontrol
</pre>
</li>
<li>Install PEAR (if it&#8217;s not already there):
<pre>
$ apt-get install php-pear
</pre>
</li>
<li>Upgrade PEAR to latest release:
<pre>
$ pear upgrade-all
</pre>
</li>
<li>Install PHPUnit and phpUnderControl:
<pre>
$ pear channel-discover pear.phpunit.de
$ pear install phpunit/PHPUnit
$ pear install --force --alldeps phpunit/phpUnderControl
$ phpuc install /opt/cruisecontrol
</pre>
</li>
<li>Install Xdebug (needed for code coverage analysis):
<pre>
$ pear install pecl/xdebug
</pre>
</li>
<li>Add Xdebug zend extension to php.ini (on our case /etc/php5/cli/php.ini):
<pre>
zend_extension="/full/path/to/xdebug.so"
</pre>
</li>
<li>Create a CruiseControl project for your existing PHP project&#8217;s unit tests:
<pre>
$ phpuc project --version-control svn --username "cruisecontrol" --password "password_here" --version-control-url svn://svn.domain.com/repository/project-name/trunk --test-case MyProjectTestSuite --test-dir "/opt/cruisecontrol/projects/my-project/source/unit_tests" --test-file "MyProjectTestSuite.php" --project-name MyProject /opt/cruisecontrol
</pre>
</li>
<li>Edit projects/MyProject/build.xml so it contains the following content:
<pre>
&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;project name="MyProject" default="build" basedir=".">
  &lt;target name="build" depends="php-documentor,php-codesniffer,phpunit"/>
  &lt;target name="php-documentor">
    &lt;exec executable="phpdoc" dir="${basedir}/source" logerror="on">
      &lt;arg line="--title '${ant.project.name}' -i *pear/*,*Smarty/*,*fpdf/*,*jpgraph/* -ue on -t ${basedir}/build/api -d ${basedir}/source/lib -tb '/usr/share/php/data/phpUnderControl/data/phpdoc' -o HTML:Phpuc:phpuc"/>
    &lt;/exec>
  &lt;/target>
  &lt;target name="php-codesniffer">
    &lt;exec executable="phpcs" dir="${basedir}/source" output="${basedir}/build/logs/checkstyle.xml" error="/tmp/checkstyle.error.log">
      &lt;arg line="--ignore=*/PEAR/*,*/Smarty/*,*/fpdf/*,*/jpgraph/*,*/misc/* --report=checkstyle --standard=PEAR ${basedir}/source"/>
    &lt;/exec>
  &lt;/target>
  &lt;target name="phpunit">
    &lt;exec executable="phpunit" dir="${basedir}/source/unit_tests" failonerror="on">
      &lt;arg line=" --log-xml ${basedir}/build/logs/phpunit.xml --log-pmd ${basedir}/build/logs/phpunit.pmd.xml --coverage-xml ${basedir}/build/logs/phpunit.coverage.xml --coverage-html ${basedir}/build/coverage MyProjectTestSuite /opt/cruisecontrol/projects/MyProject/source/unit_tests/MyProjectTestSuite.php"/>
    &lt;/exec>
  &lt;/target>
&lt;/project>
</pre>
</li>
</ol>
<p>You will need to tweak a few things, like the &#8220;MyProject&#8221; name and probably some of the &#8220;ignore rules&#8221; for phpCodeSniffer, but it should be a great starting point for most projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://pessoal.org/blog/2009/08/10/setting-up-phpundercontrol-and-cruisecontrol-under-debian-etch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
