Skip to content

Commit

Permalink
introduced Phing
Browse files Browse the repository at this point in the history
  • Loading branch information
cmb69 committed Jan 13, 2015
1 parent c16ccdc commit d1d8432
Show file tree
Hide file tree
Showing 5 changed files with 189 additions and 0 deletions.
126 changes: 126 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>

<project name="Onepage" default="help">

<fileset id="php-sources" dir=".">
<include name="index.php"/>
<include name="classes/*.php"/>
</fileset>

<fileset id="js-sources" dir=".">
<include name="*.js"/>
</fileset>

<fileset id="unit-tests" dir="tests/unit">
<include name="*Test.php"/>
</fileset>

<fileset id="attack-tests" dir="tests/attack">
<include name="*Test.php"/>
</fileset>

<target name="help" description="lists available targets">
<exec command="phing -l" outputProperty="help"/>
<echo>${help}</echo>
</target>

<target name="sniff" description="checks adherence to PEAR CS">
<phpcodesniffer standard="PEAR">
<fileset refid="php-sources"/>
<fileset refid="unit-tests"/>
<fileset refid="attack-tests"/>
</phpcodesniffer>
</target>

<target name="compat"
description="checks PHP requirements">
<exec command="phpcompatinfo analyser:run ." logoutput="true"/>
</target>

<target name="unit-tests" description="runs all unit tests">
<phpunit haltonerror="true" haltonfailure="true">
<formatter type="plain" usefile="false"/>
<batchtest>
<fileset refid="unit-tests"/>
</batchtest>
</phpunit>
</target>

<target name="attack-tests" description="runs all attack tests">
<fail unless="env.CMSIMPLEDIR" message="CMSIMPLEDIR undefined!"/>
<phpunit haltonerror="true" haltonfailure="true">
<formatter type="plain" usefile="false"/>
<batchtest>
<fileset refid="attack-tests"/>
</batchtest>
</phpunit>
</target>

<target name="coverage" description="generates coverage report">
<exec command="phpunit --configuration coverage.xml" logoutput="true"/>
</target>

<target name="php-doc">
<phpdoc title="Onepage_XH Developer Documentation" destdir="doc/php"
output="HTML:Smarty:HandS" defaultpackagename="Onepage"
defaultcategoryname="CMSimple_XH">
<fileset refid="php-sources"/>
<projdocfileset dir=".">
<include name="README"/>
<include name="CHANGELOG"/>
</projdocfileset>
</phpdoc>
</target>

<target name="js-doc">
<apply executable="jsdoc" parallel="true" checkreturn="true">
<arg value="-d"/>
<arg value="doc/js"/>
<arg value="-p"/>
<fileset refid="js-sources"/>
</apply>
</target>

<target name="doc" depends="php-doc, js-doc"
description="generates the developer documentation"/>

<target name="build" description="builds a distributable ZIP archive">
<fail unless="version" message="version is not defined!"/>
<exec command="git archive -o export.tar HEAD" checkreturn="true"/>
<untar file="export.tar" todir="export"/>
<delete file="export.tar"/>
<move todir="dist">
<fileset dir="export">
<include name="index.php"/>
<include name="version.nfo"/>
</fileset>
<filterchain>
<replacetokens>
<token key="ONEPAGE_VERSION" value="${version}"/>
</replacetokens>
</filterchain>
</move>
<jsMin targetDir="dist" suffix="" failOnError="false">
<fileset dir="export">
<include name="*.js"/>
</fileset>
</jsMin>
<move todir="dist">
<fileset dir="export">
<exclude name="build.xml"/>
<exclude name="composer.*"/>
<exclude name="coverage.xml"/>
<exclude name="phpcompatinfo.*"/>
<exclude name="tests/**"/>
</fileset>
</move>
<delete dir="export"/>
<copy file="dist/config/config.php"
tofile="dist/config/defaultconfig.php"/>
<copy file="dist/languages/en.php" tofile="dist/languages/default.php"/>
<zip destfile="Onepage_XH-${version}.zip" basedir="dist"
prefix="onepage/"/>
<delete dir="dist"/>
</target>

</project>
18 changes: 18 additions & 0 deletions coverage.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit>
<testsuites>
<testsuite name="coverage">
<directory>tests/unit</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">classes</directory>
<file>index.php</file>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="./tests/coverage" charset="UTF-8"
highlight="false" lowUpperBound="35" highLowerBound="70"/>
</logging>
</phpunit>
45 changes: 45 additions & 0 deletions phpcompatinfo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"source-providers": [
{
"in": ". as current",
"exclude": ["tests", "vendor"],
"name": "/\\.(php|htm)$/"
}
],
"plugins": [
{
"name": "Analyser",
"class": "Bartlett\\Reflect\\Plugin\\Analyser\\AnalyserPlugin"
}
],
"analysers" : [
{
"name": "Namespace",
"class": "Bartlett\\CompatInfo\\Analyser\\NamespaceAnalyser"
},
{
"name": "Extension",
"class": "Bartlett\\CompatInfo\\Analyser\\ExtensionAnalyser"
},
{
"name": "Interface",
"class": "Bartlett\\CompatInfo\\Analyser\\InterfaceAnalyser"
},
{
"name": "Trait",
"class": "Bartlett\\CompatInfo\\Analyser\\TraitAnalyser"
},
{
"name": "Class",
"class": "Bartlett\\CompatInfo\\Analyser\\ClassAnalyser"
},
{
"name": "Function",
"class": "Bartlett\\CompatInfo\\Analyser\\FunctionAnalyser"
},
{
"name": "Constant",
"class": "Bartlett\\CompatInfo\\Analyser\\ConstantAnalyser"
}
]
}
Empty file added tests/attack/.gitignore
Empty file.
Empty file added tests/unit/.gitignore
Empty file.

0 comments on commit d1d8432

Please sign in to comment.