Created
March 20, 2011 15:07
-
-
Save garethr/878364 to your computer and use it in GitHub Desktop.
Sample ant build file for running rsync and scp base flat file deployment
This file contains 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="{{ name }}" default="help" basedir="."> | |
<property name="username" value="{{ username }}"/> | |
<property name="host" value="{{ host }}"/> | |
<property name="dir" value="/srv/{{ path }}/"/> | |
<tstamp> | |
<format property="TODAY_UK" pattern="yyyyMMddhhmmss" locale="en,UK"/> | |
</tstamp> | |
<target name="help" description="show available commands" > | |
<exec executable="ant" dir="." failonerror="true"> | |
<arg value="-p"/> | |
</exec> | |
</target> | |
<target name="deploy-to" description="show where we are deploying to" > | |
<echo>${username}@${host}:${dir}</echo> | |
</target> | |
<target name="deploy" description="deploy usng rsync" > | |
<exec executable="rsync" dir="." failonerror="true"> | |
<arg value="-r"/> | |
<arg value="."/> | |
<arg value="${username}@${host}:${dir}"/> | |
<arg value="--exclude-from=rsync.excludes"/> | |
<arg value="-v"/> | |
</exec> | |
</target> | |
<target name="deploy-test" description="test deploy usng rsync with the dry run flag set" > | |
<exec executable="rsync" dir="." failonerror="true"> | |
<arg value="-r"/> | |
<arg value="."/> | |
<arg value="${username}@${host}:${dir}"/> | |
<arg value="--exclude-from=rsync.excludes"/> | |
<arg value="--dry-run"/> | |
<arg value="-v"/> | |
</exec> | |
</target> | |
<target name="backup" description="backup site" > | |
<exec executable="scp" dir="." failonerror="true"> | |
<arg value="-r"/> | |
<arg value="${username}@${host}:${dir}"/> | |
<arg value="backups/${TODAY_UK}"/> | |
</exec> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that the {{ value }} parts need substituting for actual values.