marcelog/PAGI

View on GitHub
build.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0"?>
<project
  name="pagi"
  default="build"
  basedir="."
  description="PAGI Asterisk Gateway Interface (AGI) client for PHP">

  <target name="install">
    <exec command="./composer.phar install" checkreturn="true" passthru="true"/>
    <exec command="./composer.phar update" checkreturn="true" passthru="true"/>
  </target>

  <target name="clean">
    <delete dir="build"/>
  </target>

  <target name="prepare">
    <mkdir dir="build" mode="0755"/>
    <mkdir dir="build/doc" mode="0755"/>
    <mkdir dir="build/doc/xml" mode="0755"/>
    <mkdir dir="build/doc/html" mode="0755"/>
    <mkdir dir="build/doc/md" mode="0755"/>
    <mkdir dir="build/logs" mode="0755"/>
    <mkdir dir="build/coverage-html" mode="0755"/>
  </target>

  <target name="cpd">
    <exec command="vendor/bin/phpcpd --fuzzy src"
      checkreturn="true"
      passthru="true"/>
  </target>

  <target name="md">
    <exec command="vendor/bin/phpmd ./src text cleancode,codesize,controversial,design,naming,unusedcode"
      checkreturn="false"
      passthru="true"/>
  </target>

  <target name="cs">
    <exec command="vendor/bin/phpcs --standard=PSR2 src/*"
      checkreturn="true"
      passthru="true"/>
  </target>

  <target name="docxml">
    <exec command="vendor/bin/phpdoc --template=xml -t build/doc/xml -d src --validate --sourcecode --force --log"
      checkreturn="true"
      passthru="true"/>
  </target>

  <target name="dochtml">
    <exec command="vendor/bin/phpdoc -t build/doc/html -d src --validate --sourcecode --force --log"
      checkreturn="true"
      passthru="true"/>
  </target>

  <target name="docmd">
    <exec dir="build/doc/md" command="../../../vendor/bin/phpdocmd ../xml/structure.xml"
      checkreturn="true"
      passthru="true"/>
    <copy todir="doc" overwrite="true">
      <fileset dir="build/doc/md">
        <include name="*.md" />
      </fileset>
    </copy>
  </target>

  <target name="test">
    <exec command="vendor/bin/phpunit -v --debug -c test/resources/phpunit.xml"
      checkreturn="true"
      passthru="true"/>
  </target>

  <target name="build" depends="clean, prepare, cpd, cs, md, doc, test"/>
  <target name="doc" depends="docxml, dochtml, docmd"/>

</project>