Ah ha - that's the ticket.  Never noticed the function
property::get-value.

 

I'd prefer to design scripts that don't require this construct, but from
time to time, this facilitates a level of abstraction and reuse that can
reduce the size of my scripts a good deal.

 

Thanks,

 

Ken Parrish

Gomez, Inc.

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Roebuck,
Alex
Sent: Thursday, June 05, 2008 4:05 AM
To: nant-users@lists.sourceforge.net
Subject: Re: [NAnt-users] Property values as a property name ...

 

Try this:

 

      <property name="destination" value="PROD"/>
      <property name="PRODDirectories"
value="//TPNDC1AS01/wwwroot,//TPNDC1AS02/wwwroot,//TPNDC1AS03/wwwroot"/>

      <target name="directoryTest" >

            <!--
                  Construct the name of property to access
            -->
            <property name="destDirsName"
value="${destination}Directories"/>  <!-- I have corrected property name
-->

            <!--
                  Fetch the property represented by the value of the
name:
            -->   
            <property name="destDirs"
value="${property::get-value(destDirsName)}"/>         

            <foreach item="String" property="deployDir" in="${destDirs}"
delim="," >
                  <echo message="deployDir = ${deployDir}" />
            </foreach>
      
      </target>

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Parrish,
Ken
Sent: Wednesday, June 04, 2008 7:44 PM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] Property values as a property name ...

 

Is there any way in Nant to use the value of one property as the name of
another property?

 

Here is a sketch of what I want to do, but this will not parse/compile:

 

      <property name="destination" value="PROD"/>
      <property name="PRODDirectories"
value="//TPNDC1AS01/wwwroot,//TPNDC1AS02/wwwroot,//TPNDC1AS03/wwwroot"/>

      <target name="directoryTest" >

            <!--
                  Construct the name of property to access
            -->
            <property name="destinationDirsName"
value="${destination}Directories"/>

            <!--
                  Fetch the property represented by the value of the
name:
            -->   
            <property name="destDirs" value="${ ${destDirsName} }"/>
<!-- Doesn't parse/compile. -->

            <foreach item="String" property="deployDir" in="${destDirs}"
delim="," >
                  <echo message="deployDir = ${deployDir}" />
            </foreach>
      
      </target>

 

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to