Permalink
Browse files

Upgraded skeleton files

  • Loading branch information...
1 parent de47228 commit 3fdfe33f27ad4e08aa355594fe0244267ef5f260 @stuartherbert committed Oct 22, 2011
Showing with 155 additions and 16 deletions.
  1. +2 −2 build.local.xml
  2. +2 −1 build.properties
  3. +151 −13 build.xml
View
@@ -1,5 +1,5 @@
-<project default="local-help">
- <target name="local-help">
+<project name="local" default="help">
+ <target name="help">
<echo message="This component has the following additional commands:" />
<echo message=""/>
<echo message="git-tag" />
View
@@ -2,11 +2,12 @@ project.name=ExtenderLib
project.majorVersion=2
project.minorVersion=0
project.patchLevel=0
+project.snapshot=false
checkstyle.standard=Zend
component.type=php-library
-component.version=8
+component.version=10
project.channel=pear.phix-project.org
pear.local=/var/www/${project.channel}
View
164 build.xml
@@ -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}" />
+ <taskdef name="now" classname="Phix_Project.ComponentManager.Phing.NowTask" />
+ <now name="date.now"/>
+ <echo message="Now is ${date.now}"/>
+ <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 -->
@@ -38,11 +53,20 @@
<property name="project.vendor.wwwdir" value="${project.vendordir}/www" override="true" />
<property name="project.distdir" value="${project.basedir}/dist" />
+ <property name="project.distdir.lastBuilt" value="${project.basedir}/dist/lastBuilt" />
<property name="project.tarfilename" value="${project.name}-${project.version}.tgz" />
<property name="project.tarfile" value="${project.distdir}/${project.tarfilename}" />
- <!-- a user to use to publish on the pear server -->
- <property name="remote.user" value="" override="true" />
+ <!-- what was the last PEAR package we created, if any? -->
+ <if>
+ <available file="${project.distdir.lastBuilt}"/>
+ <then>
+ <property file="${project.distdir.lastBuilt}"/>
+ </then>
+ <else>
+ <property name="project.lastBuiltTarfile" value="false"/>
+ </else>
+ </if>
<!-- override this if you want to run additional PEAR commands -->
<property name="pear.cmd" value="" override="true" />
@@ -89,6 +113,7 @@
<include name="*.md" />
</fileset>
+ <taskdef name="phingcallifexists" classname="Phix_Project.ComponentManager.Phing.PhingCallIfExistsTask" />
<import file="build.local.xml"/>
<!-- Tell the user what this build file supports -->
@@ -131,14 +156,19 @@
<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" />
+ <phingcallifexists target="local.help" />
</target>
<!-- Show the current version, as set in build.properties -->
@@ -154,26 +184,48 @@
<include name="**/*.php" />
</fileset>
</phplint>
+ <phingcallifexists target="local.lint" />
</target>
<!-- 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 file://${project.review.codecoveragedir}</echo>
<echo/>
- <echo>The code coverage report is in ${project.review.codecoveragedir}</echo>
</target>
<!-- Run all the tests for this module -->
- <target name="test" depends="run-unittests" />
+ <target name="test" depends="run-unittests">
+ <phingcallifexists target="local.test"/>
+ </target>
<!-- Run the code review quality tests -->
- <target name="code-review" depends="run-unittests, code-browser, phpcpd, pdepend" />
+ <target name="code-review" depends="run-unittests, code-browser, phpcpd, pdepend">
+ <phingcallifexists target="local.code-review"/>
+ </target>
<!-- Run all of the targets for setting up the code browser -->
- <target name="code-browser" depends="phpmd, phpcs, phpcb" />
+ <target name="code-browser" depends="phpmd, phpcs, phpcb">
+ <phingcallifexists target="local.code-browser"/>
+ </target>
<target name="pdepend">
<mkdir dir="${project.review.logsdir}" />
@@ -185,6 +237,7 @@
<mkdir dir="${project.review.logsdir}" />
<exec command="phpdoc -d ${project.src.phpdir} -t ${project.review.docsdir}" logoutput="true"/>
<echo message="You will find the PHPDoc for your project at: ${project.review.docsdir}/index.html"/>
+ <phingcallifexists target="local.phpdoc"/>
</target>
<!-- Check code for code smells -->
@@ -216,6 +269,12 @@
<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/>
+ <phingcallifexists target="local.buildvendor"/>
</target>
<!-- Setup the vendor folder -->
@@ -266,27 +325,105 @@
<include name="**/**" />
</fileset>
</tar>
+
+ <!-- write a message to say which file we built last -->
+ <echo file="${project.distdir.lastBuilt}" append="false">project.lastBuiltTarfile=${project.tarfile}</echo>
<echo>Your PEAR package is in ${project.tarfile}</echo>
+ <phingcallifexists target="local.pear-package"/>
</target>
<!-- 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>
+ <not>
+ <contains string="${project.lastBuiltTarfile}" substring="${project.name}"/>
+ </not>
+ <then>
+ <echo>Please run 'phing pear-package' first, then try again.</echo>
+ </then>
+ <elseif>
+ <available file="${project.lastBuiltTarfile}"/>
+ <then>
+ <exec command="pear -c ${project.tmpdir}/pear-config install --alldeps -f ${project.lastBuiltTarfile}" logoutput="true" checkreturn="true"/>
+ <phingcallifexists target="local.install-vendor"/>
+ </then>
+ </elseif>
+ <else>
+ <echo>Cannot find PEAR package file ${project.lastBuiltTarfile}</echo>
+ <echo>Run 'phing pear-package' to create a new PEAR package, then try again</echo>
+ </else>
+ </if>
</target>
+
+ <!-- install a package system-wide -->
<target name="install-system">
- <exec command="pear install -f -a ${project.tarfile}" checkreturn="true" logoutput="true" />
+ <if>
+ <not>
+ <contains string="${project.lastBuiltTarfile}" substring="${project.name}"/>
+ </not>
+ <then>
+ <echo>Please run 'phing pear-package' first, then try again.</echo>
+ </then>
+ <elseif>
+ <available file="${project.lastBuiltTarfile}"/>
+ <then>
+ <exec command="pear install -f -a ${project.lastBuiltTarfile}" checkreturn="true" logoutput="true" />
+ <phingcallifexists target="local.install-system"/>
+ </then>
+ </elseif>
+ <else>
+ <echo>Cannot find PEAR package file ${project.lastBuiltTarfile}</echo>
+ <echo>Run 'phing pear-package' to create a new PEAR package, then try again</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>
+ <not>
+ <contains string="${project.lastBuiltTarfile}" substring="${project.name}"/>
+ </not>
+ <then>
+ <echo>Please run 'phing pear-package' first, then try again.</echo>
+ </then>
+ <elseif>
+ <available file="${project.lastBuiltTarfile}"/>
+ <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.lastBuiltTarfile}" checkreturn="true" logoutput="true" />
+ <phingcallifexists target="local.publish-local"/>
+ </then>
+ </elseif>
+ <else>
+ <echo>Cannot find PEAR package file ${project.lastBuiltTarfile}</echo>
+ <echo>Run 'phing pear-package' to create a new PEAR package, then try again</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" />
+ <phingcallifexists target="local.upgrade-skeleton"/>
+ </target>
+
<!-- Clean up the mess -->
<target name="clean">
<delete dir="${project.builddir}" />
@@ -295,6 +432,7 @@
<delete dir="${project.pkgdir}" />
<delete dir="${project.distdir}" />
<delete dir="${project.tmpdir}" />
+ <phingcallifexists target="local.clean"/>
</target>
</project>
<!-- vim: set tabstop=2 shiftwidth=2 expandtab: -->

0 comments on commit 3fdfe33

Please sign in to comment.