Skip to content

Instantly share code, notes, and snippets.

@mikedfunk
Created March 4, 2014 02:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mikedfunk/9339023 to your computer and use it in GitHub Desktop.
Save mikedfunk/9339023 to your computer and use it in GitHub Desktop.
<project name="Einstein2" default="build" basedir=".">
<property name="basedir" value="${project.basedir}" />
<property name="source" value="${basedir}/app"/>
<property name="php_bin_path" value="" />
<target name="clean" description="Clean up and create artifact directories">
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/build/code-browser"/>
<delete dir="${basedir}/build/coverage"/>
<delete dir="${basedir}/build/logs"/>
<delete dir="${basedir}/build/pdepend"/>
<delete dir="${basedir}/vendor"/>
<delete file="${basedir}/bootstrap/compiled.php"/>
<mkdir dir="${basedir}/build/api"/>
<mkdir dir="${basedir}/build/code-browser"/>
<mkdir dir="${basedir}/build/coverage"/>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/pdepend"/>
</target>
<target name="composer" description="Update composer packages with composer.phar">
<exec logoutput="true"
command="${php_bin_path}curl -sS https://getcomposer.org/installer | php" />
<exec logoutput="true"
command="${php_bin_path}php composer.phar install --dev" />
<exec logoutput="true"
command="rm composer.phar" />
</target>
<target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
<exec logoutput="true" checkreturn="true" command="${php_bin_path}phpunit --configuration=phpunit.xml" />
</target>
<target name="dump-cache" description="composer dump-autoload">
<exec logoutput="false" command="rm ${basedir}/bootstrap/compiled.php" />
<exec logoutput="true" checkreturn="true" command="composer dump-autoload" />
</target>
<target name="parallelTasks" description="Run the pdepend, phpmd, phpcpd, phpcs, phpdoc and phploc tasks in parallel using a maximum of 2 threads.">
<phingcall target="pdepend"/>
<phingcall target="phpmd"/>
<phingcall target="phpcpd"/>
<phingcall target="phpcs"/>
<phingcall target="phpdoc"/>
<phingcall target="phploc"/>
</target>
<target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend">
<exec logoutput="true"
command="${php_bin_path}pdepend --jdepend-xml=${basedir}/build/logs/jdepend.xml --jdepend-chart=${basedir}/build/pdepend/dependencies.svg --overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg ${source}" />
</target>
<target name="phpmd" description="Generate pmd.xml using PHPMD">
<exec logoutput="true" spawn="true"
command="${php_bin_path}phpmd ${source} xml phpmd.xml --ignore ${build_dir}/autocomplete,${build_dir}/database --reportfile ${basedir}/build/logs/pmd.xml" />
</target>
<target name="phpcpd" description="Generate pmd-cpd.xml using PHPCPD">
<exec logoutput="true"
command="${php_bin_path}phpcpd --log-pmd ${basedir}/build/logs/pmd-cpd.xml ${source}" />
</target>
<target name="phploc" description="Generate phploc.csv">
<exec logoutput="true"
command="${php_bin_path}phploc --log-csv ${basedir}/build/logs/phploc.csv ${source}" />
</target>
<target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer">
<exec logoutput="true"
command="${php_bin_path}phpcs --report=checkstyle --report-file=${basedir}/build/logs/checkstyle.xml --standard=PSR2 --ignore=config/*,database/*,models/User.php,lang/*,start/*,storage/*,views/*,filters.php,routes.php,autocomplete/*,tests/TestCase.php ${source}" />
</target>
<target name="phpdoc" description="Generate API documentation using PHPDoc">
<exec logoutput="true"
command="phpdoc --directory ${source} --target ${basedir}/build/api --title ${phing.project.name}" />
</target>
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
<exec logoutput="true"
command="${php_bin_path}phpcb --log ${basedir}/build/logs --source ${source} --output ${basedir}/build/code-browser" />
</target>
<target name="build" depends="clean,composer,parallelTasks,phpunit,phpcb"/>
<target name="test" depends="dump-cache,phpunit" />
<target name="migrate" depends="dump-cache">
<exec logoutput="true" command="${php_bin_path}php artisan migrate --bench='einstein/item'" />
<exec logoutput="true" command="${php_bin_path}php artisan migrate --bench='einstein/product'" />
<exec logoutput="true" command="${php_bin_path}php artisan migrate --bench='einstein/service'" />
<exec logoutput="true" command="${php_bin_path}php artisan migrate --bench='einstein/batch'" />
<exec logoutput="true" command="${php_bin_path}php artisan migrate --bench='einstein/template'" />
<exec logoutput="true" command="${php_bin_path}php artisan migrate --bench='einstein/imprint'" />
<exec logoutput="true" command="${php_bin_path}php artisan migrate" />
</target>
<target name="seed" depends="dump-cache,migrate">
<exec logoutput="true" command="${php_bin_path}php artisan db:seed" />
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment