Skip to content

Commit

Permalink
Upgraded skeleton files to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartherbert committed Jan 23, 2012
1 parent 0fcc22d commit d9db72c
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 22 deletions.
4 changes: 2 additions & 2 deletions build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ project.name=phix
project.majorVersion=0
project.minorVersion=15
project.patchLevel=0
project.snapshot=true
project.snapshot=false

checkstyle.standard=Zend

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

project.channel=pear.phix-project.org
pear.local=/var/www/${project.channel}
103 changes: 83 additions & 20 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<property file="${project.distdir.lastBuilt}"/>
</then>
<else>
<property name="project.lastBuiltTarfile" value="false"/>
<property name="project.lastBuiltTarfile" value="false"/>
</else>
</if>

Expand Down Expand Up @@ -114,7 +114,7 @@

<taskdef name="phingcallifexists" classname="Phix_Project.ComponentManager.Phing.PhingCallIfExistsTask" />
<import file="build.local.xml"/>

<!-- Tell the user what this build file supports -->
<target name="help">
<echo message="${project.name} ${project.version}: build.xml targets:" />
Expand All @@ -139,6 +139,8 @@
<echo message=" Run code quality tests for PHP_CodeBrowser" />
<echo message=" phpcpd" />
<echo message=" Check for cut and paste problems" />
<echo message=" phploc" />
<echo message=" Calculate the size of your PHP project" />
<echo message=" phpdoc" />
<echo message=" Create the PHP docs from source code" />
<echo message="" />
Expand Down Expand Up @@ -205,7 +207,7 @@
<delete dir="${project.review.codecoveragedir}" />
<mkdir dir="${project.review.codecoveragedir}" />
<mkdir dir="${project.review.logsdir}" />
<exec command="phpunit --configuration=phpunit.xml ${project.src.testunitdir}" checkreturn="true" logoutput="true"/>
<exec command="phpunit" checkreturn="true" logoutput="true"/>
<echo/>
<echo>The code coverage report is in file://${project.review.codecoveragedir}</echo>
<echo/>
Expand All @@ -217,7 +219,7 @@
</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, phploc">
<phingcallifexists target="local.code-review"/>
</target>

Expand Down Expand Up @@ -263,6 +265,12 @@
<exec command="phpcb --log ${project.review.logsdir} --source ${project.src.phpdir} --output ${project.review.codebrowserdir}" logoutput="true" />
</target>

<!-- Work out the size of the project -->
<target name="phploc">
<mkdir dir="${project.review.logsdir}" />
<exec command="phploc --log-xml ${project.review.logsdir}/phploc.xml --log-csv ${project.review.logsdir}/phploc.csv ${project.src.phpdir}" logoutput="true" />
</target>

<!-- Populate vendor with the dependencies for this component -->
<target name="build-vendor" depends="pear-package,setup-vendor">
<echo>Populating vendor/ with dependencies</echo>
Expand Down Expand Up @@ -298,13 +306,55 @@
<echo>Building release directory</echo>
<delete dir="${project.builddir}" />
<mkdir dir="${project.pkgdir}" />
<if>
<available file="${project.src.bindir}"/>
<then>
<copy todir="${project.pkgdir}">
<fileset refid="binfiles"/>
</copy>
</then>
</if>
<if>
<available file="${project.src.datadir}"/>
<then>
<copy todir="${project.pkgdir}">
<fileset refid="datafiles"/>
</copy>
</then>
</if>
<if>
<available file="${project.src.docdir}"/>
<then>
<copy todir="${project.pkgdir}">
<fileset refid="docfiles"/>
</copy>
</then>
</if>
<if>
<available file="${project.src.phpdir}"/>
<then>
<copy todir="${project.pkgdir}">
<fileset refid="phpfiles"/>
</copy>
</then>
</if>
<if>
<available file="${project.src.testunitdir}"/>
<then>
<copy todir="${project.pkgdir}">
<fileset refid="testfiles"/>
</copy>
</then>
</if>
<if>
<available file="${project.src.wwwdir}"/>
<then>
<copy todir="${project.pkgdir}">
<fileset refid="wwwfiles"/>
</copy>
</then>
</if>
<copy todir="${project.pkgdir}">
<fileset refid="binfiles"/>
<fileset refid="datafiles"/>
<fileset refid="phpfiles"/>
<fileset refid="testfiles"/>
<fileset refid="wwwfiles"/>
<fileset refid="docfiles"/>
<fileset refid="topleveldocfiles"/>
</copy>
<copy todir="${project.builddir}">
Expand All @@ -325,8 +375,11 @@
</fileset>
</tar>

<!-- write a message to say which file we built last -->
<!-- remember the tarball we have just build -->
<property name="project.lastBuiltTarfile" value="${project.tarfile}" override="true"/>
<echo file="${project.distdir.lastBuilt}" append="false">project.lastBuiltTarfile=${project.tarfile}</echo>

<!-- write a message to say which file we built last -->
<echo>Your PEAR package is in ${project.tarfile}</echo>
<phingcallifexists target="local.pear-package"/>
</target>
Expand All @@ -338,18 +391,28 @@
<contains string="${project.lastBuiltTarfile}" substring="${project.name}"/>
</not>
<then>
<echo>Please run 'phing pear-package' first, then try again.</echo>
<fail message="Please run 'phing pear-package' first, then try again."/>
</then>
</if>

<if>
<not>
<available file="${project.vendordir"/>
</not>
<then>
<phingcall target="build-vendor" />
</then>
</if>
<if>
<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>
<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>
<fail message="Run 'phing pear-package' to create a new PEAR package, then try again."/>
</else>
</if>
</target>
Expand Down
File renamed without changes.
68 changes: 68 additions & 0 deletions src/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
Your src/ folder
================

This src/ folder is where you put all of your code for release. There's
a folder for each type of file that the PEAR Installer supports. You can
find out more about these file types online at:

http://blog.stuartherbert.com/php/2011/04/04/explaining-file-roles/

* bin/

If you're creating any command-line tools, this is where you'd put
them. Files in here get installed into /usr/bin on Linux et al.

There is more information available here: http://blog.stuartherbert.com/php/2011/04/06/php-components-shipping-a-command-line-program/

You can find an example here: https://github.com/stuartherbert/phix/tree/master/src/bin

* data/

If you have any data files (any files that aren't PHP code, and which
don't belong in the www/ folder), this is the folder to put them in.

There is more information available here: http://blog.stuartherbert.com/php/2011/04/11/php-components-shipping-data-files-with-your-components/

You can find an example here: https://github.com/stuartherbert/ComponentManagerPhpLibrary/tree/master/src/data

* php/

This is where your component's PHP code belongs. Everything that goes
into this folder must be PSR0-compliant, so that it works with the
supplied autoloader.

There is more information available here: http://blog.stuartherbert.com/php/2011/04/05/php-components-shipping-reusable-php-code/

You can find an example here: https://github.com/stuartherbert/ContractLib/tree/master/src/php

* tests/functional-tests/

Right now, this folder is just a placeholder for future functionality.
You're welcome to make use of it yourself.

* tests/integration-tests/

Right now, this folder is just a placeholder for future functionality.
You're welcome to make use of it yourself.

* tests/unit-tests/

This is where all of your PHPUnit tests go.

It needs to contain _exactly_ the same folder structure as the src/php/
folder. For each of your PHP classes in src/php/, there should be a
corresponding test file in test/unit-tests.

There is more information available here: http://blog.stuartherbert.com/php/2011/08/15/php-components-shipping-unit-tests-with-your-component/

You can find an example here: https://github.com/stuartherbert/ContractLib/tree/master/test/unit-tests

* www/

This folder is for any files that should be published in a web server's
DocRoot folder.

It's quite unusual for components to put anything in this folder, but
it is there just in case.

There is more information available here: http://blog.stuartherbert.com/php/2011/08/16/php-components-shipping-web-pages-with-your-components/
6 changes: 6 additions & 0 deletions src/tests/unit-tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@
psr0_autoloader_searchFirst(APP_LIBDIR);
psr0_autoloader_searchFirst(APP_TESTDIR);
psr0_autoloader_searchFirst(APP_TOPDIR);

// step 4: enable ContractLib if it is available
if (class_exists('Phix_Project\ContractLib\Contract'))
{
\Phix_Project\ContractLib\Contract::EnforceWrappedContracts();
}

0 comments on commit d9db72c

Please sign in to comment.