You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2013/06/22 01:14:21 UTC

git commit: Fix some issues related to generating documentation

Updated Branches:
  refs/heads/master b04fb2fd6 -> a714e0863


Fix some issues related to generating documentation


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a714e086
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a714e086
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a714e086

Branch: refs/heads/master
Commit: a714e0863ce43a273b19ee1643f13393b363b604
Parents: b04fb2f
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Jun 21 16:14:15 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Jun 21 16:14:15 2013 -0700

----------------------------------------------------------------------
 build.gradle                                    | 18 +++--
 src/docroot-template/index.html                 |  2 +-
 .../beanvalidator-validation.coffee             | 70 ++++++++++++++++++++
 .../modules/t5/beanvalidator/validation.coffee  | 67 -------------------
 .../modules/BeanValidatorModule.java            |  9 ++-
 5 files changed, 91 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a714e086/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 67fdcac..714342b 100755
--- a/build.gradle
+++ b/build.gradle
@@ -323,14 +323,19 @@ task coffeeScriptDocs(type: Exec) {
 
     def outputDir = file("$buildDir/documentation/coffeescript")
 
-    def sources = subprojects*.fileTree("src/main", {
-        include "**/*.coffee"
-    })*.files.flatten()
+    // Note: this currently does not include the 
+
+    def sources = files()
+
+    subprojects.each { sub ->
+      // When I figure out how to get the preprocessed CoffeeScript included, this can change to src/main/coffeescript
+      sources += sub.fileTree("src/main", { include "**/*.coffee" })
+    }
 
     // Needs to be installed via "npm install -g docco"
     executable isWindows() ? "docco.cmd" : "docco"
     args "--output", outputDir
-    args sources
+    args sources.files.sort({ a,b -> a.name.compareTo b.name })
 
     inputs.files sources
     outputs.dir outputDir
@@ -385,6 +390,11 @@ task zippedJavadoc(type: Zip) {
 
     from file("src/docroot-template"), {
         filter ReplaceTokens, tokens: [version: project.version]
+        include "*.html"
+    }
+
+    from file("src/docroot-template"), {
+        exclude "*.html"
     }
 
     into "apidocs", { from aggregateJavadoc.outputs.files }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a714e086/src/docroot-template/index.html
----------------------------------------------------------------------
diff --git a/src/docroot-template/index.html b/src/docroot-template/index.html
index 72bb363..e6252b1 100644
--- a/src/docroot-template/index.html
+++ b/src/docroot-template/index.html
@@ -62,7 +62,7 @@
 
                 <ul>
                     <li><a href="coffeescript/events.html">t5/core/events</a></li>
-                    <li><a href="coffeescript/t5-core-dom-jquery.html">t5/core/dom (jQuery)</a></li>
+                    <li><a href="coffeescript/t5-core-dom.html">t5/core/dom</a></li>
                 </ul>
 
                 <p>See also:</p>

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a714e086/tapestry-beanvalidator/src/main/coffeescript/META-INF/modules/t5/beanvalidator/beanvalidator-validation.coffee
----------------------------------------------------------------------
diff --git a/tapestry-beanvalidator/src/main/coffeescript/META-INF/modules/t5/beanvalidator/beanvalidator-validation.coffee b/tapestry-beanvalidator/src/main/coffeescript/META-INF/modules/t5/beanvalidator/beanvalidator-validation.coffee
new file mode 100644
index 0000000..835e24f
--- /dev/null
+++ b/tapestry-beanvalidator/src/main/coffeescript/META-INF/modules/t5/beanvalidator/beanvalidator-validation.coffee
@@ -0,0 +1,70 @@
+# Copyright 2012-2013 The Apache Software Foundation
+#
+# Licensed 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.
+
+# ## t5/beanvalidator/beanvalidator-validation
+#
+# The awkward name is to accomidate the "docco" documentation tool; it doesn't understand
+# having the same named file in multiple folders. See https://github.com/jashkenas/docco/issues/201.
+#
+# Supports extra validations related to the beanvalidator module.
+define ["underscore", "t5/core/dom", "t5/core/events", "t5/core/utils", "t5/core/validation"],
+  (_, dom, events, utils) ->
+
+    rangeValue = (element, attribute, defaultValue) ->
+      v = element.attribute attribute
+      if v is null
+        defaultValue
+      else
+        parseInt v
+
+    countOptions = (e) ->
+      # A select that is used as part of a palette is different; the validation attributes
+      # are attached to the selected (right side) <select>, and anything there counts as part
+      # of the selection.
+      if e.findParent ".palette"
+        e.element.options.length
+      else
+        # An ordinary <select> may have multiple options (the clumsy control-click way)
+        _.filter(e.element.options, (o) -> o.selected).length
+
+    doRangeValidate = (element, value, memo) ->
+      min = rangeValue element, "data-range-min", 0
+      max = rangeValue element, "data-range-max", Number.MAX_VALUE
+
+      # If the translated value is still a string, and not a number, then the
+      # size refers to the length of the string, not its numeric value.
+      if _.isString value
+        value = value.length
+
+      unless min <= value <= max
+        memo.error = (element.attribute "data-range-message") or "RANGE ERROR"
+        return false
+
+      return true
+
+    dom.onDocument events.field.optional, "[data-optionality=prohibited]", (event, memo) ->
+
+      unless utils.isBlank memo.value
+        memo.error = (@attribute "data-prohibited-message") or "PROHIBITED"
+        return false
+
+      return true
+
+    dom.onDocument events.field.validate, "input[data-range-min], input[data-range-max], textarea[data-range-min], textarea[data-range-max]", (event, memo) ->
+      doRangeValidate this, memo.translated, memo
+
+    dom.onDocument events.field.validate, "select[data-range-min], select[data-range-max]", (event, memo) ->
+      doRangeValidate this, (countOptions this), memo
+
+    return

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a714e086/tapestry-beanvalidator/src/main/coffeescript/META-INF/modules/t5/beanvalidator/validation.coffee
----------------------------------------------------------------------
diff --git a/tapestry-beanvalidator/src/main/coffeescript/META-INF/modules/t5/beanvalidator/validation.coffee b/tapestry-beanvalidator/src/main/coffeescript/META-INF/modules/t5/beanvalidator/validation.coffee
deleted file mode 100644
index cb3219c..0000000
--- a/tapestry-beanvalidator/src/main/coffeescript/META-INF/modules/t5/beanvalidator/validation.coffee
+++ /dev/null
@@ -1,67 +0,0 @@
-# Copyright 2012 The Apache Software Foundation
-#
-# Licensed 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.
-
-# ## t5/beanvalidator/validation
-#
-# Supports extra validations related to the beanvalidator module.
-define ["underscore", "t5/core/dom", "t5/core/events", "t5/core/utils", "t5/core/validation"],
-  (_, dom, events, utils) ->
-
-    rangeValue = (element, attribute, defaultValue) ->
-      v = element.attribute attribute
-      if v is null
-        defaultValue
-      else
-        parseInt v
-
-    countOptions = (e) ->
-      # A select that is used as part of a palette is different; the validation attributes
-      # are attached to the selected (right side) <select>, and anything there counts as part
-      # of the selection.
-      if e.findParent ".t-palette"
-        e.element.options.length
-      else
-        # An ordinary <select> may have multiple options (the clumsy control-click way)
-        _.filter(e.element.options, (o) -> o.selected).length
-
-    doRangeValidate = (element, value, memo) ->
-      min = rangeValue element, "data-range-min", 0
-      max = rangeValue element, "data-range-max", Number.MAX_VALUE
-
-      # If the translated value is still a string, and not a number, then the
-      # size refers to the length of the string, not its numeric value.
-      if _.isString value
-        value = value.length
-
-      unless min <= value <= max
-        memo.error = (element.attribute "data-range-message") or "RANGE ERROR"
-        return false
-
-      return true
-
-    dom.onDocument events.field.optional, "[data-optionality=prohibited]", (event, memo) ->
-
-      unless utils.isBlank memo.value
-        memo.error = (@attribute "data-prohibited-message") or "PROHIBITED"
-        return false
-
-      return true
-
-    dom.onDocument events.field.validate, "input[data-range-min], input[data-range-max], textarea[data-range-min], textarea[data-range-max]", (event, memo) ->
-      doRangeValidate this, memo.translated, memo
-
-    dom.onDocument events.field.validate, "select[data-range-min], select[data-range-max]", (event, memo) ->
-      doRangeValidate this, (countOptions this), memo
-
-    return

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a714e086/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/modules/BeanValidatorModule.java
----------------------------------------------------------------------
diff --git a/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/modules/BeanValidatorModule.java b/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/modules/BeanValidatorModule.java
index 013ff59..cabd467 100644
--- a/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/modules/BeanValidatorModule.java
+++ b/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/modules/BeanValidatorModule.java
@@ -41,6 +41,9 @@ import java.util.Map;
  */
 public class BeanValidatorModule
 {
+
+    private static final String MODULE_NAME = "t5/beanvalidator/beanvalidator-validation";
+
     public static void bind(final ServiceBinder binder)
     {
         binder.bind(FieldValidatorDefaultSource.class, BeanFieldValidatorDefaultSource.class).withSimpleId();
@@ -132,7 +135,7 @@ public class BeanValidatorModule
         {
             public void applyClientValidation(MarkupWriter writer, String message, Map<String, Object> attributes)
             {
-                javaScriptSupport.require("t5/beanvalidator/validation");
+                javaScriptSupport.require(MODULE_NAME);
                 writer.attributes(
                         DataConstants.VALIDATION_ATTRIBUTE, true,
                         "data-optionality", "prohibited",
@@ -144,7 +147,7 @@ public class BeanValidatorModule
         {
             public void applyClientValidation(MarkupWriter writer, String message, Map<String, Object> attributes)
             {
-                javaScriptSupport.require("t5/core/validation");
+                javaScriptSupport.require(MODULE_NAME);
                 writer.attributes(
                         DataConstants.VALIDATION_ATTRIBUTE, true,
                         "data-validate-regexp", attributes.get("regexp"),
@@ -156,7 +159,7 @@ public class BeanValidatorModule
         {
             public void applyClientValidation(MarkupWriter writer, String message, Map<String, Object> attributes)
             {
-                javaScriptSupport.require("t5/beanvalidator/validation");
+                javaScriptSupport.require(MODULE_NAME);
                 writer.attributes(
                         DataConstants.VALIDATION_ATTRIBUTE, true,
                         "data-range-message", message);