flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [4/4] git commit: [flex-utilities] [refs/heads/develop] - add move task
Date Sun, 05 Jan 2014 06:32:59 GMT
add move task


Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/e5fea860
Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/e5fea860
Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/e5fea860

Branch: refs/heads/develop
Commit: e5fea860d8a611f499df0e548e7ff8389cf1aa9e
Parents: 5d5d00f
Author: Alex Harui <aharui@apache.org>
Authored: Sat Jan 4 22:32:29 2014 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Sat Jan 4 22:32:29 2014 -0800

----------------------------------------------------------------------
 ant_on_air/locale/en_US/ant.properties          |  2 ++
 ant_on_air/src/org/apache/flex/ant/tags/Move.as | 23 ++++++++++++++------
 ant_on_air/tests/test.xml                       | 12 +++++-----
 3 files changed, 24 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e5fea860/ant_on_air/locale/en_US/ant.properties
----------------------------------------------------------------------
diff --git a/ant_on_air/locale/en_US/ant.properties b/ant_on_air/locale/en_US/ant.properties
index a6a352c..317dcee 100644
--- a/ant_on_air/locale/en_US/ant.properties
+++ b/ant_on_air/locale/en_US/ant.properties
@@ -21,6 +21,8 @@
 MKDIR=Created dir: %1
 COPY=Copying %1 file to %2
 COPYFILES=Copying %1 files to %2
+MOVE=Moving %1 file to %2
+MOVEFILES=Moving %1 files to %2
 DELETEFILE=Deleting: %1
 DELETEDIR=Deleting directory %1
 GETTING=Getting: %1

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e5fea860/ant_on_air/src/org/apache/flex/ant/tags/Move.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Move.as b/ant_on_air/src/org/apache/flex/ant/tags/Move.as
index 3b403cc..244e4ce 100644
--- a/ant_on_air/src/org/apache/flex/ant/tags/Move.as
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Move.as
@@ -149,10 +149,10 @@ package org.apache.flex.ant.tags
         
         override protected function outputTotal(total:int):void
         {
-            var s:String = ResourceManager.getInstance().getString('ant', 'COPYFILES');
+            var s:String = ResourceManager.getInstance().getString('ant', 'MOVEFILES');
             s = s.replace("%1", total.toString());
             s = s.replace("%2", toDirName);
-            ant.output(ant.formatOutput("copy", s));
+            ant.output(ant.formatOutput("move", s));
         }
         
         override public function execute(callbackMode:Boolean, context:Object):Boolean
@@ -173,12 +173,21 @@ package org.apache.flex.ant.tags
                 return true;							
             }
             
+            var destFileName:String;
+            if (toDirName)
+            {
+                var stem:String = srcFile.nativePath.substr(srcFile.parent.nativePath.length);
+                destFileName = toDirName + stem;
+            }
+            else
+                destFileName = toFileName;
+            
             try {
-                var destFile:File = File.applicationDirectory.resolvePath(toFileName);
+                var destFile:File = File.applicationDirectory.resolvePath(destFileName);
             } 
             catch (e:Error)
             {
-                ant.output(toFileName);
+                ant.output(destFileName);
                 ant.output(e.message);
                 if (failonerror)
                     ant.project.status = false;
@@ -189,11 +198,11 @@ package org.apache.flex.ant.tags
             //var resolveName:String = destFile.nativePath.substr(destFile.nativePath.lastIndexOf(File.separator)
+ 1);
             //destDir.resolvePath(resolveName);
             
-            var s:String = ResourceManager.getInstance().getString('ant', 'COPY');
+            var s:String = ResourceManager.getInstance().getString('ant', 'MOVE');
             s = s.replace("%1", "1");
             s = s.replace("%2", destFile.nativePath);
-            ant.output(ant.formatOutput("copy", s));
-            srcFile.copyTo(destFile, overwrite);
+            ant.output(ant.formatOutput("move", s));
+            srcFile.moveTo(destFile, overwrite);
             return true;
         }
     }

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e5fea860/ant_on_air/tests/test.xml
----------------------------------------------------------------------
diff --git a/ant_on_air/tests/test.xml b/ant_on_air/tests/test.xml
index ecc57ca..ebf9d0f 100644
--- a/ant_on_air/tests/test.xml
+++ b/ant_on_air/tests/test.xml
@@ -107,14 +107,14 @@
             </condition>
         </fail>
         <echo>Project.as ${project.doesnt.exist}. Should say: got copied</echo>
-        <delete file="${basedir}/temp/copied.xml" />
-        <available file="${basedir}/temp/copied.xml" property="copied.doesnt.exist.after.delete"
value="didn't get deleted" />
-        <fail message="temp/copied.xml was not deleted">
+        <delete file="${basedir}/temp/moved.xml" />
+        <available file="${basedir}/temp/moved.xml" property="moved.doesnt.exist.after.delete"
value="didn't get deleted" />
+        <fail message="temp/moved.xml was not deleted">
             <condition>
-                <available file="${basedir}/temp/copied.xml" />
+                <available file="${basedir}/temp/moved.xml" />
             </condition>
         </fail>
-        <echo>copied.xml ${copied.doesnt.exist.after.delete}. Should NOT say: didn't
get deleted</echo>
+        <echo>moved.xml ${moved.doesnt.exist.after.delete}. Should NOT say: didn't
get deleted</echo>
         <get src="http://archive.apache.org/dist/creadur/apache-rat-0.10/apache-rat-0.10-src.zip"
             dest="${basedir}/temp" />
         <fail message="apache-rat-0.10-src.zip was not copied to temp">
@@ -244,7 +244,7 @@
         </fail>
         <delete dir="${basedir}/temp" />
         <available file="${basedir}/temp/Zorg/apache/flex/ant/tags/Project.as" property="project.doesnt.exist.after.delete"
value="didn't get deleted" />
-        <fail message="temp/copied.xml was not deleted">
+        <fail message="temp/Project.as was not deleted">
             <condition>
                 <available file="${basedir}/temp/Zorg/apache/flex/ant/tags/Project.as"
/>
             </condition>


Mime
View raw message