Skip to content

Commit

Permalink
Upgraded skeleton files
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartherbert committed Oct 10, 2011
1 parent c00e00f commit 59b0bae
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 42 deletions.
3 changes: 2 additions & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ project.name=phix
project.majorVersion=0
project.minorVersion=13
project.patchLevel=2
project.snapshot=false

checkstyle.standard=Zend

component.type=php-library
component.version=7
component.version=10

project.channel=pear.phix-project.org
pear.local=/var/www/${project.channel}
191 changes: 157 additions & 34 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,23 @@
<project default="help" basedir=".">
<!-- Human-readable info about our component -->
<property file="build.properties" />

<property name="project.version" value="${project.majorVersion}.${project.minorVersion}.${project.patchLevel}" />
<php function="date" returnProperty="date.now">
<param value="YmdHi"/>
</php>
<if>
<and>
<isset property="project.snapshot"/>
<istrue value="${project.snapshot}"/>
</and>
<then>
<property name="project.version" value="${project.majorVersion}.${project.minorVersion}.${project.patchLevel}snapshot${date.now}" />
<property name="project.stability" value="snapshot" />
</then>
<else>
<property name="project.version" value="${project.majorVersion}.${project.minorVersion}.${project.patchLevel}" />
<property name="project.stability" value="stable" />
</else>
</if>
<property name="project.apiversion" value="${project.majorVersion}.${project.minorVersion}" />

<!-- Paths to the directories that we work with -->
Expand Down Expand Up @@ -95,40 +110,63 @@
<target name="help">
<echo message="${project.name} ${project.version}: build.xml targets:" />
<echo message="" />
<echo message="lint" />
<echo message=" Check the PHP files for syntax errors" />
<echo message="test" />
<echo message=" Run the component's PHPUnit tests" />
<echo message="code-review" />
<echo message=" Run all of the code quality targets:" />
<echo message="Setup your dev environment:" />
<echo message="" />
<echo message=" build-vendor" />
<echo message=" Populate vendor/ with this package's dependencies" />
<echo message=" vendor-pear" />
<echo message=" Run additional PEAR commands inside the vendor folder" />
<echo message="" />
<echo message="Develop your code:" />
<echo message="" />
<echo message=" lint" />
<echo message=" Check the PHP files for syntax errors" />
<echo message=" test" />
<echo message=" Run the component's PHPUnit tests" />
<echo message=" code-review" />
<echo message=" Run all of the code quality targets:" />
<echo message="" />
<echo message=" code-browser" />
<echo message=" Run code quality tests for PHP_CodeBrowser" />
<echo message=" phpcpd" />
<echo message=" Check for cut and paste problems" />
<echo message=" phpdoc" />
<echo message=" Create the PHP docs from source code" />
<echo message="" />
<echo message=" code-browser" />
<echo message=" Run code quality tests for PHP_CodeBrowser" />
<echo message=" phpcpd" />
<echo message=" Check for cut and paste problems" />
<echo message=" phpdoc" />
<echo message=" Create the PHP docs from source code" />
<echo message="Publish your component:" />
<echo message="" />
<echo message="build-vendor" />
<echo message=" Populate vendor/ with this package's dependencies" />
<echo message="pear-package" />
<echo message=" Create a PEAR-compatible package" />
<echo message="install-vendor" />
<echo message=" Install this component from source into vendor/" />
<echo message="vendor-pear" />
<echo message=" Run additional PEAR commands inside the vendor folder" />
<echo message="install-system" />
<echo message=" Install this component from source for all local users" />
<echo message=" You must be root to run this target on Linux!!" />
<echo message="publish-local" />
<echo message=" Publish your PEAR-compatible package into a local copy" />
<echo message=" of your PEAR channel" />
<echo message="clean" />
<echo message=" Remove all temporary folders created by this build file" />
<echo message=" pear-package" />
<echo message=" Create a PEAR-compatible package" />
<echo message=" publish-local" />
<echo message=" Publish your PEAR-compatible package into a local copy" />
<echo message=" of your PEAR channel" />
<echo message=" install-vendor" />
<echo message=" Install this component from source into vendor/" />
<echo message=" install-system" />
<echo message=" Install this component from source for all local users" />
<echo message=" You must be root to run this target on Linux!!" />
<echo message=""/>
<echo message="Maintain your component:"/>
<echo message=""/>
<echo message=" upgrade-skeleton"/>
<echo message=" Upgrade the skeleton files for this component"/>
<echo message=""/>
<echo message="Additional targets:" />
<echo message=""/>
<echo message=" clean" />
<echo message=" Remove all temporary folders created by this build file" />
<echo message=" version" />
<echo message=" Show this component's version from build.properties" />
<echo message="" />
<phingcall target="local-help" />
</target>

<!-- Show the current version, as set in build.properties -->
<!-- This is just to be a time-saver -->
<target name="version">
<echo message="${project.version}" />
</target>

<!-- Run PHP lint on all of the source code -->
<target name="lint">
<phplint>
Expand All @@ -140,12 +178,27 @@

<!-- Run the unit tests for this module -->
<target name="run-unittests" depends="lint">
<!-- Make sure vendor/ folder exists -->
<if>
<not>
<available file="${project.vendordir}" type="dir"/>
</not>
<then>
<phingcall target="build-vendor"/>
</then>
</if>

<!-- do we have any tests? -->
<!-- currently cannot think of a reliable way to test this in phing -->

<!-- run the tests -->
<delete dir="${project.review.codecoveragedir}" />
<mkdir dir="${project.review.codecoveragedir}" />
<mkdir dir="${project.review.logsdir}" />
<exec command="phpunit --bootstrap=${project.src.testunitdir}/bootstrap.php --coverage-html ${project.review.codecoveragedir} --coverage-clover ${project.review.logsdir}/phpunit.xml ${project.src.testunitdir}" checkreturn="true" logoutput="true"/>
<exec command="phpunit --configuration=phpunit.xml ${project.src.testunitdir}" checkreturn="true" logoutput="true"/>
<echo/>
<echo>The code coverage report is in ${project.review.codecoveragedir}</echo>
<echo/>
</target>

<!-- Run all the tests for this module -->
Expand Down Expand Up @@ -198,6 +251,11 @@
<echo>Populating vendor/ with dependencies</echo>
<exec command="phix pear:register-channels" checkreturn="true" logoutput="true" />
<exec command="pear -c ${project.tmpdir}/pear-config install --alldeps ${project.tarfile}" logoutput="true" checkreturn="true"/>
<echo/>
<echo>Your vendor/ folder has been built.</echo>
<echo>You only need to run 'phing build-vendor' again if you change the</echo>
<echo>dependencies listed in your package.xml file.</echo>
<echo/>
</target>

<!-- Setup the vendor folder -->
Expand Down Expand Up @@ -253,22 +311,87 @@

<!-- Install the code -->
<target name="install-vendor">
<exec command="pear -c ${project.tmpdir}/pear-config install --alldeps -f ${project.tarfile}" logoutput="true" checkreturn="true"/>
<if>
<available file="${project.tarfile}"/>
<then>
<exec command="pear -c ${project.tmpdir}/pear-config install --alldeps -f ${project.tarfile}" logoutput="true" checkreturn="true"/>
</then>
<elseif>
<istrue value="${project.stability}"/>
<then>
<echo>Cannot find PEAR package file ${project.tarfile}</echo>
<echo>If your snapshot is more than 1 minute old, that is the cause</echo>
<echo>of this error, sorry :(</echo>
</then>
</elseif>
<else>
<echo>Cannot find PEAR package file ${project.tarfile}</echo>
</else>
</if>
</target>
<target name="install-system">
<exec command="pear install -f -a ${project.tarfile}" checkreturn="true" logoutput="true" />
<if>
<available file="${project.tarfile}"/>
<then>
<exec command="pear install -f -a ${project.tarfile}" checkreturn="true" logoutput="true" />
</then>
<elseif>
<istrue value="${project.stability}"/>
<then>
<echo>Cannot find PEAR package file ${project.tarfile}</echo>
<echo>If your snapshot is more than 1 minute old, that is the cause</echo>
<echo>of this error, sorry :(</echo>
</then>
</elseif>
<else>
<echo>Cannot find PEAR package file ${project.tarfile}</echo>
</else>
</if>
</target>

<!-- Publish to local copy of PEAR channel -->
<target name="publish-local" depends="pear-package">
<exec command="pirum add ${pear.local} ${project.tarfile}" checkreturn="true" logoutput="true" />
<if>
<available file="${project.tarfile}"/>
<then>
<!-- get rid of any existing snapshots we may have published -->
<foreach param="packagefile" absparam="abspackagefile" target="pirum-remove-package">
<fileset dir="${pear.local}/get">
<include name="${project.name}*snapshot*.tgz" />
</fileset>
</foreach>

<!-- publish the new PEAR package -->
<exec command="pirum add ${pear.local} ${project.tarfile}" checkreturn="true" logoutput="true" />
</then>
<elseif>
<istrue value="${project.stability}"/>
<then>
<echo>Cannot find PEAR package file ${project.tarfile}</echo>
<echo>If your snapshot is more than 1 minute old, that is the cause</echo>
<echo>of this error, sorry :(</echo>
</then>
</elseif>
<else>
<echo>Cannot find PEAR package file ${project.tarfile}</echo>
</else>
</if>
</target>

<target name="pirum-remove-package">
<exec command="pirum remove ${pear.local} ${packagefile}" logoutput="true" checkreturn="true" />
</target>

<!-- Run additional PEAR commands in the vendor folder -->
<target name="vendor-pear">
<exec command="pear -c ${project.tmpdir}/pear-config ${pear.cmd}" logoutput="true" checkreturn="true" />
</target>

<!-- Upgrade the skeleton files here and now -->
<target name="upgrade-skeleton">
<exec command="phix ${component.type}:upgrade ." logoutput="true" checkreturn="true" />
</target>

<!-- Clean up the mess -->
<target name="clean">
<delete dir="${project.builddir}" />
Expand Down
11 changes: 4 additions & 7 deletions package.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.9.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
http://pear.php.net/dtd/tasks-1.0.xsd
http://pear.php.net/dtd/package-2.0
http://pear.php.net/dtd/package-2.0.xsd">
<package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.9.1" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>phix</name>
<channel>pear.phix-project.org</channel>
<summary>Framework-agnostic command-line util for PHP development</summary>
Expand All @@ -18,11 +15,11 @@
<date>${build.date}</date>
<time>${build.time}</time>
<version>
<release>${project.majorVersion}.${project.minorVersion}.${project.patchLevel}</release>
<release>${project.version}</release>
<api>${project.majorVersion}.${project.minorVersion}</api>
</version>
<stability>
<release>stable</release>
<release>${project.stability}</release>
<api>stable</api>
</stability>
<license>All rights reserved.</license>
Expand Down Expand Up @@ -71,7 +68,7 @@ ${contents}
</extension>
</required>
</dependencies>
<phprelease />
<phprelease/>
<changelog>
<release>
<version>
Expand Down
28 changes: 28 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<phpunit bootstrap="src/tests/unit-tests/bootstrap.php">
<testsuites>
<testsuite name="Unit Tests">
<directory suffix="Test.php">src/tests/unit-tests</directory>
</testsuite>
</testsuites>
<filter>
<blacklist>
<directory suffix=".php">vendor</directory>
<directory suffix=".php">src/tests</directory>
</blacklist>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/bin</directory>
<directory suffix=".php">src/php</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="review/code-coverage"/>
<log type="coverage-clover" target="review/logs/phpunit.xml"/>
<log type="json" target="review/logs/phpunit.json"/>
<log type="tap" target="review/logs/phpunit.tap"/>
<log type="junit" target="review/logs/phpunit-junit.xml"/>
<log type="testdox-html" target="review/testdox.html"/>
<log type="testdox-text" target="review/testdox.txt"/>
</logging>
</phpunit>
<!-- vim: set tabstop=4 shiftwidth=4 expandtab: -->

0 comments on commit 59b0bae

Please sign in to comment.