<?xml version="1.0" encoding="UTF-8"?>
<project name="MySQL Draw" description="Generate a diagram from your MySQL database" default="help" phingVersion="3">
<property name="dc.project-name" value="mysql-draw"/>
<property name="db.database" value="${dc.project-name}"/>
<property name="db.password" value="groot"/>
<property name="db.user" value="groot"/>
<property name="app.version" value="dev"/>
<target name="setup" depends="composer:install-dev,dc:up,dc:ip"/>
<target name="qa" depends="composer:validate,composer:normalize,php:lint,phpstan:analyse"/>
<target name="phar" depends="composer:install-prod,phar:build,composer:install-dev"/>
<target name="composer:install-dev" description="PHP dependencies">
<composer command="install">
<arg value="--no-interaction"/>
<arg value="--prefer-dist"/>
<arg value="--no-progress"/>
<arg value="--ansi"/>
</composer>
</target>
<target name="composer:install-prod" description="PHP dependencies">
<composer command="install">
<arg value="--no-interaction"/>
<arg value="--prefer-dist"/>
<arg value="--no-progress"/>
<arg value="--ansi"/>
<arg value="--no-dev"/>
<arg value="--optimize-autoloader"/>
<arg value="--classmap-authoritative"/>
</composer>
</target>
<target name="phar:build" description="Create phar file">
<mkdir dir="resources/build/"/>
<pharpackage basedir="." stub="bin/stub.php" alias="mysql-draw" compression="gzip"
destfile="resources/build/mysql-draw.phar">
<fileset dir=".">
<include name="src/**/*.php"/>
<include name="vendor/**/*.php"/>
<include name="composer.json"/>
</fileset>
<metadata>
<element name="version" value="${app.version}"/>
<element name="authors">
<element name="Jawira Portugal">
<element name="e-mail" value="dev@tugal.be"/>
</element>
</element>
</metadata>
</pharpackage>
<chmod file="resources/build/mysql-draw.phar" mode="0775" failonerror="true"/>
</target>
<target name="composer:validate" description="Validate composer.json">
<composer command="validate">
<arg value="--ansi"/>
</composer>
</target>
<target name="composer:normalize" description="Normalize composer.json">
<composer command="normalize">
<arg value="--ansi"/>
<arg value="--diff"/>
<arg value="--indent-size=2"/>
<arg value="--indent-style=space"/>
</composer>
</target>
<target name="php:lint" description="Validate PHP syntax">
<phplint>
<fileset dir=".">
<include name="bin/*.php"/>
<include name="src/*.php"/>
</fileset>
</phplint>
</target>
<target name="help">
<uptodate property="uptodate.visualizer" srcfile="build.xml" targetfile="build.svg"/>
<runtarget target="visualizer"/>
<open path="build.svg"/>
</target>
<target name="visualizer" unless="uptodate.visualizer" description="Create buildfile map">
<visualizer format="svg"/>
</target>
<target name="dc:up" description="Launch containers">
<exec executable="docker-compose" passthru="true" checkreturn="true">
<arg line="--project-name ${dc.project-name}"/>
<arg value="up"/>
<arg value="--detach"/>
<arg value="--remove-orphans"/>
</exec>
</target>
<target name="dc:stop" description="Stop containers">
<exec executable="docker-compose" passthru="true">
<arg line="--project-name ${dc.project-name}"/>
<arg value="stop"/>
</exec>
</target>
<target name="dc:down" description="Take down containers, networks, images, and volumes">
<exec executable="docker-compose" passthru="true">
<arg line="--project-name ${dc.project-name}"/>
<arg value="down"/>
<arg value="--volumes"/>
<arg value="--remove-orphans"/>
</exec>
</target>
<target name="dc:ip" description="Reveal containers ip addresses">
<property name="dc.format"
value="--format='{{ .Name }}{{"\t"}}{{range .NetworkSettings.Networks}}{{.IPAddress}}{{"\t"}}{{end}}'"/>
<exec executable="docker" checkreturn="true" passthru="true">
<arg value="inspect"/>
<arg line="${dc.format}"/>
<arg value="${dc.project-name}_employees_1"/>
<arg value="${dc.project-name}_sakila_1"/>
</exec>
</target>
<target name="phpstan:analyse" description="Analyse at max level">
<exec executable="vendor/bin/phpstan" passthru="true" checkreturn="true">
<arg value="analyse"/>
<arg line="--level=max"/>
<arg value="--no-progress"/>
<arg value="--no-interaction"/>
<arg value="--ansi"/>
<arg path="src"/>
</exec>
</target>
</project>
|