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 2013/12/10 00:30:15 UTC

[13/14] git commit: [flex-utilities] [refs/heads/develop] - add and tags

add <not> and <fail> tags


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

Branch: refs/heads/develop
Commit: a8ab9e1404e1e4da98050d67ca0e9a0d49f4ac9d
Parents: 3a3f232
Author: Alex Harui <ah...@apache.org>
Authored: Mon Dec 9 15:26:53 2013 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Dec 9 15:26:53 2013 -0800

----------------------------------------------------------------------
 ant_on_air/src/AntClasses.as                    |  2 +
 ant_on_air/src/org/apache/flex/ant/tags/Fail.as | 78 ++++++++++++++++++++
 ant_on_air/src/org/apache/flex/ant/tags/Not.as  | 56 ++++++++++++++
 3 files changed, 136 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/a8ab9e14/ant_on_air/src/AntClasses.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/AntClasses.as b/ant_on_air/src/AntClasses.as
index cc869ea..4e7491c 100644
--- a/ant_on_air/src/AntClasses.as
+++ b/ant_on_air/src/AntClasses.as
@@ -29,11 +29,13 @@ package
             import org.apache.flex.ant.tags.Copy; Copy;
             import org.apache.flex.ant.tags.Delete; Delete;
             import org.apache.flex.ant.tags.Echo; Echo;
+            import org.apache.flex.ant.tags.Fail; Fail;
             import org.apache.flex.ant.tags.FileSet; FileSet;
             import org.apache.flex.ant.tags.FileSetExclude; FileSetExclude;
             import org.apache.flex.ant.tags.FileSetInclude; FileSetInclude;
             import org.apache.flex.ant.tags.IsSet; IsSet;
             import org.apache.flex.ant.tags.Mkdir; Mkdir;
+            import org.apache.flex.ant.tags.Not; Not;
             import org.apache.flex.ant.tags.OS; OS;
             import org.apache.flex.ant.tags.Property; Property;
         }

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/a8ab9e14/ant_on_air/src/org/apache/flex/ant/tags/Fail.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Fail.as b/ant_on_air/src/org/apache/flex/ant/tags/Fail.as
new file mode 100644
index 0000000..1016b62
--- /dev/null
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Fail.as
@@ -0,0 +1,78 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.IValueTagHandler;
+    import org.apache.flex.ant.tags.supportClasses.TaskHandler;
+    import org.apache.flex.xml.ITextTagHandler;
+    
+    [Mixin]
+    public class Fail extends TaskHandler implements ITextTagHandler
+    {
+        public static function init(mf:IFlexModuleFactory):void
+        {
+            Ant.antTagProcessors["fail"] = Fail;
+        }
+
+        public function Fail()
+        {
+            super();
+        }
+        
+        private var text:String;
+        
+        public function setText(text:String):void
+        {
+            this.text = text;    
+        }
+        
+        override protected function processAttribute(name:String, value:String):void
+        {
+            if (name == "message")
+                text = value;
+            else
+                super.processAttribute(name, value);
+        }
+
+        override public function execute():Boolean
+        {
+            super.execute();
+            if (numChildren == 1)
+            {
+                var child:Condition = getChildAt(0) as Condition;
+                if (child)
+                {
+                    child.execute();
+                    var val:Object = child.computedValue;
+                    if (!(val == "true" || val == true))
+                    {
+                        return true;
+                    }
+                }
+            }
+            if (text)
+                ant.output(ant.getValue(text, context));
+            Ant.project.status = false;
+            return true;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/a8ab9e14/ant_on_air/src/org/apache/flex/ant/tags/Not.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Not.as b/ant_on_air/src/org/apache/flex/ant/tags/Not.as
new file mode 100644
index 0000000..3ea0b7e
--- /dev/null
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Not.as
@@ -0,0 +1,56 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.IValueTagHandler;
+    import org.apache.flex.ant.tags.supportClasses.ParentTagHandler;
+    
+    [Mixin]
+    public class Not extends ParentTagHandler implements IValueTagHandler
+    {
+        public static function init(mf:IFlexModuleFactory):void
+        {
+            Ant.antTagProcessors["not"] = Not;
+        }
+
+        public function Not()
+        {
+            super();
+        }
+        
+        public function get value():Object
+        {
+            ant.processChildren(xml, context, this);
+            if (numChildren == 1)
+            {
+                var value:IValueTagHandler = getChildAt(0) as IValueTagHandler;
+                // get the value from the children
+                var val:Object = IValueTagHandler(value).value;
+                if (!(val == "true" || val == true))
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+}
\ No newline at end of file