flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [8/8] git commit: [flex-utilities] [refs/heads/develop] - add output that looks more like Ant output
Date Tue, 24 Dec 2013 06:48:47 GMT
add output that looks more like Ant output


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

Branch: refs/heads/develop
Commit: e4f33bbca81a99387153ada7ce2938763ac95036
Parents: da4707d
Author: Alex Harui <aharui@apache.org>
Authored: Mon Dec 23 22:48:05 2013 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Mon Dec 23 22:48:05 2013 -0800

----------------------------------------------------------------------
 ant_on_air/build.xml                            |  2 ++
 ant_on_air/locale/en_US/ant.properties          | 30 ++++++++++++++++++++
 ant_on_air/src/org/apache/flex/ant/Ant.as       |  9 ++++++
 ant_on_air/src/org/apache/flex/ant/tags/Copy.as | 14 +++++++++
 .../src/org/apache/flex/ant/tags/Delete.as      | 14 +++++++--
 ant_on_air/src/org/apache/flex/ant/tags/Echo.as |  2 +-
 ant_on_air/src/org/apache/flex/ant/tags/Get.as  |  8 ++++++
 .../src/org/apache/flex/ant/tags/Input.as       |  6 ++--
 .../src/org/apache/flex/ant/tags/Mkdir.as       |  5 ++++
 .../src/org/apache/flex/ant/tags/Target.as      |  1 +
 .../src/org/apache/flex/ant/tags/Touch.as       |  8 +++++-
 .../src/org/apache/flex/ant/tags/Untar.as       |  9 +++++-
 .../src/org/apache/flex/ant/tags/Unzip.as       |  7 +++++
 .../tags/supportClasses/FileSetTaskHandler.as   |  7 +++++
 ant_on_air/tests/AntOnAir.mxml                  |  2 +-
 15 files changed, 116 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e4f33bbc/ant_on_air/build.xml
----------------------------------------------------------------------
diff --git a/ant_on_air/build.xml b/ant_on_air/build.xml
index 3f0997d..cc64242 100644
--- a/ant_on_air/build.xml
+++ b/ant_on_air/build.xml
@@ -97,6 +97,7 @@
             fork="true"
             maxmemory="512m">
             <source-path path-element="${SOURCE_DIR}"/>
+            <source-path path-element="${basedir}/locale/{locale}"/>
 			<load-config filename="${FLEX_HOME}/frameworks/air-config.xml"/>
             <external-library-path file="${AIR_HOME}/frameworks/libs/air/airglobal.swc"
append="true"/>
             <external-library-path file="${basedir}/../installer/libs" append="true"/>
@@ -125,6 +126,7 @@
             maxmemory="512m">
 			<load-config filename="${FLEX_HOME}/frameworks/air-config.xml"/>
             <source-path path-element="${SOURCE_DIR}"/>
+            <source-path path-element="${basedir}/locale/{locale}"/>
             <library-path file="${basedir}/../installer/libs" append="true"/>
 		</mxmlc>
         <delete dir="${basedir}/tests/temp" failonerror="false" />

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e4f33bbc/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
new file mode 100644
index 0000000..a6a352c
--- /dev/null
+++ b/ant_on_air/locale/en_US/ant.properties
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+
+MKDIR=Created dir: %1
+COPY=Copying %1 file to %2
+COPYFILES=Copying %1 files to %2
+DELETEFILE=Deleting: %1
+DELETEDIR=Deleting directory %1
+GETTING=Getting: %1
+GETTO=To: %1
+TOUCH=Creating %1
+UNZIP=Expanding: %1 into %2
+

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e4f33bbc/ant_on_air/src/org/apache/flex/ant/Ant.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/Ant.as b/ant_on_air/src/org/apache/flex/ant/Ant.as
index 2dbfc8e..dc81fe2 100644
--- a/ant_on_air/src/org/apache/flex/ant/Ant.as
+++ b/ant_on_air/src/org/apache/flex/ant/Ant.as
@@ -191,6 +191,15 @@ package org.apache.flex.ant
             }
             return input;
         }
+		
+		public static const spaces:String = "           ";
+		
+		public function formatOutput(tag:String, data:String):String
+		{
+			var s:String = spaces.substr(0, Math.max(spaces.length - tag.length - 2, 0)) +
+				"[" + tag + "] " + data;
+			return s;
+		}
         
 		public static function log(s:String, level:int):void
 		{

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e4f33bbc/ant_on_air/src/org/apache/flex/ant/tags/Copy.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Copy.as b/ant_on_air/src/org/apache/flex/ant/tags/Copy.as
index 32f66c4..e279918 100644
--- a/ant_on_air/src/org/apache/flex/ant/tags/Copy.as
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Copy.as
@@ -21,11 +21,13 @@ package org.apache.flex.ant.tags
     import flash.filesystem.File;
     
     import mx.core.IFlexModuleFactory;
+    import mx.resources.ResourceManager;
     
     import org.apache.flex.ant.Ant;
     import org.apache.flex.ant.tags.supportClasses.FileSetTaskHandler;
     import org.apache.flex.xml.ITagHandler;
     
+	[ResourceBundle("ant")]
     [Mixin]
     public class Copy extends FileSetTaskHandler
     {
@@ -119,6 +121,14 @@ package org.apache.flex.ant.tags
             srcFile.copyTo(destFile, overwrite);
         }
         
+		override protected function outputTotal(total:int):void
+		{
+			var s:String = ResourceManager.getInstance().getString('ant', 'COPYFILES');
+			s = s.replace("%1", total.toString());
+			s = s.replace("%2", toDirName);
+			ant.output(ant.formatOutput("copy", s));
+		}
+		
         override public function execute(callbackMode:Boolean, context:Object):Boolean
         {
             var retVal:Boolean = super.execute(callbackMode, context);
@@ -131,6 +141,10 @@ 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');
+			s = s.replace("%1", "1");
+			s = s.replace("%2", destFile.nativePath);
+			ant.output(ant.formatOutput("copy", s));
             srcFile.copyTo(destFile, overwrite);
             return true;
         }

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e4f33bbc/ant_on_air/src/org/apache/flex/ant/tags/Delete.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Delete.as b/ant_on_air/src/org/apache/flex/ant/tags/Delete.as
index cae5795..d558e38 100644
--- a/ant_on_air/src/org/apache/flex/ant/tags/Delete.as
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Delete.as
@@ -21,10 +21,12 @@ package org.apache.flex.ant.tags
     import flash.filesystem.File;
     
     import mx.core.IFlexModuleFactory;
+    import mx.resources.ResourceManager;
     
     import org.apache.flex.ant.Ant;
     import org.apache.flex.ant.tags.supportClasses.FileSetTaskHandler;
     
+	[ResourceBundle("ant")]
     [Mixin]
     public class Delete extends FileSetTaskHandler
     {
@@ -61,21 +63,29 @@ package org.apache.flex.ant.tags
             else
                 delFile.deleteFile();
         }
-        
+		
         override public function execute(callbackMode:Boolean, context:Object):Boolean
         {
             var retVal:Boolean = super.execute(callbackMode, context);
             if (numChildren > 0)
                 return retVal;
-            
+
+			var s:String;
+			
             if (fileName)
             {
                 var delFile:File = File.applicationDirectory.resolvePath(fileName);
+				s = ResourceManager.getInstance().getString('ant', 'DELETEFILE');
+				s = s.replace("%1", delFile.nativePath);
+				ant.output(ant.formatOutput("delete", s));
                 delFile.deleteFile();
             }
             else if (dirName)
             {
                 var delDir:File = File.applicationDirectory.resolvePath(dirName);
+				s = ResourceManager.getInstance().getString('ant', 'DELETEDIR');
+				s = s.replace("%1", delDir.nativePath);
+				ant.output(ant.formatOutput("delete", s));
                 delDir.deleteDirectory(true);
             }            
             return true;

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e4f33bbc/ant_on_air/src/org/apache/flex/ant/tags/Echo.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Echo.as b/ant_on_air/src/org/apache/flex/ant/tags/Echo.as
index 349671c..2b17bf6 100644
--- a/ant_on_air/src/org/apache/flex/ant/tags/Echo.as
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Echo.as
@@ -72,7 +72,7 @@ package org.apache.flex.ant.tags
 				fs.close();
 			}
 			else
-	            ant.output(ant.getValue(text, context));
+	            ant.output(ant.formatOutput("echo", ant.getValue(text, context)));
             return true;
         }
     }

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e4f33bbc/ant_on_air/src/org/apache/flex/ant/tags/Get.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Get.as b/ant_on_air/src/org/apache/flex/ant/tags/Get.as
index 80ad7c3..fc15729 100644
--- a/ant_on_air/src/org/apache/flex/ant/tags/Get.as
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Get.as
@@ -31,10 +31,12 @@ package org.apache.flex.ant.tags
     import flash.utils.ByteArray;
     
     import mx.core.IFlexModuleFactory;
+    import mx.resources.ResourceManager;
     
     import org.apache.flex.ant.Ant;
     import org.apache.flex.ant.tags.supportClasses.TaskHandler;
     
+	[ResourceBundle("ant")]
     [Mixin]
     public class Get extends TaskHandler
     {
@@ -75,6 +77,12 @@ package org.apache.flex.ant.tags
                 if (destFile.exists)
                     return true;
             }
+			var s:String = ResourceManager.getInstance().getString('ant', 'GETTING');
+			s = s.replace("%1", src);
+			ant.output(ant.formatOutput("get", s));
+			s = ResourceManager.getInstance().getString('ant', 'GETTO');
+			s = s.replace("%1", getDestFile().nativePath);
+			ant.output(ant.formatOutput("get", s));
             
             urlLoader = new URLLoader();
             urlLoader.load(new URLRequest(src));

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e4f33bbc/ant_on_air/src/org/apache/flex/ant/tags/Input.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Input.as b/ant_on_air/src/org/apache/flex/ant/tags/Input.as
index 3d90ba6..f5808f4 100644
--- a/ant_on_air/src/org/apache/flex/ant/tags/Input.as
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Input.as
@@ -64,10 +64,12 @@ package org.apache.flex.ant.tags
         override public function execute(callbackMode:Boolean, context:Object):Boolean
         {
             super.execute(callbackMode, context);
+			var s:String = "";
             if (text)
-                ant.output(ant.getValue(text, context));
+                s += ant.getValue(text, context);
             if (validArgs)
-                ant.output("[" + validArgs + "]");
+                s += " (" + validArgs + ")";
+			ant.output(ant.formatOutput("input", s));
             ant.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
             return false;
         }

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e4f33bbc/ant_on_air/src/org/apache/flex/ant/tags/Mkdir.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Mkdir.as b/ant_on_air/src/org/apache/flex/ant/tags/Mkdir.as
index 1ff1c09..2751e45 100644
--- a/ant_on_air/src/org/apache/flex/ant/tags/Mkdir.as
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Mkdir.as
@@ -21,10 +21,12 @@ package org.apache.flex.ant.tags
     import flash.filesystem.File;
     
     import mx.core.IFlexModuleFactory;
+	import mx.resources.ResourceManager;
     
     import org.apache.flex.ant.Ant;
     import org.apache.flex.ant.tags.supportClasses.TaskHandler;
     
+	[ResourceBundle("ant")]
     [Mixin]
     public class Mkdir extends TaskHandler
     {
@@ -50,6 +52,9 @@ package org.apache.flex.ant.tags
             var dir:File = new File(_dir);
             dir.createDirectory();
             
+			var s:String = ResourceManager.getInstance().getString('ant', 'MKDIR');
+			s = s.replace("%1", dir.nativePath);
+			ant.output(ant.formatOutput("mkdir", s));
             return true;
         }
         

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e4f33bbc/ant_on_air/src/org/apache/flex/ant/tags/Target.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Target.as b/ant_on_air/src/org/apache/flex/ant/tags/Target.as
index b61eb10..327760e 100644
--- a/ant_on_air/src/org/apache/flex/ant/tags/Target.as
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Target.as
@@ -114,6 +114,7 @@ package org.apache.flex.ant.tags
         {
             if (!ant.project.status)
                 return true;
+			ant.output("\n" + name + ":");
             return processSteps();
         }
         

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e4f33bbc/ant_on_air/src/org/apache/flex/ant/tags/Touch.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Touch.as b/ant_on_air/src/org/apache/flex/ant/tags/Touch.as
index e898cc3..8ee1a0c 100644
--- a/ant_on_air/src/org/apache/flex/ant/tags/Touch.as
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Touch.as
@@ -23,10 +23,12 @@ package org.apache.flex.ant.tags
     import flash.filesystem.FileStream;
     
     import mx.core.IFlexModuleFactory;
+    import mx.resources.ResourceManager;
     
     import org.apache.flex.ant.Ant;
     import org.apache.flex.ant.tags.supportClasses.TaskHandler;
     
+	[ResourceBundle("ant")]
     [Mixin]
     public class Touch extends TaskHandler
     {
@@ -44,7 +46,11 @@ package org.apache.flex.ant.tags
             super.execute(callbackMode, context);
 			
             var f:File = new File(fileName);
-            var fs:FileStream = new FileStream();
+			var s:String = ResourceManager.getInstance().getString('ant', 'TOUCH');
+			s = s.replace("%1", f.nativePath);
+			ant.output(ant.formatOutput("touch", s));
+
+			var fs:FileStream = new FileStream();
             fs.open(f, FileMode.APPEND);
             fs.close();
             return true;

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e4f33bbc/ant_on_air/src/org/apache/flex/ant/tags/Untar.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Untar.as b/ant_on_air/src/org/apache/flex/ant/tags/Untar.as
index fd9458c..dd228fb 100644
--- a/ant_on_air/src/org/apache/flex/ant/tags/Untar.as
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Untar.as
@@ -27,10 +27,12 @@ package org.apache.flex.ant.tags
     import flash.system.Capabilities;
     
     import mx.core.IFlexModuleFactory;
+    import mx.resources.ResourceManager;
     
     import org.apache.flex.ant.Ant;
     import org.apache.flex.ant.tags.supportClasses.TaskHandler;
     
+	[ResourceBundle("ant")]
     [Mixin]
     public class Untar extends TaskHandler
     {
@@ -93,7 +95,12 @@ package org.apache.flex.ant.tags
             startupInfo.executable = tar;
             startupInfo.arguments = arguments;
             
-            _process = new NativeProcess();
+			var s:String = ResourceManager.getInstance().getString('ant', 'UNZIP');
+			s = s.replace("%1", source.nativePath);
+			s = s.replace("%2", destFile.nativePath);
+			ant.output(ant.formatOutput("untar", s));
+
+			_process = new NativeProcess();
             _process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, unTarFileProgress);
             _process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, unTarError);
             _process.addEventListener(NativeProcessExitEvent.EXIT, unTarComplete);

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e4f33bbc/ant_on_air/src/org/apache/flex/ant/tags/Unzip.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Unzip.as b/ant_on_air/src/org/apache/flex/ant/tags/Unzip.as
index 959eca9..009d29b 100644
--- a/ant_on_air/src/org/apache/flex/ant/tags/Unzip.as
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Unzip.as
@@ -26,6 +26,7 @@ package org.apache.flex.ant.tags
     import flash.utils.ByteArray;
     
     import mx.core.IFlexModuleFactory;
+    import mx.resources.ResourceManager;
     
     import org.apache.flex.ant.Ant;
     import org.apache.flex.ant.tags.supportClasses.TaskHandler;
@@ -34,6 +35,7 @@ package org.apache.flex.ant.tags
     import org.as3commons.zip.ZipEvent;
     import org.as3commons.zip.ZipFile;
     
+	[ResourceBundle("ant")]
     [Mixin]
     public class Unzip extends TaskHandler
     {
@@ -85,6 +87,11 @@ package org.apache.flex.ant.tags
             var srcFile:File = File.applicationDirectory.resolvePath(src);
             destFile = File.applicationDirectory.resolvePath(dest);
 
+			var s:String = ResourceManager.getInstance().getString('ant', 'UNZIP');
+			s = s.replace("%1", srcFile.nativePath);
+			s = s.replace("%2", destFile.nativePath);
+			ant.output(ant.formatOutput("unzip", s));
+			
             unzip(srcFile);
             return true;
         }

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e4f33bbc/ant_on_air/src/org/apache/flex/ant/tags/supportClasses/FileSetTaskHandler.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/supportClasses/FileSetTaskHandler.as
b/ant_on_air/src/org/apache/flex/ant/tags/supportClasses/FileSetTaskHandler.as
index d9d449b..5e1f1c8 100644
--- a/ant_on_air/src/org/apache/flex/ant/tags/supportClasses/FileSetTaskHandler.as
+++ b/ant_on_air/src/org/apache/flex/ant/tags/supportClasses/FileSetTaskHandler.as
@@ -75,10 +75,17 @@ package org.apache.flex.ant.tags.supportClasses
                     }
                 }
             }
+			if (numChildren)
+				outputTotal(totalFiles);
             actOnFileSets();
             return !callbackMode;
         }
         
+		protected function outputTotal(total:int):void
+		{
+			
+		}
+		
         private function actOnFileSets():void
         {
             if (current == numChildren)

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e4f33bbc/ant_on_air/tests/AntOnAir.mxml
----------------------------------------------------------------------
diff --git a/ant_on_air/tests/AntOnAir.mxml b/ant_on_air/tests/AntOnAir.mxml
index a19c4fa..040b923 100644
--- a/ant_on_air/tests/AntOnAir.mxml
+++ b/ant_on_air/tests/AntOnAir.mxml
@@ -140,6 +140,6 @@ limitations under the License.
     <s:layout>
         <s:VerticalLayout />
     </s:layout>
-    <mx:TextArea id="console" width="100%" height="100%" />
+    <mx:TextArea id="console" width="100%" height="100%" fontFamily="Courier New" />
     <mx:ProgressBar id="pb" width="100%" mode="event" label="" />
 </s:WindowedApplication>
\ No newline at end of file


Mime
View raw message