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="[EMAIL PROTECTED]" />
   <attribute name="proj.wwwroot" default="[EMAIL PROTECTED]"
/>
   <attribute name="transfertype" default="[EMAIL PROTECTED]"
/>
   <sequential>
       <echo>[EMAIL PROTECTED] [EMAIL PROTECTED]
[EMAIL PROTECTED] [EMAIL PROTECTED]</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 [EMAIL PROTECTED]" />
       <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 <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED]
  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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to