{"id":212,"date":"2009-08-10T18:42:33","date_gmt":"2009-08-11T00:42:33","guid":{"rendered":"http:\/\/pessoal.org\/blog\/?p=212"},"modified":"2009-08-10T18:42:33","modified_gmt":"2009-08-11T00:42:33","slug":"setting-up-phpundercontrol-and-cruisecontrol-under-debian-etch","status":"publish","type":"post","link":"https:\/\/pessoal.org\/blog\/2009\/08\/10\/setting-up-phpundercontrol-and-cruisecontrol-under-debian-etch\/","title":{"rendered":"Setting up phpUnderControl (and CruiseControl) under debian etch"},"content":{"rendered":"<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>\n<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>\n<ol>\n<li>Edit \/etc\/apt\/sources.list and make sure the unstable repo is listed in there\n<pre>\r\ndeb http:\/\/ftp.debian.org\/debian\/ unstable non-free\r\ndeb-src http:\/\/ftp.debian.org\/debian\/ unstable non-free\r\n<\/pre>\n<\/li>\n<li>apt-get update<\/li>\n<li>apt-get -t unstable install sun-java6-jre sun-java6-jdk<\/li>\n<li>Run &#8220;java -version&#8221; to verify the installation\n<pre>\r\nroot@etch-64-dev-ui:~# java -version\r\njava version \"1.6.0_10\"\r\nJava(TM) SE Runtime Environment (build 1.6.0_10-b33)\r\nJava HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)\r\n<\/pre>\n<\/li>\n<li>Add JAVA_HOME to \/etc\/environment:\n<pre>\r\nJAVA_HOME=\"\/usr\/lib\/jvm\/java-6-sun\"\r\n<\/pre>\n<\/li>\n<li>source \/etc\/environment<\/li>\n<li>Download binary distribution of CruiseControl (available here:  http:\/\/cruisecontrol.sourceforge.net\/download.html)<\/li>\n<li>Install CruiseControl:\n<pre>\r\n$ unzip cruisecontrol-bin-2.7.3.zip -d \/opt\r\n$ ln -s \/opt\/cruisecontrol-bin-2.7.3 \/opt\/cruisecontrol\r\n<\/pre>\n<\/li>\n<li>Install PEAR (if it&#8217;s not already there):\n<pre>\r\n$ apt-get install php-pear\r\n<\/pre>\n<\/li>\n<li>Upgrade PEAR to latest release:\n<pre>\r\n$ pear upgrade-all\r\n<\/pre>\n<\/li>\n<li>Install PHPUnit and phpUnderControl:\n<pre>\r\n$ pear channel-discover pear.phpunit.de\r\n$ pear install phpunit\/PHPUnit\r\n$ pear install --force --alldeps phpunit\/phpUnderControl\r\n$ phpuc install \/opt\/cruisecontrol\r\n<\/pre>\n<\/li>\n<li>Install Xdebug (needed for code coverage analysis):\n<pre>\r\n$ pear install pecl\/xdebug\r\n<\/pre>\n<\/li>\n<li>Add Xdebug zend extension to php.ini (on our case \/etc\/php5\/cli\/php.ini):\n<pre>\r\nzend_extension=\"\/full\/path\/to\/xdebug.so\"\r\n<\/pre>\n<\/li>\n<li>Create a CruiseControl project for your existing PHP project&#8217;s unit tests:\n<pre>\r\n$ 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\r\n<\/pre>\n<\/li>\n<li>Edit projects\/MyProject\/build.xml so it contains the following content:\n<pre>\r\n&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n&lt;project name=\"MyProject\" default=\"build\" basedir=\".\">\r\n  &lt;target name=\"build\" depends=\"php-documentor,php-codesniffer,phpunit\"\/>\r\n  &lt;target name=\"php-documentor\">\r\n    &lt;exec executable=\"phpdoc\" dir=\"${basedir}\/source\" logerror=\"on\">\r\n      &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\"\/>\r\n    &lt;\/exec>\r\n  &lt;\/target>\r\n  &lt;target name=\"php-codesniffer\">\r\n    &lt;exec executable=\"phpcs\" dir=\"${basedir}\/source\" output=\"${basedir}\/build\/logs\/checkstyle.xml\" error=\"\/tmp\/checkstyle.error.log\">\r\n      &lt;arg line=\"--ignore=*\/PEAR\/*,*\/Smarty\/*,*\/fpdf\/*,*\/jpgraph\/*,*\/misc\/* --report=checkstyle --standard=PEAR ${basedir}\/source\"\/>\r\n    &lt;\/exec>\r\n  &lt;\/target>\r\n  &lt;target name=\"phpunit\">\r\n    &lt;exec executable=\"phpunit\" dir=\"${basedir}\/source\/unit_tests\" failonerror=\"on\">\r\n      &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\"\/>\r\n    &lt;\/exec>\r\n  &lt;\/target>\r\n&lt;\/project>\r\n<\/pre>\n<\/li>\n<\/ol>\n<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>\n","protected":false},"excerpt":{"rendered":"<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. 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[43,45,3,44],"tags":[],"_links":{"self":[{"href":"https:\/\/pessoal.org\/blog\/wp-json\/wp\/v2\/posts\/212"}],"collection":[{"href":"https:\/\/pessoal.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pessoal.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pessoal.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pessoal.org\/blog\/wp-json\/wp\/v2\/comments?post=212"}],"version-history":[{"count":32,"href":"https:\/\/pessoal.org\/blog\/wp-json\/wp\/v2\/posts\/212\/revisions"}],"predecessor-version":[{"id":244,"href":"https:\/\/pessoal.org\/blog\/wp-json\/wp\/v2\/posts\/212\/revisions\/244"}],"wp:attachment":[{"href":"https:\/\/pessoal.org\/blog\/wp-json\/wp\/v2\/media?parent=212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pessoal.org\/blog\/wp-json\/wp\/v2\/categories?post=212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pessoal.org\/blog\/wp-json\/wp\/v2\/tags?post=212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}