Permalink
Browse files

Upgraded skeleton files

  • Loading branch information...
1 parent 81bc929 commit c03073143de9f79854693df3dd72eb25672dc142 @stuartherbert committed Oct 22, 2011
Showing with 74 additions and 41 deletions.
  1. +2 −2 build.local.xml
  2. +72 −39 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
@@ -3,9 +3,9 @@
<project default="help" basedir=".">
<!-- Human-readable info about our component -->
<property file="build.properties" />
- <php function="date" returnProperty="date.now">
- <param value="YmdHi"/>
- </php>
+ <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"/>
@@ -53,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" />
@@ -104,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 -->
@@ -158,7 +168,7 @@
<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 -->
@@ -174,6 +184,7 @@
<include name="**/*.php" />
</fileset>
</phplint>
+ <phingcallifexists target="local.lint" />
</target>
<!-- Run the unit tests for this module -->
@@ -197,18 +208,24 @@
<mkdir dir="${project.review.logsdir}" />
<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>The code coverage report is in file://${project.review.codecoveragedir}</echo>
<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}" />
@@ -220,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 -->
@@ -256,6 +274,7 @@
<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 -->
@@ -306,74 +325,86 @@
<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">
<if>
- <available file="${project.tarfile}"/>
+ <not>
+ <contains string="${project.lastBuiltTarfile}" substring="${project.name}"/>
+ </not>
<then>
- <exec command="pear -c ${project.tmpdir}/pear-config install --alldeps -f ${project.tarfile}" logoutput="true" checkreturn="true"/>
+ <echo>Please run 'phing pear-package' first, then try again.</echo>
</then>
<elseif>
- <istrue value="${project.stability}"/>
+ <available file="${project.lastBuiltTarfile}"/>
<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>
+ <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.tarfile}</echo>
+ <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">
<if>
- <available file="${project.tarfile}"/>
+ <not>
+ <contains string="${project.lastBuiltTarfile}" substring="${project.name}"/>
+ </not>
<then>
- <exec command="pear install -f -a ${project.tarfile}" checkreturn="true" logoutput="true" />
+ <echo>Please run 'phing pear-package' first, then try again.</echo>
</then>
<elseif>
- <istrue value="${project.stability}"/>
+ <available file="${project.lastBuiltTarfile}"/>
<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>
+ <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.tarfile}</echo>
+ <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">
<if>
- <available file="${project.tarfile}"/>
+ <not>
+ <contains string="${project.lastBuiltTarfile}" substring="${project.name}"/>
+ </not>
<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" />
+ <echo>Please run 'phing pear-package' first, then try again.</echo>
</then>
<elseif>
- <istrue value="${project.stability}"/>
+ <available file="${project.lastBuiltTarfile}"/>
<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>
+ <!-- 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.tarfile}</echo>
+ <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>
@@ -390,6 +421,7 @@
<!-- 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 -->
@@ -400,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 c030731

Please sign in to comment.