Created
January 30, 2013 15:08
-
-
Save alejandrobernardis/4673882 to your computer and use it in GitHub Desktop.
Otro build más~
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <project name="com-ak-geisha" basedir="." default="deploy"> | |
| <!-- == properties ============================================================================================= --> | |
| <property file="${basedir}/build.properties" /> | |
| <!-- == macros ================================================================================================= --> | |
| <macrodef name="common.date"> | |
| <sequential> | |
| <tstamp> | |
| <format property="build.datetime.uid" pattern="yyyyMMddHHmmss" unit="minute" locale="en" /> | |
| <format property="build.datetime" pattern="yyyy/MM/dd HH:mm:ss" unit="minute" locale="en" /> | |
| </tstamp> | |
| </sequential> | |
| </macrodef> | |
| <macrodef name="common.compress"> | |
| <attribute name="file" default="" /> | |
| <attribute name="input" default="" /> | |
| <attribute name="output" default="" /> | |
| <attribute name="excludes" default="" /> | |
| <sequential> | |
| <mkdir dir="@{output}" /> | |
| <zip destfile="@{output}/@{file}"> | |
| <fileset dir="@{input}" excludes="@{excludes}" /> | |
| </zip> | |
| </sequential> | |
| </macrodef> | |
| <macrodef name="common.backup"> | |
| <attribute name="file" default="" /> | |
| <attribute name="input" default="" /> | |
| <attribute name="output" default="${dir.backup}" /> | |
| <attribute name="excludes" default="" /> | |
| <sequential> | |
| <mkdir dir="@{output}" /> | |
| <common.data /> | |
| <common.compress excludes="@{excludes}" file="${build.datetime.uid}-@{file}.zip" input="@{input}" output="@{output}" /> | |
| </sequential> | |
| </macrodef> | |
| <macrodef name="common.manifest.create"> | |
| <attribute name="file" default="${dir.deploy}/MANIFEST" /> | |
| <sequential> | |
| <common.date /> | |
| <manifest file="@{file}"> | |
| <attribute name="Created-By" value="${project.copyright} of ${project.author}" /> | |
| <attribute name="Project-Name" value="${project.name}" /> | |
| <attribute name="Project-FullName" value="${project.fullname}" /> | |
| <attribute name="Project-Version" value="${build.version}" /> | |
| <attribute name="Built-By" value="${project.author}" /> | |
| <attribute name="Built-Date" value="${TODAY}" /> | |
| </manifest> | |
| </sequential> | |
| </macrodef> | |
| <!-- =========================================================================================================== --> | |
| <macrodef name="compile.less"> | |
| <attribute name="output" default="${dir.public}" /> | |
| <attribute name="include" default="${compile.include.less}" /> | |
| <attribute name="exclude" default="${compile.exclude.less}" /> | |
| <sequential> | |
| <apply executable="${exec.node}" parallel="false"> | |
| <fileset dir="@{output}" includes="@{include}" excludes="@{exclude}"/> | |
| <arg path="${compile.less}" /> | |
| <srcfile /> | |
| <mapper type="glob" from="*.less" to="@{output}/*.css" /> | |
| <targetfile /> | |
| </apply> | |
| </sequential> | |
| </macrodef> | |
| <macrodef name="compress.html"> | |
| <attribute name="output" default="${dir.deploy}" /> | |
| <attribute name="include" default="${compress.include.html}" /> | |
| <attribute name="exclude" default="${compress.exclude.html}" /> | |
| <sequential> | |
| <apply executable="${exec.java}" parallel="false"> | |
| <fileset dir="@{output}" includes="@{include}" excludes="@{exclude}"/> | |
| <arg line="-jar" /> | |
| <arg path="${compress.html}" /> | |
| <arg line="--compress-js" /> | |
| <arg line="--compress-css" /> | |
| <arg line="--output" /> | |
| <mapper type="glob" from="*.html" to="@{output}/*-min.html" /> | |
| <targetfile /> | |
| <srcfile /> | |
| </apply> | |
| <move todir="@{output}" overwrite="true"> | |
| <fileset dir="@{output}" /> | |
| <mapper type="glob" from="*-min.html" to="*.html" /> | |
| </move> | |
| </sequential> | |
| </macrodef> | |
| <macrodef name="compress.css"> | |
| <attribute name="output" default="${dir.deploy}" /> | |
| <attribute name="include" default="${compress.include.css}" /> | |
| <attribute name="exclude" default="${compress.exclude.css}" /> | |
| <sequential> | |
| <apply executable="${exec.java}" parallel="false"> | |
| <fileset dir="@{output}" includes="@{include}" excludes="@{exclude}"/> | |
| <arg line="-jar" /> | |
| <arg path="${compress.css}" /> | |
| <arg line="-v" /> | |
| <srcfile /> | |
| <arg line="-o" /> | |
| <mapper type="glob" from="*.css" to="@{output}/*-min.css" /> | |
| <targetfile /> | |
| </apply> | |
| <move todir="@{output}" overwrite="true"> | |
| <fileset dir="@{output}" /> | |
| <mapper type="glob" from="*-min.css" to="*.css" /> | |
| </move> | |
| </sequential> | |
| </macrodef> | |
| <macrodef name="compress.js"> | |
| <attribute name="output" default="${dir.deploy}" /> | |
| <attribute name="include" default="${compress.include.js}" /> | |
| <attribute name="exclude" default="${compress.exclude.js}" /> | |
| <sequential> | |
| <apply executable="${exec.java}" parallel="false"> | |
| <fileset dir="@{output}" includes="@{include}" excludes="@{exclude}"/> | |
| <arg line="-jar" /> | |
| <arg path="${compress.js}" /> | |
| <arg line="--compilation_level" /> | |
| <arg line="SIMPLE_OPTIMIZATIONS" /> | |
| <arg line="--language_in" /> | |
| <arg line="ECMASCRIPT5_STRICT" /> | |
| <arg line="--js" /> | |
| <srcfile /> | |
| <arg line="--js_output_file" /> | |
| <mapper type="glob" from="*.js" to="@{output}/*-min.js" /> | |
| <targetfile /> | |
| </apply> | |
| <move todir="@{output}" overwrite="true"> | |
| <fileset dir="@{output}" /> | |
| <mapper type="glob" from="*-min.js" to="*.js" /> | |
| </move> | |
| </sequential> | |
| </macrodef> | |
| <macrodef name="validate.js"> | |
| <attribute name="output" default="${dir.public}" /> | |
| <attribute name="include" default="${compress.include.js}" /> | |
| <attribute name="exclude" default="${compress.exclude.js}" /> | |
| <sequential> | |
| <apply executable="${exec.python}" parallel="false"> | |
| <fileset dir="@{output}" includes="@{include}" excludes="@{exclude}"/> | |
| <arg path="${validator.js}" /> | |
| <arg line="--nojsdoc" /> | |
| <srcfile /> | |
| </apply> | |
| </sequential> | |
| </macrodef> | |
| <!-- =========================================================================================================== --> | |
| <macrodef name="hg.status"> | |
| <sequential> | |
| <exec executable="hg" dir="${basedir}"> | |
| <arg line="status" /> | |
| </exec> | |
| </sequential> | |
| </macrodef> | |
| <macrodef name="hg.commit"> | |
| <sequential> | |
| <exec executable="hg" dir="${basedir}"> | |
| <arg line="commit" /> | |
| <arg line="-A" /> | |
| <arg line="-m" /> | |
| <arg line="'Fixes/Update.-'" /> | |
| </exec> | |
| </sequential> | |
| </macrodef> | |
| <macrodef name="hg.push"> | |
| <sequential> | |
| <exec executable="hg" dir="${basedir}"> | |
| <arg line="push" /> | |
| </exec> | |
| </sequential> | |
| </macrodef> | |
| <!-- =========================================================================================================== --> | |
| <macrodef name="deploy.prepare"> | |
| <attribute name="input" default="" /> | |
| <attribute name="output" default="${dir.deploy}" /> | |
| <sequential> | |
| <delete dir="@{output}" /> | |
| <mkdir dir="@{output}" /> | |
| <deploy.prepare.config /> | |
| <deploy.prepare.httpdocs /> | |
| <deploy.prepare.backoffice /> | |
| </sequential> | |
| </macrodef> | |
| <macrodef name="deploy.prepare.config"> | |
| <attribute name="input" default="${dir.config}" /> | |
| <attribute name="output" default="${dir.deploy}" /> | |
| <sequential> | |
| <copy todir="@{output}" verbose="true"> | |
| <fileset dir="@{input}" excludes="${deploy.excludes},${deploy.excludes.config}" /> | |
| </copy> | |
| <move file="@{output}${remote.path.vhosts}/${local.domain}" tofile="@{output}${remote.path.vhosts}/${remote.domain}" verbose="true"/> | |
| <replace file="@{output}/etc/supervisord/backoffice.supervisor"> | |
| <replacefilter token="{{remote.path.backoffice}}" value="${remote.path.backoffice}" /> | |
| </replace> | |
| <replace file="@{output}/root/bash_profile"> | |
| <replacefilter token="{{remote.domain}}" value="${remote.domain}" /> | |
| <replacefilter token="{{remote.databse.username}}" value="${remote.databse.username}" /> | |
| <replacefilter token="{{remote.databse.password}}" value="${remote.databse.password}" /> | |
| </replace> | |
| </sequential> | |
| </macrodef> | |
| <macrodef name="deploy.prepare.httpdocs"> | |
| <attribute name="input" default="${dir.public}" /> | |
| <attribute name="output" default="${dir.deploy}" /> | |
| <attribute name="include" default="" /> | |
| <sequential> | |
| <property name="output.httpdocs" value="@{output}${remote.path.httpdocs}" /> | |
| <copy todir="${output.httpdocs}" verbose="true"> | |
| <fileset dir="@{input}" includes="@{include}" excludes="${deploy.excludes}" /> | |
| </copy> | |
| </sequential> | |
| </macrodef> | |
| <macrodef name="deploy.prepare.backoffice"> | |
| <attribute name="input.src" default="${dir.source}" /> | |
| <attribute name="input.lib" default="${dir.library}" /> | |
| <attribute name="input.task" default="${dir.binary}" /> | |
| <attribute name="output" default="${dir.deploy}" /> | |
| <attribute name="exclude" default="${deploy.excludes},${deploy.excludes.backoffice}" /> | |
| <sequential> | |
| <property name="output.backoffice" value="@{output}${remote.path.backoffice}" /> | |
| <copy todir="${output.backoffice}/apps" verbose="true"> | |
| <fileset dir="@{input.src}" excludes="@{exclude}" /> | |
| </copy> | |
| <copy todir="${output.backoffice}/libs" verbose="true"> | |
| <fileset dir="@{input.lib}" excludes="@{exclude}" /> | |
| </copy> | |
| <copy todir="${output.backoffice}/tasks" verbose="true"> | |
| <fileset dir="@{input.task}" excludes="@{exclude}" /> | |
| </copy> | |
| </sequential> | |
| </macrodef> | |
| <!-- == targets ================================================================================================ --> | |
| <!-- deploy --> | |
| <target name="deploy-prepare" depends="compile-less"> | |
| <deploy.prepare /> | |
| </target> | |
| <target name="deploy-minify"> | |
| <compress.html /> | |
| <compress.css /> | |
| <compress.js /> | |
| </target> | |
| <target name="deploy-clean"> | |
| <delete dir="${dir.deploy}" /> | |
| </target> | |
| <target name="deploy" depends="deploy-prepare,deploy-minify"> | |
| <common.manifest.create /> | |
| </target> | |
| <!-- deploy.compress --> | |
| <target name="deploy-compress-html"> | |
| <compress.html /> | |
| </target> | |
| <target name="deploy-compress-css"> | |
| <compress.css /> | |
| </target> | |
| <target name="deploy-compress-js"> | |
| <compress.js /> | |
| </target> | |
| <target name="deploy-compress" depends="deploy-compress-html,deploy-compress-css,deploy-compress-js" /> | |
| <!-- deploy.config --> | |
| <target name="deploy-config"> | |
| <deploy.prepare.config /> | |
| </target> | |
| <!-- deploy.httpdocs --> | |
| <target name="deploy-httpdocs-html"> | |
| <deploy.prepare.httpdocs include="${compress.include.html}" /> | |
| <compress.html output="${remote.path.httpdocs}" /> | |
| </target> | |
| <target name="deploy-httpdocs-css"> | |
| <compile.less output="${dir.public}" /> | |
| <deploy.prepare.httpdocs include="${compress.include.css}" /> | |
| <compress.css output="${remote.path.httpdocs}" /> | |
| </target> | |
| <target name="deploy-httpdocs-js"> | |
| <deploy.prepare.httpdocs include="${compress.include.js}" /> | |
| <compress.js output="${remote.path.httpdocs}" /> | |
| </target> | |
| <target name="deploy-httpdocs" depends="deploy-httpdocs-html,deploy-httpdocs-css,deploy-httpdocs-js" /> | |
| <!-- deploy.public --> | |
| <target name="deploy-backoffice-html"> | |
| <deploy.prepare.backoffice include="${compress.include.html}" /> | |
| <compress.html output="${remote.path.backoffice}" /> | |
| </target> | |
| <target name="deploy-backoffice-css"> | |
| <compile.less output="${dir.source}" /> | |
| <deploy.prepare.backoffice include="${compress.include.css}" /> | |
| <compress.css output="${remote.path.backoffice}" /> | |
| </target> | |
| <target name="deploy-backoffice-js"> | |
| <deploy.prepare.backoffice include="${compress.include.js}" /> | |
| <compress.js output="${remote.path.backoffice}" /> | |
| </target> | |
| <target name="deploy-backoffice" depends="deploy-backoffice-html,deploy-backoffice-css,deploy-backoffice-js" /> | |
| <!-- tools --> | |
| <target name="validate-js"> | |
| <validate.js /> | |
| </target> | |
| <target name="compile-less"> | |
| <compile.less output="${dir.public}" /> | |
| <compile.less output="${dir.source}" /> | |
| </target> | |
| <!-- version --> | |
| <target name="commit"> | |
| <hg.status /> | |
| <hg.commit /> | |
| </target> | |
| <target name="commit-push" depends="commit"> | |
| <hg.push /> | |
| </target> | |
| </project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment