You can use a task that I have published at my site, the write task.
Here is the page you can download it from and get documentation.

http://jayflowers.com/joomla/index.php?option=com_content&task=view&id=24&Itemid=51

Here is an example.  Notice that you can use filterchains with it and
optionally append to an existing file.

<target name="Private.Coverage.WriteConfiguration">
    <call target="Private.Coverage.GetConfigFile"/>

    <write file="${Private.Coverage.ConfigFile}" append="false">
      <text><![CDATA[<?xml version="1.0"?>
<CoverageConfiguration targetNamespace="urn:CoverageConfiguration">]]>
</text>
    </write>

    <foreach item="File" property="Private.Coverage.PrepareFor.AssemblyPath" >
      <in>
        <items refid="Coverage.Targets" />
      </in>
      <do>
        <write file="${Private.Coverage.ConfigFile}" append="true">
          <text>
            <![CDATA[<Assembly Owner="[EMAIL PROTECTED]"
Description="%Description%" AssemblyName="%AssemblyName%"
ReportDirectory="%ReportDirectory%"/>]]>
        </text>
        <filterchain>
          <replacestring from="%Description%"
to="${path::get-file-name-without-extension(Private.Coverage.PrepareFor.AssemblyPath)}"
/>
          <replacestring from="%AssemblyName%"
to="${string::to-lower(path::get-file-name(Private.Coverage.PrepareFor.AssemblyPath))}"
/>
          <replacestring from="%ReportDirectory%"
to="${Coverage.ReportFolder}" />
          </filterchain>
        </write>
      </do>
    </foreach>

    <write file="${Private.Coverage.ConfigFile}" append="true">
      <text><![CDATA[        <Asp Selected="false"/>
        <Services>
        </Services>
</CoverageConfiguration>]]>
</text>
    </write>
</target>

On 7/6/06, Bonio Lopez <[EMAIL PROTECTED]> wrote:
> Hi all,
> how do I write into a text file using nant?
> (use of <script> seems to be an overkill)
> Following code writes into standard output instead of into a file, no idea
> why.
>
> <exec
>                 program="echo"
>                 commandline="#blablablanalan"
>                 output="${project_dir}\somefile.txt"
>                 append="false"
>                 />
>
> <exec
>                 program="echo"
>                 commandline="otherblabla"
>                 output="${project_dir}\somefile.txt"
>                 append="true"
>                 />
>
>
>
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> NAnt-users mailing list
> NAnt-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nant-users
>


-- 
Jay Flowers
----------------------------------------------------------------------
http://jayflowers.com
---------------------------------------------------------------------

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to