mirror of
https://github.com/wiosna-dev/limesurvey-api-client.git
synced 2026-03-12 02:11:45 +01:00
Phing > update XMLs
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -17,7 +17,7 @@
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
### Phing
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
/.phing/properties
|
||||
/phing/properties
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------
|
||||
### PHPUnit
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.14.0">
|
||||
<!-- Properties -->
|
||||
<if>
|
||||
<available file=".phing/properties" property="custom.properties.available"/>
|
||||
<then>
|
||||
<property file=".phing/properties" />
|
||||
</then>
|
||||
<else>
|
||||
<property file=".phing/properties.dist" />
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<!-- Default / main target -->
|
||||
<target name="build:main"
|
||||
depends="build:app"
|
||||
description="Builds the application" />
|
||||
|
||||
<!-- App target -->
|
||||
<target name="build:app"
|
||||
depends="app:composer, app:vendors, app:checkout"
|
||||
description="Prepares app to build." />
|
||||
|
||||
<!-- Check / update composer -->
|
||||
<target name="app:composer" description="Checks / updates composer">
|
||||
<echo msg="Checking / updating composer..." />
|
||||
|
||||
<if>
|
||||
<available file="composer.phar" />
|
||||
<then>
|
||||
<echo msg="[Skipped] Downloading of Composer skipped, because exist in the project..." />
|
||||
</then>
|
||||
<else>
|
||||
<if>
|
||||
<os family="windows" />
|
||||
<then>
|
||||
<fail message="Composer not found! Go to http://getcomposer.org/download and download the Composer." />
|
||||
</then>
|
||||
<else>
|
||||
<exec command="${composer.download_command}" checkreturn="true" />
|
||||
</else>
|
||||
</if>
|
||||
</else>
|
||||
</if>
|
||||
<composer command="selfupdate" />
|
||||
</target>
|
||||
|
||||
<!-- Project Install/update vendors -->
|
||||
<target name="app:vendors" description="Installs / updates vendors">
|
||||
<echo msg="Installing / updating vendors..." />
|
||||
|
||||
<if>
|
||||
<istrue value="${composer.self-update}"/>
|
||||
<then>
|
||||
<composer php="${composer.php}" composer="${composer.path}" command="self-update"/>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<if>
|
||||
<istrue value="${composer.validate}"/>
|
||||
<then>
|
||||
<composer php="${composer.php}" composer="${composer.path}" command="validate"/>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<if>
|
||||
<equals arg1="${env}" arg2="prod" />
|
||||
<then>
|
||||
<composer php="${composer.php}" composer="${composer.path}" command="install">
|
||||
<arg value="--optimize-autoloader" />
|
||||
</composer>
|
||||
</then>
|
||||
<else>
|
||||
<composer php="${composer.php}" composer="${composer.path}" command="install" />
|
||||
</else>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<!-- Checkout and finalization -->
|
||||
<target name="app:checkout">
|
||||
<tstamp>
|
||||
<format property="date_end" pattern="%Y-%m-%d %H:%M" />
|
||||
</tstamp>
|
||||
|
||||
<echo msg="------------------------------------" />
|
||||
<echo msg="Build finished at: ${date_end}" />
|
||||
<echo msg="------------------------------------" />
|
||||
</target>
|
||||
</project>
|
||||
315
.phing/tests.xml
315
.phing/tests.xml
@@ -1,315 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.14.0">
|
||||
<!--
|
||||
The AutoloaderTask is required to load binaries installed by Composer.
|
||||
The "autoloaderpath" attribute of this task is not required, because it's default value is: vendor/autoload.php.
|
||||
|
||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
2017-02-23
|
||||
-->
|
||||
<autoloader />
|
||||
|
||||
<!-- Properties -->
|
||||
<if>
|
||||
<available file=".phing/properties" property="custom.properties.available"/>
|
||||
<then>
|
||||
<property file=".phing/properties" />
|
||||
</then>
|
||||
<else>
|
||||
<property file=".phing/properties.dist" />
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<!-- Filesets -->
|
||||
<fileset id="sourcecode" dir="${dir.src}">
|
||||
<include name="**/*.php" />
|
||||
<exclude name="*Test.php" />
|
||||
<exclude name="**/*Test.php" />
|
||||
<exclude name="**/Resources/**" />
|
||||
<exclude name="**/DataFixtures/**" />
|
||||
<exclude name="**/Tests/**" />
|
||||
</fileset>
|
||||
<fileset id="tests" dir="${dir.tests}">
|
||||
<include name="**/*Test*.php" />
|
||||
</fileset>
|
||||
|
||||
<!-- Default / main target -->
|
||||
<target name="build:main"
|
||||
depends="build:fix-coding-standards, build:clean, build:prepare, build:check, build:test, app:checkout"
|
||||
description="Runs all tests and builds everything" />
|
||||
<!--
|
||||
Before:
|
||||
depends="build:fix-coding-standards, build:clean, build:prepare, build:check, build:test, build:doc, app:checkout"
|
||||
|
||||
After:
|
||||
depends="build:fix-coding-standards, build:clean, build:prepare, build:check, build:test, app:checkout"
|
||||
|
||||
The "build:doc" task is disabled, because it cannot be installed via Composer:
|
||||
a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2
|
||||
b) symfony/validator ~2.2 causes to remove symfony/symfony 3.*
|
||||
|
||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
2017-02-22
|
||||
-->
|
||||
|
||||
<!-- Fixing coding standards using the PHP Coding Standards Fixer (http://cs.sensiolabs.org) -->
|
||||
<target name="build:fix-coding-standards" description="Fixes coding standards using the PHP Coding Standards Fixer">
|
||||
<echo msg="Fixing coding standards using the PHP Coding Standards Fixer (http://cs.sensiolabs.org)..." />
|
||||
|
||||
<!--
|
||||
Attention.
|
||||
Rules for formatting are defined in /.php_cs.dist file.
|
||||
-->
|
||||
|
||||
<exec
|
||||
passthru="true"
|
||||
command="${phpCsFixer.path} fix --verbose"
|
||||
/>
|
||||
</target>
|
||||
|
||||
<!-- Doc target -->
|
||||
<!--
|
||||
Disabled, because it cannot be installed via Composer:
|
||||
a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2
|
||||
b) symfony/validator ~2.2 causes to remove symfony/symfony 3.*
|
||||
|
||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
2017-02-22
|
||||
-->
|
||||
<!--<target name="build:doc"-->
|
||||
<!--depends="build:prepare, doc:phpdoc2"-->
|
||||
<!--description="Generates API documentation" />-->
|
||||
|
||||
<!-- Check target -->
|
||||
<target name="build:check"
|
||||
depends="check:cs, check:md, check:cpd, check:depend, check:loc"
|
||||
description="Analyzes code" />
|
||||
|
||||
<!-- Test target -->
|
||||
<target name="build:test"
|
||||
depends="test:phpunit"
|
||||
description="Executes all tests" />
|
||||
|
||||
<!-- Project build clean -->
|
||||
<target name="build:clean" description="Cleans up build directories">
|
||||
<echo msg="Cleaning docs and reports directories..." />
|
||||
<!--<delete dir="${dir.docs}" />-->
|
||||
<delete dir="${dir.reports}" />
|
||||
</target>
|
||||
|
||||
<!-- Project build prepare -->
|
||||
<target name="build:prepare" description="Create build directories">
|
||||
<echo msg="Creating build directories..." />
|
||||
<!--<mkdir dir="${dir.docs}" />-->
|
||||
<!--<mkdir dir="${dir.docs.phpdoc2}" />-->
|
||||
<mkdir dir="${dir.reports}" />
|
||||
<mkdir dir="${dir.reports.coverage}" />
|
||||
<mkdir dir="${dir.reports.pdepend}" />
|
||||
</target>
|
||||
|
||||
<!-- PHPDocumentor2 API documentation target -->
|
||||
<!--
|
||||
Disabled, because it cannot be installed via Composer:
|
||||
a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2
|
||||
b) symfony/validator ~2.2 causes to remove symfony/symfony 3.*
|
||||
|
||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
2017-02-22
|
||||
|
||||
<target name="doc:phpdoc2" description="Generates API documentations">
|
||||
<echo msg="Generating API Documentation with phpDocumentor 2..." />
|
||||
<phpdoc2 title="${phing.project.name}"
|
||||
destdir="${dir.docs.phpdoc2}"
|
||||
template="responsive">
|
||||
<fileset refid="sourcecode" />
|
||||
</phpdoc2>
|
||||
</target>
|
||||
-->
|
||||
|
||||
<!-- Symfony2 code sniffer -->
|
||||
<!--
|
||||
Attention 1.
|
||||
To use Symfony2 standards to check coding you have to:
|
||||
copy, symlink or check out repo to a folder called Symfony2 inside the phpcs Standards directory.
|
||||
|
||||
Example:
|
||||
$ pear config-show | grep php_dir
|
||||
$ cd /path/to/pear/PHP/CodeSniffer/Standards
|
||||
$ git clone git://github.com/opensky/Symfony2-coding-standard.git Symfony2
|
||||
|
||||
Attention 2.
|
||||
PSR2 standard is used instead of Symfony2 standard, because after installation squizlabs/php_codesniffer package
|
||||
via Composer the Symfony2 standard is not included / available in this package. In this case the PHP Coding
|
||||
Standards Fixer (http://cs.sensiolabs.org) is used.
|
||||
|
||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
2017-02-22
|
||||
-->
|
||||
<target name="check:cs" description="Checks coding standard">
|
||||
<echo msg="Checking coding standard..." />
|
||||
<phpcodesniffer standard="PSR2" showWarnings="true">
|
||||
<fileset refid="sourcecode" />
|
||||
<formatter type="checkstyle" outfile="${dir.reports}/checkstyle.xml" />
|
||||
<formatter type="csv" outfile="${dir.reports}/checkstyle.csv" />
|
||||
<formatter type="summary" outfile="${dir.reports}/checkstyle_summary.txt" />
|
||||
</phpcodesniffer>
|
||||
</target>
|
||||
|
||||
<!-- copy/paste detector -->
|
||||
<target name="check:cpd" description="Checks similar code blocks.">
|
||||
<echo msg="Checking similar code blocks..." />
|
||||
<phpcpd>
|
||||
<fileset refid="sourcecode" />
|
||||
<formatter type="pmd" outfile="${dir.reports}/pmd-cpd.xml" />
|
||||
</phpcpd>
|
||||
|
||||
<!--
|
||||
Previous / old version
|
||||
|
||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
2017-02-22
|
||||
|
||||
<exec command="phpcpd \-\-log-pmd=${dir.reports}/pmd-cpd.xml ${dir.src}" />
|
||||
-->
|
||||
</target>
|
||||
|
||||
<!-- Mess detector -->
|
||||
<target name="check:md" description="Generate code metrics">
|
||||
<echo msg="Generating code metrics..." />
|
||||
<phpmd rulesets="codesize,controversial,design,naming,unusedcode">
|
||||
<fileset refid="sourcecode" />
|
||||
<formatter type="html" outfile="${dir.reports}/phpmd.html" />
|
||||
<formatter type="text" outfile="${dir.reports}/phpmd.txt" />
|
||||
</phpmd>
|
||||
</target>
|
||||
|
||||
<!-- Code dependency -->
|
||||
<target name="check:depend" description="Checks coupling and dependency">
|
||||
<echo msg="Checking coupling and dependency..." />
|
||||
<phpdepend>
|
||||
<fileset refid="sourcecode" />
|
||||
<logger type="jdepend-xml" outfile="${dir.reports.pdepend}/jdepend.xml" />
|
||||
<logger type="jdepend-chart" outfile="${dir.reports.pdepend}/dependencies.svg" />
|
||||
<logger type="overview-pyramid" outfile="${dir.reports.pdepend}/overview-pyramid.svg" />
|
||||
</phpdepend>
|
||||
</target>
|
||||
|
||||
<!-- Measure the size and analyzing the structure of a project -->
|
||||
<target name="check:loc" description="Measures the size and analyzes the structure of a project">
|
||||
<echo msg="Measuring the size and analyzing the structure of a project..." />
|
||||
<phploc reportType="txt" reportName="phploc" reportDirectory="${dir.reports}">
|
||||
<fileset refid="sourcecode" />
|
||||
</phploc>
|
||||
|
||||
<!--
|
||||
Previous / old version
|
||||
|
||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
2017-02-22
|
||||
|
||||
<exec command="phploc \-\-log-csv=${dir.reports}/phploc.csv ${dir.src}" />
|
||||
-->
|
||||
</target>
|
||||
|
||||
<!-- Unit tests -->
|
||||
<target name="test:phpunit" description="Executes PHPUnit tests">
|
||||
<!-- Check test database -->
|
||||
<if>
|
||||
<not>
|
||||
<available file="${dir.data.tests}" type="dir" property="dir.data.tests.available" />
|
||||
</not>
|
||||
<then>
|
||||
<mkdir dir="${dir.data.tests}" />
|
||||
</then>
|
||||
</if>
|
||||
<if>
|
||||
<not>
|
||||
<available file="${tests.database}" property="tests.database.available" />
|
||||
</not>
|
||||
<then>
|
||||
<touch file="${tests.database}" />
|
||||
</then>
|
||||
</if>
|
||||
<echo msg="Running unit tests..." />
|
||||
<coverage-setup database="${dir.reports.coverage}/coverage.db">
|
||||
<fileset refid="sourcecode" />
|
||||
</coverage-setup>
|
||||
<exec command="${phpUnit.path} --verbose --configuration ${project.basedir}/phpunit.xml.dist" passthru="true" />
|
||||
<!--
|
||||
I have to use ExecTask to run PHPUnit instead of PHPUnitTask, because tests are not running if PHPUnitTask is
|
||||
used (don't know why):
|
||||
Total tests run: 0, Failures: 0, Errors: 0, Incomplete: 0, Skipped: 0
|
||||
|
||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
2017-02-23
|
||||
|
||||
<phpunit configuration="${project.basedir}/phpunit.xml.dist" printsummary="true">
|
||||
<formatter type="xml" todir="${dir.reports}" outfile="phpunit.xml" />
|
||||
<formatter type="plain" todir="${dir.reports}" outfile="phpunit.txt" />
|
||||
<formatter type="clover" todir="${dir.reports.coverage}" />
|
||||
<formatter type="summary" todir="${dir.reports}" outfile="phpunit_summary.txt" />
|
||||
</phpunit>
|
||||
-->
|
||||
|
||||
<!--
|
||||
Previous / old version
|
||||
|
||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
2017-02-22
|
||||
|
||||
<if>
|
||||
<istrue value="${phpunit.useExec}" />
|
||||
<then>
|
||||
<if>
|
||||
<istrue value="${phpunit.withCoverage}" />
|
||||
<then>
|
||||
<echo message="Running tests with code coverage..." />
|
||||
<exec command="phpunit \-\-log-junit ${dir.reports}/phpunit.xml \-\-coverage-clover ${dir.reports.coverage}/clover-coverage.xml \-\-coverage-crap4j ${dir.reports.coverage}/crap4j-coverage.xml \-\-coverage-html ${dir.reports.coverage}/ -c ${project.basedir} \-\-colors" passthru="true" checkreturn="true" />
|
||||
</then>
|
||||
<else>
|
||||
<echo message="Running tests without code coverage..." />
|
||||
<exec command="phpunit \-\-log-junit ${dir.reports}/phpunit.xml -c ${project.basedir} \-\-colors" passthru="true" checkreturn="true" />
|
||||
</else>
|
||||
</if>
|
||||
</then>
|
||||
<else>
|
||||
<if>
|
||||
<istrue value="${phpunit.withCoverage}" />
|
||||
<then>
|
||||
<echo message="Running tests with code coverage..." />
|
||||
<coverage-setup database="${dir.reports.coverage}/coverage.db">
|
||||
<fileset refid="sourcecode" />
|
||||
</coverage-setup>
|
||||
<phpunit printsummary="true" codecoverage="true">
|
||||
<formatter type="xml" todir="${dir.reports}" outfile="phpunit.xml" />
|
||||
<formatter type="plain" todir="${dir.reports}" outfile="phpunit.txt" />
|
||||
<formatter type="clover" todir="${dir.reports.coverage}" />
|
||||
<formatter type="summary" todir="${dir.reports}" outfile="phpunit_summary.txt" />
|
||||
</phpunit>
|
||||
</then>
|
||||
<else>
|
||||
<echo message="Running tests without code coverage..." />
|
||||
<phpunit printsummary="true">
|
||||
<formatter todir="${dir.reports}" type="xml" outfile="phpunit.xml" />
|
||||
<batchtest>
|
||||
<fileset refid="tests" />
|
||||
</batchtest>
|
||||
</phpunit>
|
||||
</else>
|
||||
</if>
|
||||
</else>
|
||||
</if>
|
||||
-->
|
||||
</target>
|
||||
|
||||
<!-- Checkout and finalization -->
|
||||
<target name="app:checkout">
|
||||
<tstamp>
|
||||
<format property="date_end" pattern="%Y-%m-%d %H:%M" />
|
||||
</tstamp>
|
||||
|
||||
<echo msg="--------------------------------------------" />
|
||||
<echo msg="Build tests finished at: ${date_end}" />
|
||||
<echo msg="--------------------------------------------" />
|
||||
</target>
|
||||
</project>
|
||||
14
build.xml
14
build.xml
@@ -2,12 +2,12 @@
|
||||
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.14.0">
|
||||
<!-- Properties -->
|
||||
<if>
|
||||
<available file=".phing/properties" property="custom.properties.available"/>
|
||||
<available file="phing/properties" property="custom.properties.available"/>
|
||||
<then>
|
||||
<property file=".phing/properties" />
|
||||
<property file="phing/properties"/>
|
||||
</then>
|
||||
<else>
|
||||
<property file=".phing/properties.dist" />
|
||||
<property file="phing/properties.dist"/>
|
||||
</else>
|
||||
</if>
|
||||
|
||||
@@ -18,24 +18,24 @@
|
||||
|
||||
<!-- Build app -->
|
||||
<target name="build:app" description="Prepares app to build and tests">
|
||||
<phing phingfile=".phing/app.xml" haltonfailure="true" />
|
||||
<phing phingfile="phing/app.xml" haltonfailure="true"/>
|
||||
</target>
|
||||
|
||||
<!-- Build tests -->
|
||||
<target name="build:tests" description="Runs all tests, checks and creates docs">
|
||||
<phing phingfile=".phing/tests.xml" haltonfailure="true" />
|
||||
<phing phingfile="phing/tests.xml" haltonfailure="true"/>
|
||||
|
||||
<!--
|
||||
Conditional running of tests.
|
||||
Disabled, because not required.
|
||||
|
||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
Meritoo <github@meritoo.pl>
|
||||
2017-02-22
|
||||
|
||||
<if>
|
||||
<equals arg1="${env}" arg2="test" />
|
||||
<then>
|
||||
<phing phingfile=".phing/tests.xml" haltonfailure="true" />
|
||||
<phing phingfile="phing/tests.xml" haltonfailure="true" />
|
||||
</then>
|
||||
<else>
|
||||
<echo message="[Skipped] Running tests, checks and creating docs, because it's a not 'test' environment..." />
|
||||
|
||||
164
phing/app.xml
Normal file
164
phing/app.xml
Normal file
@@ -0,0 +1,164 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.16.0">
|
||||
<!-- Properties -->
|
||||
<if>
|
||||
<available file="phing/properties" property="custom.properties.available"/>
|
||||
<then>
|
||||
<property file="phing/properties"/>
|
||||
</then>
|
||||
<else>
|
||||
<property file="phing/properties.dist"/>
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<!-- Filesets -->
|
||||
<import file="phing/filesets.xml"/>
|
||||
|
||||
<!-- Default / main target -->
|
||||
<target name="build:main"
|
||||
depends="build:app"
|
||||
description="Builds the application"/>
|
||||
|
||||
<!-- App target -->
|
||||
<target name="build:app"
|
||||
depends="app:clean, app:composer, app:vendors, app:composer-validate, app:checkout"
|
||||
description="Prepares app to build."/>
|
||||
|
||||
<!-- Updates Composer -->
|
||||
<target name="app:composer" description="Updates Composer">
|
||||
<echo msg="Updating Composer..."/>
|
||||
|
||||
<if>
|
||||
<available file="composer.phar"/>
|
||||
<then>
|
||||
<echo msg="[Skipped] Downloading of Composer skipped, because exist in the project..."/>
|
||||
</then>
|
||||
<else>
|
||||
<if>
|
||||
<os family="windows"/>
|
||||
<then>
|
||||
<fail message="Composer not found! Go to http://getcomposer.org/download and download the Composer."/>
|
||||
</then>
|
||||
<else>
|
||||
<exec command="${composer.download_command}" checkreturn="true"/>
|
||||
</else>
|
||||
</if>
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<!-- Update Composer -->
|
||||
<composer command="selfupdate"/>
|
||||
</target>
|
||||
|
||||
<!-- Validates composer.* files -->
|
||||
<target name="app:composer-validate" description="Validates composer.* files">
|
||||
<echo msg="Validating composer.* files..."/>
|
||||
|
||||
<!-- Validate Composer -->
|
||||
<composer command="validate">
|
||||
<arg line="--no-check-all --strict"/>
|
||||
</composer>
|
||||
</target>
|
||||
|
||||
<!-- Project clean -->
|
||||
<target name="app:clean" description="Clears app's directories">
|
||||
<echo msg="Cleaning project..."/>
|
||||
<if>
|
||||
<equals arg1="${env}" arg2="prod"/>
|
||||
<then>
|
||||
<echo message="[Skipped] Cleaning project (and directories cleanup) skipped, because of 'prod' environment..."/>
|
||||
</then>
|
||||
<else>
|
||||
<echo msg="Cleaning directories (making them empty)..."/>
|
||||
<foreach list="${directoriesToEmpty}" param="directory" target="app:clean:empty"/>
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<echo msg="Preparing directories structure..."/>
|
||||
<foreach list="${directoriesToCheck}" param="directory" target="app:clean:check"/>
|
||||
|
||||
<echo msg="Creating .gitkeep files..."/>
|
||||
<touch file="${dir.cache}/.gitkeep"/>
|
||||
<touch file="${dir.logs}/.gitkeep"/>
|
||||
<touch file="${dir.sessions}/.gitkeep"/>
|
||||
|
||||
<echo msg="Setting permissions of directories..."/>
|
||||
<foreach list="${directoriesToEmpty}" param="directory" target="app:permissions"/>
|
||||
</target>
|
||||
|
||||
<!-- Cleaning directory (making empty) directory -->
|
||||
<target name="app:clean:empty" description="Empties directory">
|
||||
<if>
|
||||
<available file="${directory}" type="dir"/>
|
||||
<then>
|
||||
<echo message="Cleaning directory (making empty) ${directory}..."/>
|
||||
<delete includeemptydirs="true" dir="${directory}"/>
|
||||
</then>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<!-- Checking if directory exists -->
|
||||
<target name="app:clean:check" description="Checks if directories exist">
|
||||
<if>
|
||||
<not>
|
||||
<available file="${directory}" type="dir"/>
|
||||
</not>
|
||||
<then>
|
||||
<if>
|
||||
<or>
|
||||
<contains string="${directory}" substring="cache"/>
|
||||
<contains string="${directory}" substring="logs"/>
|
||||
<contains string="${directory}" substring="sessions"/>
|
||||
</or>
|
||||
<then>
|
||||
<mkdir dir="${directory}" mode="0777"/>
|
||||
</then>
|
||||
<else>
|
||||
<mkdir dir="${directory}" mode="0775"/>
|
||||
</else>
|
||||
</if>
|
||||
</then>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<!-- Project Install/update vendors -->
|
||||
<target name="app:vendors" description="Installs / updates vendors">
|
||||
<echo msg="Installing / updating vendors..."/>
|
||||
|
||||
<if>
|
||||
<istrue value="${composer.self-update}"/>
|
||||
<then>
|
||||
<composer php="${composer.php}" composer="${composer.path}" command="self-update"/>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<composer php="${composer.php}" composer="${composer.path}" command="install">
|
||||
<arg value="--optimize-autoloader"/>
|
||||
<arg value="--prefer-dist"/>
|
||||
<arg value="--classmap-authoritative"/>
|
||||
</composer>
|
||||
</target>
|
||||
|
||||
<!-- Setting permissions of given directory -->
|
||||
<target name="app:permissions" description="Sets permissions of one of the core directories">
|
||||
<if>
|
||||
<not>
|
||||
<os family="windows"/>
|
||||
</not>
|
||||
<then>
|
||||
<exec command="chmod -R 777 ${directory}/*"/>
|
||||
</then>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<!-- Checkout and finalization -->
|
||||
<target name="app:checkout">
|
||||
<tstamp>
|
||||
<format property="date_end" pattern="%Y-%m-%d %H:%M"/>
|
||||
</tstamp>
|
||||
|
||||
<echo msg="------------------------------------"/>
|
||||
<echo msg="Build finished at: ${date_end}"/>
|
||||
<echo msg="------------------------------------"/>
|
||||
</target>
|
||||
</project>
|
||||
35
phing/filesets.xml
Normal file
35
phing/filesets.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.16.0">
|
||||
<!-- Filesets -->
|
||||
<fileset id="cache" dir="${dir.cache}">
|
||||
<include name="**/*"/>
|
||||
<exclude name=".gitkeep"/>
|
||||
</fileset>
|
||||
<fileset id="logs" dir="${dir.logs}">
|
||||
<include name="**/*"/>
|
||||
<exclude name=".gitkeep"/>
|
||||
</fileset>
|
||||
<fileset id="sessions" dir="${dir.sessions}">
|
||||
<include name="**/*"/>
|
||||
<exclude name=".gitkeep"/>
|
||||
</fileset>
|
||||
|
||||
<!-- Directories to check -->
|
||||
<property name="directoriesToCheck" value="
|
||||
${dir.cache},
|
||||
${dir.logs},
|
||||
${dir.sessions},
|
||||
${dir.data.tests},
|
||||
${dir.data.temporary},
|
||||
${dir.docker.data},
|
||||
${dir.docker.logs}"
|
||||
/>
|
||||
|
||||
<!-- Directories to empty -->
|
||||
<property name="directoriesToEmpty" value="
|
||||
${dir.cache},
|
||||
${dir.logs},
|
||||
${dir.sessions},
|
||||
${dir.data.temporary}"
|
||||
/>
|
||||
</project>
|
||||
@@ -9,7 +9,7 @@
|
||||
# not special chars. This way you can create pseudo-namespaces
|
||||
#
|
||||
# You can refer to values of other properties by enclosing their keys in "${}".
|
||||
# Example: dir.js = ${dir.web}/js
|
||||
# Example: dir.js = ${dir.public}/js
|
||||
#
|
||||
# Everything behind the equal sign is the value, you do
|
||||
# not have to enclose strings: text=This is some text, Your OS is ${php.os}
|
||||
@@ -22,13 +22,15 @@
|
||||
#
|
||||
env = dev
|
||||
|
||||
# Install assets using symlinks
|
||||
#
|
||||
assets.installWithSymlink = true
|
||||
|
||||
# Clear cache with the "warmup" option
|
||||
#
|
||||
cache.clearWithWarmup = true
|
||||
# The cache:clear command should always be called with the --no-warmup option. Warmup should be done via the cache:warmup command.
|
||||
# https://github.com/symfony/symfony/blob/master/UPGRADE-3.3.md#frameworkbundle
|
||||
#
|
||||
# Meritoo <github@meritoo.pl>
|
||||
# 2017-06-06
|
||||
#
|
||||
cache.clearWithWarmup = false
|
||||
|
||||
# --------------------------------------------------------------------------------
|
||||
# Composer
|
||||
@@ -39,7 +41,6 @@ composer.download_command = php -r "eval('?>'.file_get_contents('https://getcomp
|
||||
# Path to composer executable or composer.phar file
|
||||
#
|
||||
composer.path = composer.phar
|
||||
#composer.path = /usr/local/bin/composer
|
||||
|
||||
# Path to php executable used by composer
|
||||
#
|
||||
@@ -49,77 +50,49 @@ composer.php = php
|
||||
#
|
||||
composer.self-update = false
|
||||
|
||||
# Validate the composer.json file
|
||||
#
|
||||
composer.validate = false
|
||||
|
||||
# --------------------------------------------------------------------------------
|
||||
# Directories
|
||||
# --------------------------------------------------------------------------------
|
||||
|
||||
# System directories
|
||||
#
|
||||
dir.data = ${project.basedir}/.data
|
||||
dir.src = ${project.basedir}/src
|
||||
dir.var = ${project.basedir}/tests/Resources/var
|
||||
dir.cache = ${dir.var}/cache
|
||||
dir.logs = ${dir.var}/log
|
||||
dir.sessions = ${dir.var}/sessions
|
||||
dir.data = ${project.basedir}/data
|
||||
dir.tests = ${project.basedir}/tests
|
||||
|
||||
# --------------------------------------------------------------------------------
|
||||
# Build directories
|
||||
# --------------------------------------------------------------------------------
|
||||
|
||||
dir.build = ${project.basedir}/.build
|
||||
#
|
||||
dir.build = ${project.basedir}/build
|
||||
dir.reports = ${dir.build}/logs
|
||||
dir.reports.pdepend = ${dir.reports}/pdepend
|
||||
dir.reports.coverage = ${dir.reports}/phpunit_coverage
|
||||
#
|
||||
# Disabled, because unnecessary right now
|
||||
# phpdocumentor/phpdocumentor cannot be installed via Composer
|
||||
#
|
||||
# Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
# 2017-02-22
|
||||
#
|
||||
#dir.docs = ${dir.build}/docs
|
||||
#dir.docs.phpdoc2 = ${dir.docs}/phpdoc2
|
||||
|
||||
# --------------------------------------------------------------------------------
|
||||
# Data directories
|
||||
# --------------------------------------------------------------------------------
|
||||
|
||||
#
|
||||
dir.data.tests = ${dir.data}/tests
|
||||
dir.data.temporary = ${dir.data}/tmp
|
||||
|
||||
# Docker directories
|
||||
#
|
||||
dir.docker = ${project.basedir}/docker
|
||||
dir.docker.data = ${dir.docker}/data/db
|
||||
dir.docker.logs = ${dir.docker}/logs/nginx
|
||||
|
||||
# --------------------------------------------------------------------------------
|
||||
# Testing
|
||||
# --------------------------------------------------------------------------------
|
||||
|
||||
# Path of the PHP Coding Standards Fixer (http://cs.sensiolabs.org)
|
||||
#
|
||||
tests.cs_fixer.path = ./vendor/bin/php-cs-fixer
|
||||
|
||||
# Test database path
|
||||
#
|
||||
tests.database = ${dir.data.temporary}/database.sqlite
|
||||
|
||||
# Path of the framework used to run unit tests
|
||||
#
|
||||
# Disabled, because unnecessary right now
|
||||
# PHPUnit is installed and loaded by Composer
|
||||
#
|
||||
# Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
# 2017-02-22
|
||||
#
|
||||
# Run PHPUnit using exec task instead of phpunitTask
|
||||
#phpunit.useExec = false
|
||||
|
||||
#
|
||||
# Disabled, because unnecessary right now
|
||||
# We want generate code coverage always
|
||||
#
|
||||
# Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||
# 2017-02-22
|
||||
#
|
||||
# Collect coverage data during tests
|
||||
#phpunit.withCoverage = true
|
||||
|
||||
# Path of the PHPUnit (https://phpunit.de)
|
||||
#
|
||||
phpUnit.path = ./vendor/bin/phpunit
|
||||
|
||||
# Path of the PHP Coding Standards Fixer (http://cs.sensiolabs.org)
|
||||
#
|
||||
phpCsFixer.path = ./vendor/bin/php-cs-fixer
|
||||
tests.framework.path = ./vendor/bin/phpunit --verbose --no-coverage
|
||||
230
phing/tests.xml
Normal file
230
phing/tests.xml
Normal file
@@ -0,0 +1,230 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.14.0">
|
||||
<!--
|
||||
The AutoloaderTask is required to load binaries installed by Composer.
|
||||
The "autoloaderpath" attribute of this task is not required, because it's default value is: vendor/autoload.php.
|
||||
|
||||
Meritoo <github@meritoo.pl>
|
||||
2017-02-23
|
||||
-->
|
||||
<autoloader/>
|
||||
|
||||
<!-- Properties -->
|
||||
<if>
|
||||
<available file="phing/properties" property="custom.properties.available"/>
|
||||
<then>
|
||||
<property file="phing/properties"/>
|
||||
</then>
|
||||
<else>
|
||||
<property file="phing/properties.dist"/>
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<!-- Filesets -->
|
||||
<fileset id="sourcecode" dir="${dir.src}">
|
||||
<include name="**/*.php"/>
|
||||
<exclude name="*Test.php"/>
|
||||
<exclude name="**/*Test.php"/>
|
||||
<exclude name="**/Resources/**"/>
|
||||
<exclude name="**/DataFixtures/**"/>
|
||||
<exclude name="**/Tests/**"/>
|
||||
</fileset>
|
||||
<fileset id="tests" dir="${dir.tests}">
|
||||
<include name="**/*Test*.php"/>
|
||||
</fileset>
|
||||
|
||||
<!-- Default / main target -->
|
||||
<target name="build:main"
|
||||
depends="build:fix-coding-standards, build:clean, build:prepare, build:check, build:test, app:checkout"
|
||||
description="Runs all tests and builds everything"/>
|
||||
<!--
|
||||
Before:
|
||||
depends="build:fix-coding-standards, build:clean, build:prepare, build:check, build:test, build:doc, app:checkout"
|
||||
|
||||
After:
|
||||
depends="build:fix-coding-standards, build:clean, build:prepare, build:check, build:test, app:checkout"
|
||||
|
||||
The "build:doc" task is disabled, because it cannot be installed via Composer:
|
||||
a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2
|
||||
b) symfony/validator ~2.2 causes to remove symfony/symfony 3.*
|
||||
|
||||
Meritoo <github@meritoo.pl>
|
||||
2017-02-22
|
||||
-->
|
||||
|
||||
<!-- Fixing coding standards using the PHP Coding Standards Fixer (http://cs.sensiolabs.org) -->
|
||||
<target name="build:fix-coding-standards" description="Fixes coding standards using the PHP Coding Standards Fixer">
|
||||
<echo msg="Fixing coding standards using the PHP Coding Standards Fixer (http://cs.sensiolabs.org)..."/>
|
||||
|
||||
<!--
|
||||
Attention.
|
||||
Rules for formatting are defined in /.php_cs.dist file.
|
||||
-->
|
||||
|
||||
<exec
|
||||
passthru="true"
|
||||
command="${tests.cs_fixer.path} fix --verbose"
|
||||
/>
|
||||
</target>
|
||||
|
||||
<!-- Doc target -->
|
||||
<!--
|
||||
Disabled, because it cannot be installed via Composer:
|
||||
a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2
|
||||
b) symfony/validator ~2.2 causes to remove symfony/symfony 3.*
|
||||
|
||||
Meritoo <github@meritoo.pl>
|
||||
2017-02-22
|
||||
-->
|
||||
<!--<target name="build:doc"-->
|
||||
<!--depends="build:prepare, doc:phpdoc2"-->
|
||||
<!--description="Generates API documentation" />-->
|
||||
|
||||
<!-- Check target -->
|
||||
<target name="build:check"
|
||||
depends="check:cs, check:md, check:cpd, check:depend, check:loc"
|
||||
description="Analyzes code"/>
|
||||
|
||||
<!-- Test target -->
|
||||
<target name="build:test"
|
||||
depends="test:unit"
|
||||
description="Executes all tests"/>
|
||||
|
||||
<!-- Project build clean -->
|
||||
<target name="build:clean" description="Cleans up build directories">
|
||||
<echo msg="Cleaning docs and reports directories..."/>
|
||||
<!--<delete dir="${dir.docs}" />-->
|
||||
<delete dir="${dir.reports}"/>
|
||||
</target>
|
||||
|
||||
<!-- Project build prepare -->
|
||||
<target name="build:prepare" description="Create build directories">
|
||||
<echo msg="Creating build directories..."/>
|
||||
<!--<mkdir dir="${dir.docs}" />-->
|
||||
<!--<mkdir dir="${dir.docs.phpdoc2}" />-->
|
||||
<mkdir dir="${dir.reports}"/>
|
||||
<mkdir dir="${dir.reports.pdepend}"/>
|
||||
<mkdir dir="${dir.reports.coverage}"/>
|
||||
</target>
|
||||
|
||||
<!-- PHPDocumentor2 API documentation target -->
|
||||
<!--
|
||||
Disabled, because it cannot be installed via Composer:
|
||||
a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2
|
||||
b) symfony/validator ~2.2 causes to remove symfony/symfony 3.*
|
||||
|
||||
Meritoo <github@meritoo.pl>
|
||||
2017-02-22
|
||||
|
||||
<target name="doc:phpdoc2" description="Generates API documentations">
|
||||
<echo msg="Generating API Documentation with phpDocumentor 2..." />
|
||||
<phpdoc2 title="${phing.project.name}"
|
||||
destdir="${dir.docs.phpdoc2}"
|
||||
template="responsive">
|
||||
<fileset refid="sourcecode" />
|
||||
</phpdoc2>
|
||||
</target>
|
||||
-->
|
||||
|
||||
<!-- Symfony2 code sniffer -->
|
||||
<!--
|
||||
Attention 1.
|
||||
To use Symfony2 standards to check coding you have to:
|
||||
copy, symlink or check out repo to a folder called Symfony2 inside the phpcs Standards directory.
|
||||
|
||||
Example:
|
||||
$ pear config-show | grep php_dir
|
||||
$ cd /path/to/pear/PHP/CodeSniffer/Standards
|
||||
$ git clone git://github.com/opensky/Symfony2-coding-standard.git Symfony2
|
||||
|
||||
Attention 2.
|
||||
PSR2 standard is used instead of Symfony2 standard, because after installation squizlabs/php_codesniffer package
|
||||
via Composer the Symfony2 standard is not included / available in this package. In this case the PHP Coding
|
||||
Standards Fixer (http://cs.sensiolabs.org) is used.
|
||||
|
||||
Meritoo <github@meritoo.pl>
|
||||
2017-02-22
|
||||
-->
|
||||
<target name="check:cs" description="Checks coding standard">
|
||||
<echo msg="Checking coding standard..."/>
|
||||
<phpcodesniffer standard="PSR2" showWarnings="true">
|
||||
<fileset refid="sourcecode"/>
|
||||
<formatter type="checkstyle" outfile="${dir.reports}/checkstyle.xml"/>
|
||||
<formatter type="csv" outfile="${dir.reports}/checkstyle.csv"/>
|
||||
<formatter type="summary" outfile="${dir.reports}/checkstyle_summary.txt"/>
|
||||
</phpcodesniffer>
|
||||
</target>
|
||||
|
||||
<!-- copy/paste detector -->
|
||||
<target name="check:cpd" description="Checks similar code blocks.">
|
||||
<echo msg="Checking similar code blocks..."/>
|
||||
<phpcpd>
|
||||
<fileset refid="sourcecode"/>
|
||||
<formatter type="pmd" outfile="${dir.reports}/pmd-cpd.xml"/>
|
||||
</phpcpd>
|
||||
|
||||
<!--
|
||||
Previous / old version
|
||||
|
||||
Meritoo <github@meritoo.pl>
|
||||
2017-02-22
|
||||
|
||||
<exec command="phpcpd \-\-log-pmd=${dir.reports}/pmd-cpd.xml ${dir.src}" />
|
||||
-->
|
||||
</target>
|
||||
|
||||
<!-- Mess detector -->
|
||||
<target name="check:md" description="Generate code metrics">
|
||||
<echo msg="Generating code metrics..."/>
|
||||
<phpmd rulesets="codesize,controversial,design,naming,unusedcode">
|
||||
<fileset refid="sourcecode"/>
|
||||
<formatter type="html" outfile="${dir.reports}/phpmd.html"/>
|
||||
<formatter type="text" outfile="${dir.reports}/phpmd.txt"/>
|
||||
</phpmd>
|
||||
</target>
|
||||
|
||||
<!-- Code dependency -->
|
||||
<target name="check:depend" description="Checks coupling and dependency">
|
||||
<echo msg="Checking coupling and dependency..."/>
|
||||
<phpdepend>
|
||||
<fileset refid="sourcecode"/>
|
||||
<logger type="jdepend-xml" outfile="${dir.reports.pdepend}/jdepend.xml"/>
|
||||
<logger type="jdepend-chart" outfile="${dir.reports.pdepend}/dependencies.svg"/>
|
||||
<logger type="overview-pyramid" outfile="${dir.reports.pdepend}/overview-pyramid.svg"/>
|
||||
</phpdepend>
|
||||
</target>
|
||||
|
||||
<!-- Measure the size and analyzing the structure of a project -->
|
||||
<target name="check:loc" description="Measures the size and analyzes the structure of a project">
|
||||
<echo msg="Measuring the size and analyzing the structure of a project..."/>
|
||||
<phploc reportType="txt" reportName="phploc" reportDirectory="${dir.reports}">
|
||||
<fileset refid="sourcecode"/>
|
||||
</phploc>
|
||||
|
||||
<!--
|
||||
Previous / old version
|
||||
|
||||
Meritoo <github@meritoo.pl>
|
||||
2017-02-22
|
||||
|
||||
<exec command="phploc \-\-log-csv=${dir.reports}/phploc.csv ${dir.src}" />
|
||||
-->
|
||||
</target>
|
||||
|
||||
<!-- Unit tests -->
|
||||
<target name="test:unit" description="Runs unit tests">
|
||||
<echo msg="Running unit tests..."/>
|
||||
<exec command="${tests.framework.path}" passthru="true"/>
|
||||
</target>
|
||||
|
||||
<!-- Checkout and finalization -->
|
||||
<target name="app:checkout">
|
||||
<tstamp>
|
||||
<format property="date_end" pattern="%Y-%m-%d %H:%M"/>
|
||||
</tstamp>
|
||||
|
||||
<echo msg="--------------------------------------------"/>
|
||||
<echo msg="Build tests finished at: ${date_end}"/>
|
||||
<echo msg="--------------------------------------------"/>
|
||||
</target>
|
||||
</project>
|
||||
Reference in New Issue
Block a user