Skip to content

Instantly share code, notes, and snippets.

@juokaz
Created February 19, 2011 18:35
Show Gist options
  • Save juokaz/835251 to your computer and use it in GitHub Desktop.
Save juokaz/835251 to your computer and use it in GitHub Desktop.
<?xml version="1.0"?>
<project name="" default="empty" basedir=".">
<description>W</description>
<property file="config.properties"/>
<target name="empty">
<echo>Please choose what to deploy: all, nginx, website</echo>
</target>
<target name="all" depends="nginx, copy">
</target>
<target name="website" depends="sshconfig, copy">
<scp todir="${deploy.username}@${deploy.host}:${deploy.url}" keyfile="${user.home}/.ssh/id_rsa" passphrase="${passphrase}">
<fileset dir="${temp.dir}">
</fileset>
</scp>
<delete dir="${temp.dir}"/>
</target>
<target name="nginx" depends="sshconfig">
<scp file="nginx" remoteTofile="${deploy.username}@${deploy.host}:${deploy.nginx}" keyfile="${user.home}/.ssh/id_rsa" passphrase="${passphrase}" />
<sshexec host="${deploy.host}" username="${deploy.username}" keyfile="${user.home}/.ssh/id_rsa" passphrase="${passphrase}" command="sudo /etc/init.d/nginx restart"/>
</target>
<target name="sshconfig">
<input message="Please enter private key username:" addproperty="passphrase">
<handler classname="org.apache.tools.ant.input.SecureInputHandler" />
</input>
</target>
<target name="copy">
<mkdir dir="${temp.dir}"/>
<copy todir="${temp.dir}/">
<fileset dir=".">
<exclude name="**/${temp.dir}" />
<exclude name="build.xml" />
<exclude name="config.properties" />
<exclude name="nginx" />
</fileset>
</copy>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment