ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r326636 - in /ant/core/trunk: docs/manual/CoreTasks/ src/etc/testcases/taskdefs/ src/testcases/org/apache/tools/ant/taskdefs/
Date Wed, 19 Oct 2005 18:37:23 GMT
Author: bodewig
Date: Wed Oct 19 11:37:15 2005
New Revision: 326636

URL: http://svn.apache.org/viewcvs?rev=326636&view=rev
Log:
more docs and tests

Modified:
    ant/core/trunk/docs/manual/CoreTasks/unpack.html
    ant/core/trunk/docs/manual/CoreTasks/unzip.html
    ant/core/trunk/src/etc/testcases/taskdefs/bunzip2.xml
    ant/core/trunk/src/etc/testcases/taskdefs/gunzip.xml
    ant/core/trunk/src/etc/testcases/taskdefs/untar.xml
    ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/BUnzip2Test.java
    ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/GUnzipTest.java
    ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/UntarTest.java

Modified: ant/core/trunk/docs/manual/CoreTasks/unpack.html
URL: http://svn.apache.org/viewcvs/ant/core/trunk/docs/manual/CoreTasks/unpack.html?rev=326636&r1=326635&r2=326636&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/unpack.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/unpack.html Wed Oct 19 11:37:15 2005
@@ -56,6 +56,31 @@
 <p>expands <i>test.tar.gz</i> to <i>subdir/test.tar</i> (assuming
 subdir is a directory).</p>
 
+<h3>Related tasks</h3>
+
+<pre>
+&lt;gunzip src="some-archive.gz" dest="some-dest-dir"/&gt;
+</pre>
+
+is identical to
+
+<pre>
+&lt;copy todir="some-dest-dir"&gt;
+  &lt;gzipresource&gt;
+    &lt;file file="some-archive.gz"/&gt;
+  &lt;/gzipresource&gt;
+  &lt;mapper type="glob" from="*.gz" to="*"/&gt;
+&lt;/copy&gt;
+</pre>
+
+<p>The same is also true for <code>&lt;bunzip2&gt;</code> and
+<code>&lt;bzip2resource&gt;</code>.  <code>&lt;copy&gt;</code>
offers
+additional features like <a
+href="../CoreTypes/filterchains.html">filtering files</a> on the fly,
+allowing a file to be mapped to multiple destinations, preserving the
+last modified time or a configurable file system timestamp
+granularity.</p>
+
 <hr>
 <p align="center">Copyright &copy; 2000-2001,2004-2005 The Apache Software Foundation.
All rights
 Reserved.</p>

Modified: ant/core/trunk/docs/manual/CoreTasks/unzip.html
URL: http://svn.apache.org/viewcvs/ant/core/trunk/docs/manual/CoreTasks/unzip.html?rev=326636&r1=326635&r2=326636&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/unzip.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/unzip.html Wed Oct 19 11:37:15 2005
@@ -117,6 +117,38 @@
     &lt;mapper type=&quot;flatten&quot;/&gt;
 &lt;/unzip&gt;
 </pre>
+
+<h3>Related tasks</h3>
+
+<pre>
+&lt;unzip src="some-archive" dest="some-dir"&lt;
+  &lt;patternset&gt;
+    &lt;include name="some-pattern"/&gt;
+  &lt;/patternset&gt;
+  &lt;mapper type=&quot;some-mapper&quot;/&gt;
+&lt;/unzip&gt;
+</pre>
+
+is identical to
+
+<pre>
+&lt;copy todir="some-dir" preservelastmodified="true"&lt;
+  &lt;zipfileset src="some-archive"&gt;
+    &lt;patternset&gt;
+      &lt;include name="some-pattern"/&gt;
+    &lt;/patternset&gt;
+  &lt;/zipfileset&gt;
+  &lt;mapper type=&quot;some-mapper&quot;/&gt;
+&lt;/copy&gt;
+</pre>
+
+<p>The same is also true for <code>&lt;untar&gt;</code> and
+<code>&lt;tarfileset&gt;</code>.  <code>&lt;copy&gt;</code>
offers
+additional features like <a
+href="../CoreTypes/filterchains.html">filtering files</a> on the fly,
+allowing a file to be mapped to multiple destinations or a
+configurable file system timestamp granularity.</p>
+
 <hr>
 <p align="center">Copyright &copy; 2000-2005 The Apache Software Foundation. All
rights
 Reserved.</p>

Modified: ant/core/trunk/src/etc/testcases/taskdefs/bunzip2.xml
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/etc/testcases/taskdefs/bunzip2.xml?rev=326636&r1=326635&r2=326636&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/bunzip2.xml (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/bunzip2.xml Wed Oct 19 11:37:15 2005
@@ -14,4 +14,13 @@
   <target name="prepare">
     <gunzip src="expected/asf-logo-huge.tar.gz"/>
   </target>
+
+  <target name="testDocumentationClaimsOnCopy">
+    <copy todir=".">
+      <bzip2resource>
+        <file file="expected/asf-logo-huge.tar.bz2"/>
+      </bzip2resource>
+      <mapper type="glob" from="*.bz2" to="*"/>
+    </copy>
+  </target>
 </project>

Modified: ant/core/trunk/src/etc/testcases/taskdefs/gunzip.xml
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/etc/testcases/taskdefs/gunzip.xml?rev=326636&r1=326635&r2=326636&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/gunzip.xml (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/gunzip.xml Wed Oct 19 11:37:15 2005
@@ -24,4 +24,13 @@
     <gunzip src="expected/asf-logo.gif.gz" dest="asf-logo.gif" />
   </target>
 
+  <target name="testDocumentationClaimsOnCopy">
+    <copy todir=".">
+      <gzipresource>
+        <file file="expected/asf-logo.gif.gz"/>
+      </gzipresource>
+      <mapper type="glob" from="*.gz" to="*"/>
+    </copy>
+  </target>
+
 </project>

Modified: ant/core/trunk/src/etc/testcases/taskdefs/untar.xml
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/etc/testcases/taskdefs/untar.xml?rev=326636&r1=326635&r2=326636&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/untar.xml (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/untar.xml Wed Oct 19 11:37:15 2005
@@ -4,6 +4,8 @@
 
   <target name="cleanup">
     <delete file="asf-logo.gif" />
+    <delete file="untartest.tar" />
+    <delete dir="untartestin"/>
     <delete dir="untartestout"/>
   </target>
 
@@ -59,4 +61,26 @@
       </zipfileset>
     </untar>
   </target>
+
+  <target name="prepareTestTar">
+    <mkdir dir="untartestin/1"/>
+    <mkdir dir="untartestin/2"/>
+    <touch file="untartestin/1/foo"/>
+    <touch file="untartestin/2/bar"/>
+    <copy todir="untartestin/2">
+      <fileset dir="expected" includes="*md5*"/>
+    </copy>
+    <tar destfile="untartest.tar" basedir="untartestin"/>
+  </target>
+
+  <target name="testDocumentationClaimsOnCopy" depends="prepareTestTar">
+    <copy todir="untartestout" preservelastmodified="true"> 
+      <tarfileset src="untartest.tar">
+        <patternset>
+          <include name="2/"/>
+        </patternset>
+      </tarfileset>
+    </copy>
+  </target>
+  
 </project>

Modified: ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/BUnzip2Test.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/BUnzip2Test.java?rev=326636&r1=326635&r2=326636&view=diff
==============================================================================
--- ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/BUnzip2Test.java (original)
+++ ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/BUnzip2Test.java Wed Oct 19
11:37:15 2005
@@ -48,4 +48,11 @@
             FILE_UTILS.contentEquals(project.resolveFile("expected/asf-logo-huge.tar"),
                                     project.resolveFile("asf-logo-huge.tar")));
     }
+
+    public void testDocumentationClaimsOnCopy() throws java.io.IOException {
+        executeTarget("testDocumentationClaimsOnCopy");
+        assertTrue("File content mismatch after bunzip2",
+            FILE_UTILS.contentEquals(project.resolveFile("expected/asf-logo-huge.tar"),
+                                    project.resolveFile("asf-logo-huge.tar")));
+    }
 }

Modified: ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/GUnzipTest.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/GUnzipTest.java?rev=326636&r1=326635&r2=326636&view=diff
==============================================================================
--- ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/GUnzipTest.java (original)
+++ ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/GUnzipTest.java Wed Oct 19
11:37:15 2005
@@ -58,4 +58,9 @@
                                            project.resolveFile("asf-logo.gif")));
     }
 
+    public void testDocumentationClaimsOnCopy() throws java.io.IOException {
+        executeTarget("testDocumentationClaimsOnCopy");
+        assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"),
+                                           project.resolveFile("asf-logo.gif")));
+    }
 }

Modified: ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/UntarTest.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/UntarTest.java?rev=326636&r1=326635&r2=326636&view=diff
==============================================================================
--- ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/UntarTest.java (original)
+++ ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/UntarTest.java Wed Oct 19 11:37:15
2005
@@ -82,4 +82,10 @@
         assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"),
                                            project.resolveFile("asf-logo.gif")));
     }
+
+    public void testDocumentationClaimsOnCopy() {
+        executeTarget("testDocumentationClaimsOnCopy");
+        assertFalse(getProject().resolveFile("untartestout/1/foo").exists());
+        assertTrue(getProject().resolveFile("untartestout/2/bar").exists());
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message