You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/04/28 18:18:28 UTC

[1/2] git commit: [flex-utilities] [refs/heads/develop] - AntOnAIR: added support for and tags that may be added as childre of the tag, similar to . These tags make it possible to use CDATA and new l

Repository: flex-utilities
Updated Branches:
  refs/heads/develop 338850873 -> cb3fbd25c


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/develop
Commit: c45b078688dfcdc3c468af4c56983805987b24f6
Parents: 1a46b11
Author: Josh Tynjala <jo...@gmail.com>
Authored: Fri Apr 24 15:15:22 2015 -0700
Committer: Josh Tynjala <jo...@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>


[2/2] git commit: [flex-utilities] [refs/heads/develop] - Merge branch 'ant-replacetoken-replacevalue' of https://github.com/joshtynjala/flex-utilities into develop. This closes #6

Posted by ah...@apache.org.
Merge branch 'ant-replacetoken-replacevalue' of https://github.com/joshtynjala/flex-utilities into develop.  This closes #6


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

Branch: refs/heads/develop
Commit: cb3fbd25cd424ac5dced936476a26cb62d7ffe9e
Parents: 3388508 c45b078
Author: Alex Harui <ah...@apache.org>
Authored: Tue Apr 28 09:10:48 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Apr 28 09:16:32 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(-)
----------------------------------------------------------------------