flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From que...@apache.org
Subject [31/50] [abbrv] git commit: [flex-utilities] [refs/heads/as3httpclient-work] - AntOnAIR: added support for <replacetoken> and <replacevalue> tags that may be added as childre of the <replace> tag, similar to <replacefilter>. These tags make it possible t
Date Sun, 31 May 2015 22:19:13 GMT
AntOnAIR: added support for <replacetoken> and <replacevalue> tags that may be
added as childre of the <replace> tag, similar to <replacefilter>. These tags
make it possible to use CDATA and new lines in tokens and values.


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

Branch: refs/heads/as3httpclient-work
Commit: c45b078688dfcdc3c468af4c56983805987b24f6
Parents: 1a46b11
Author: Josh Tynjala <joshtynjala@gmail.com>
Authored: Fri Apr 24 15:15:22 2015 -0700
Committer: Josh Tynjala <joshtynjala@gmail.com>
Committed: Fri Apr 24 15:15:22 2015 -0700

----------------------------------------------------------------------
 .../src/org/apache/flex/ant/tags/Replace.as     | 25 +++++++++--
 .../org/apache/flex/ant/tags/ReplaceToken.as    | 44 ++++++++++++++++++++
 .../org/apache/flex/ant/tags/ReplaceValue.as    | 44 ++++++++++++++++++++
 ant_on_air/tests/test.xml                       | 23 +++++++++-
 4 files changed, 131 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/c45b0786/ant_on_air/src/org/apache/flex/ant/tags/Replace.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Replace.as b/ant_on_air/src/org/apache/flex/ant/tags/Replace.as
index 6a3cac1..0b7ff69 100644
--- a/ant_on_air/src/org/apache/flex/ant/tags/Replace.as
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Replace.as
@@ -26,6 +26,7 @@ package org.apache.flex.ant.tags
     
     import org.apache.flex.ant.Ant;
     import org.apache.flex.ant.tags.supportClasses.TaskHandler;
+    import org.apache.flex.xml.ITagHandler;
     
     [Mixin]
     public class Replace extends TaskHandler
@@ -89,10 +90,26 @@ package org.apache.flex.ant.tags
             {
                 for (var i:int = 0; i < numChildren; i++)
                 {
-                    var rf:ReplaceFilter = getChildAt(i) as ReplaceFilter;
-                    rf.setContext(context);
-                    tokens.push(rf.token);
-                    reps.push(rf.value);
+                    var child:ITagHandler = getChildAt(i);
+                    if(child is ReplaceFilter)
+                    {
+                        var rf:ReplaceFilter = child as ReplaceFilter;
+                        rf.setContext(context);
+                        tokens.push(rf.token);
+                        reps.push(rf.value);
+                    }
+                    else if(child is ReplaceToken)
+                    {
+                        var rt:ReplaceToken = child as ReplaceToken;
+                        rt.setContext(context);
+                        tokens.push(rt.text);
+                    }
+                    else if(child is ReplaceValue)
+                    {
+                        var rv:ReplaceValue = child as ReplaceValue;
+                        rv.setContext(context);
+                        reps.push(rv.text);
+                    }
                 }
             }
             var n:int = tokens.length;

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/c45b0786/ant_on_air/src/org/apache/flex/ant/tags/ReplaceToken.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/ReplaceToken.as b/ant_on_air/src/org/apache/flex/ant/tags/ReplaceToken.as
new file mode 100644
index 0000000..8bb811d
--- /dev/null
+++ b/ant_on_air/src/org/apache/flex/ant/tags/ReplaceToken.as
@@ -0,0 +1,44 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.ant.tags
+{
+	import mx.core.IFlexModuleFactory;
+	
+	import org.apache.flex.ant.Ant;
+	import org.apache.flex.ant.tags.supportClasses.TagHandler;
+	
+	[Mixin]
+	public class ReplaceToken extends TagHandler
+	{
+		public static function init(mf:IFlexModuleFactory):void
+		{
+			Ant.antTagProcessors["replacetoken"] = ReplaceToken;
+		}
+
+		public function ReplaceToken()
+		{
+			super();
+		}
+		
+		public function get text():String
+		{
+			return ant.getValue(xml.text().toString(), context);
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/c45b0786/ant_on_air/src/org/apache/flex/ant/tags/ReplaceValue.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/ReplaceValue.as b/ant_on_air/src/org/apache/flex/ant/tags/ReplaceValue.as
new file mode 100644
index 0000000..227d8a9
--- /dev/null
+++ b/ant_on_air/src/org/apache/flex/ant/tags/ReplaceValue.as
@@ -0,0 +1,44 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.ant.tags
+{
+	import mx.core.IFlexModuleFactory;
+	
+	import org.apache.flex.ant.Ant;
+	import org.apache.flex.ant.tags.supportClasses.TagHandler;
+	
+	[Mixin]
+	public class ReplaceValue extends TagHandler
+	{
+		public static function init(mf:IFlexModuleFactory):void
+		{
+			Ant.antTagProcessors["replacevalue"] = ReplaceValue;
+		}
+
+		public function ReplaceValue()
+		{
+			super();
+		}
+		
+		public function get text():String
+		{
+			return ant.getValue(xml.text().toString(), context);
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/c45b0786/ant_on_air/tests/test.xml
----------------------------------------------------------------------
diff --git a/ant_on_air/tests/test.xml b/ant_on_air/tests/test.xml
index fa4ea4d..9b6cd8f 100644
--- a/ant_on_air/tests/test.xml
+++ b/ant_on_air/tests/test.xml
@@ -186,6 +186,7 @@
             <entry key="somekey" value="somevalue" />
             <entry key="somekey1" value="somevalue1" />
             <entry key="looptest" value="foo" />
+            <entry key="xml" value="&lt;test/&gt;" />
         </propertyfile>
         <fail message="propertyfile did not result in expected file">
             <condition>
@@ -199,6 +200,14 @@
         <replace file="${basedir}/temp/custom.properties">
             <replacefilter token="key" value="ky" />
         </replace>
+        <replace file="${basedir}/temp/custom.properties">
+            <replacetoken>loop</replacetoken>
+            <replacevalue>lop</replacevalue>
+        </replace>
+        <replace file="${basedir}/temp/custom.properties">
+            <replacetoken><![CDATA[<test/>]]></replacetoken>
+            <replacevalue><![CDATA[<cdata/>]]></replacevalue>
+        </replace>
         <loadproperties srcFile="${basedir}/temp/custom.properties" />
         <fail message="replace did not work: found somekey">
             <condition>
@@ -212,6 +221,11 @@
                 </not>
             </condition>
         </fail>
+        <fail message="replace did not work: found looptest">
+            <condition>
+                <isset property="looptest" />
+            </condition>
+        </fail>
         <fail message="replace did not work: did not find replacedkey1">
             <condition>
                 <not>
@@ -222,7 +236,14 @@
         <fail message="replace did not work: did not find food">
             <condition>
                 <not>
-                    <equals arg1="${looptest}" arg2="food" />
+                    <equals arg1="${loptest}" arg2="food" />
+                </not>
+            </condition>
+        </fail>
+        <fail message="replace did not work: did not find &lt;cdata/&gt;">
+            <condition>
+                <not>
+                    <equals arg1="${xml}" arg2="&lt;cdata/&gt;" />
                 </not>
             </condition>
         </fail>


Mime
View raw message