MonarcAppBO/build.xml

118 lines
5.8 KiB
XML
Raw Normal View History

2016-10-06 11:19:13 +02:00
<project name="MonarcAppBO" default="help" basedir=".">
<property file="./build.properties" />
<target name="help" description="List available targets">
<exec executable="vendor/bin/phing"
passthru="true">
<arg value="-l"/>
</exec>
</target>
<target name="setup-npm" description="Setup NPM config">
<move file="${project.basedir}/package.json" tofile="${project.basedir}/package.json.bak" overwrite="true"/>
<loadfile property="npm.config" file="${project.basedir}/package.json.continuousphp">
<filterchain>
<replacetokens>
<token key="github.token" value="${env.GITHUB_TOKEN}"/>
</replacetokens>
</filterchain>
</loadfile>
<echo message="${npm.config}" file="${project.basedir}/package.json"/>
</target>
<target name="post-install" description="Post install">
<exec command="scripts/post-install.sh"
passthru="true"
checkreturn="true"/>
</target>
<target name="remove-npm-config" description="Remove NPM config">
<delete file="${project.basedir}/package.json" quiet="true"/>
<move file="${project.basedir}/package.json.bak" tofile="${project.basedir}/package.json" overwrite="true"/>
</target>
<target name="setup-db" description="Setup Database Credentials">
2016-11-02 13:05:57 +01:00
<echo msg="Loading file ${project.basedir}/config/autoload/database.local.php.dist" />
2016-10-06 16:13:21 +02:00
<loadfile property="db.config" file="${project.basedir}/config/autoload/database.local.php.dist">
2016-10-06 11:19:13 +02:00
<filterchain>
<replacetokens>
<token key="db.host" value="${db.host}"/>
<token key="db.username" value="${db.username}"/>
<token key="db.password" value="${db.password}"/>
2016-11-02 10:09:27 +01:00
<token key="db.name.backoffice" value="${db.name.backoffice}"/>
2016-11-02 12:41:08 +01:00
<token key="db.name.core" value="${db.name.core}"/>
2016-10-06 11:19:13 +02:00
</replacetokens>
</filterchain>
</loadfile>
2016-11-02 13:05:57 +01:00
<echo msg="Writing file ${project.basedir}/config/autoload/database.local.php" />
2016-10-06 16:13:21 +02:00
<echo message="${db.config}" file="${project.basedir}/config/autoload/database.local.php"/>
2016-10-06 11:19:13 +02:00
</target>
<target name="setup-languages" description="Setup Languages">
2016-11-07 09:50:23 +01:00
<echo msg="Loading file ${project.basedir}/config/autoload/languages.local.php.dist" />
2016-10-06 16:13:21 +02:00
<loadfile property="languages.config" file="${project.basedir}/config/autoload/languages.local.php.dist">
2016-10-06 11:19:13 +02:00
<!-- PLACE YOUR FILE MODIFICATIONS HERE -->
</loadfile>
2016-11-07 09:50:23 +01:00
<echo msg="Writing file ${project.basedir}/config/autoload/languages.local.php" />
2016-10-06 16:13:21 +02:00
<echo message="${languages.config}" file="${project.basedir}/config/autoload/languages.local.php"/>
2016-10-06 11:19:13 +02:00
</target>
<target name="setup-application" description="Setup Application config">
2017-02-09 13:05:41 +01:00
<loadfile property="app.config" file="/config/application.config.php">
2016-10-06 11:19:13 +02:00
<!-- PLACE YOUR FILE MODIFICATIONS HERE -->
</loadfile>
2016-10-06 11:38:12 +02:00
<echo message="${app.config}" file="${project.basedir}/config/application.config.php"/>
2016-10-06 11:19:13 +02:00
</target>
<target name="setup-sec-auth" description="Setup Security and Authentication">
2016-11-07 09:20:35 +01:00
<echo msg="Loading file ${project.basedir}/config/autoload/security-authentication.local.php.dist" />
2016-10-06 11:38:12 +02:00
<loadfile property="sec.config" file="${project.basedir}/config/autoload/security-authentication.local.php.dist">
2016-10-06 11:19:13 +02:00
<filterchain>
<replacetokens>
<token key="monarc.ttl" value="${monarc.ttl}"/>
<token key="monarc.salt" value="${monarc.salt}"/>
</replacetokens>
</filterchain>
</loadfile>
2016-11-07 09:20:35 +01:00
<echo msg="Writing file ${project.basedir}/config/autoload/security-authentication.local.php" />
2016-10-06 11:38:12 +02:00
<echo message="${sec.config}" file="${project.basedir}/config/autoload/security-authentication.local.php"/>
2016-10-06 11:19:13 +02:00
</target>
<target name="drop-db">
<echo file="${project.basedir}/drop.sql">DROP DATABASE IF EXISTS `${db.name}`;</echo>
<pdosqlexec url="mysql:host=${db.host}" userid="${db.username}" password="${db.password}">
<transaction src="${project.basedir}/drop.sql"/>
</pdosqlexec>
<delete file="${project.basedir}/drop.sql" quiet="true"/>
</target>
<target name="init-db" description="Create Database and Grants">
<echo file="${project.basedir}/create.sql">
CREATE DATABASE IF NOT EXISTS ${db.name};
GRANT USAGE ON *.* TO '${db.username}'@'%' IDENTIFIED BY '${db.password}';
GRANT UPDATE,CREATE,REFERENCES,ALTER,LOCK TABLES,CREATE VIEW,CREATE
ROUTINE,TRIGGER,INSERT,DELETE,DROP,INDEX,CREATE TEMPORARY TABLES,EXECUTE,SHOW VIEW,ALTER ROUTINE,SELECT ON
`${db.name}`.* TO '${db.username}'@'%';
</echo>
<pdosqlexec url="mysql:host=${db.host}" userid="${db.username}" password="${db.password}">
<transaction src="${project.basedir}/create.sql"/>
</pdosqlexec>
<delete file="${project.basedir}/create.sql" quiet="true"/>
</target>
<target name="db-migration" description="Update the database version">
2016-11-02 10:09:27 +01:00
<exec command="${project.basedir}/scripts/client-upgrade-db.sh backoffice ${db.host} ${db.username} ${db.password} ${db.name.backoffice}" passthru="true"/>
<exec command="${project.basedir}/scripts/client-upgrade-db.sh core ${db.host} ${db.username} ${db.password} ${db.name.core}" passthru="true"/>
2016-10-06 11:19:13 +02:00
</target>
<target name="reset-db"
description="Drop database and reset data"
depends="drop-db, init-db, db-migration"/>
2016-10-06 13:29:55 +02:00
<target name="init"
description="Setup external dependencies and migrate data"
2016-11-07 09:50:23 +01:00
depends="setup-languages, setup-sec-auth, setup-db, db-migration"/>
2016-10-06 11:19:13 +02:00
</project>