ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jamie Jackson" <myspa...@gmail.com>
Subject Re: Trying to do things the "Ant way"
Date Fri, 28 Jul 2006 22:28:38 GMT
I'm trying these things out as you folks suggest them. Your latest
suggestion meets my original requirements (fleshed out below... I'm open to
further comments), but Andrew's point about scalability is well taken, so
I'm going to make a decision based on a few factors.

Thanks again Dominque and Andrew, I would have never gotten to this point by
myself. :-D

Jamie

  <macrodef name="deploy">
    <attribute name="environment" />
    <attribute name="basepath" default="${@{environment}.basepath}" />
    <attribute name="proj.wwwroot" default="${@{environment}.proj.wwwroot}"
/>
    <attribute name="transfertype" default="${@{environment}.transfertype}"
/>
    <sequential>
        <echo>basepath=@{basepath} proj.wwwroot=@{proj.wwwroot}
transfertype=@{transfertype} environment=@{environment}</echo>
        <ac:if>
            <equals arg1="@{transfertype}" arg2="ssh" />
            <then>
                <echo>gonna do ssh</echo>
                <property name="@{environment}.rync-args" value="-e ssh
-Cacvz ${local.buildDir}/ @{basepath}/@{proj.wwwroot}" />
            </then>
            <else>
                <echo>gonna do nfs</echo>
                <property name="@{environment}.rync-args" value="-av ${
local.buildDir}/ @{basepath}/@{proj.wwwroot}/" />
            </else>
        </ac:if>
        <echo message="rsync ${@{environment}.rync-args}" />
        <echo>about to do the rysnc now</echo>
        <!--
        <exec executable="rsync">
            <arg line="${args}" />
        </exec>
        -->
    </sequential>
</macrodef>

<target name="deploy-integ">
    <echo>I'm doing the integ deployment</echo>
    <deploy environment="integ" />
</target>

<target name="deploy-stage">
    <echo>I'm doing the stage deployment</echo>
    <deploy environment="stage" basepath="${stage.basepath}" proj.wwwroot=
"${stage.proj.wwwroot}" transfertype="${stage.transfertype}" />
</target>

<target name="deploy-prod">
    <echo>I'm doing the prod deployment</echo>
    <deploy environment="prod" basepath="${prod.basepath}" proj.wwwroot="${
prod.proj.wwwroot}" transfertype="${prod.transfertype}" />
</target>

<target name="deploy-all" depends="deploy-integ,deploy-stage,deploy-prod">
    <echo>deploying all</echo>
</target>


On 7/28/06, Dominique Devienne <ddevienne@gmail.com> wrote:
>
> > I think you've misunderstood what I intended the "build-all" task to
> mean.
>
> I think you're right. I've misunderstood the problem. Now that I think
> I do, I probably would have gone with <ac:if> <then> NFS... </then>
> <else> SSH </else> </ac:if> wrapped in a <macrodef>. Something
like:
>
> macro deploy
>   attr server
>   attr deploy-type defaults to ${@{server}.deploy-type}
>   sequential
>     ac:if ... then NFS else SSH
>
> In your properties file, you can have:
>
> server1.ip = ...
> server1.deploy-type = ssh
>
> server2.ip = ...
> server2.deploy-type = nfs
>
> See, no <antcall> ;-)
>
> I think the ${@{server}.deploy-type} default atrtibute value trick
> works, but my Ant is getting rusty since I don't use it, so I may be
> wrong...
>
> >    <property file="$environment}.properties" />
>
> Watch out, missing { above.
>
> >    <taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask"
> />
> >    <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
>
> I'd advise you to use xmlns:ac="antlib:net.sf.antcontrib", which
> disambiguate where tasks are coming from (<ac:for> instead of <for>,
> etc...)
>
> I hope this helps. --DD
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message