This is an automated email from the ASF dual-hosted git repository.

djencks pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0a03c492d095fd80dd2226a50f722cf760326da0
Author: David Jencks <djen...@apache.org>
AuthorDate: Mon Sep 20 11:46:04 2021 -0700

    [CAMEL-16854]
    Tooling changes in UpdateReadmeMojo and gulpfile.js
    
    Remove bogus code that has no effect on the results of this mojo, other 
than preventing it from acting on camel-disruptor-vm-component.adoc
    
    Remove useless code from UpdateReadmeMojo that modifies unused parts of the 
component model
    
    Don't add bogus [[]] pre content
    
    fix doctitle in options partials
---
 .../docs/modules/eips/partials/eip-options.adoc    |  8 ++--
 .../ROOT/partials/component-endpoint-options.adoc  | 32 +++++++--------
 .../dataformats/partials/dataformat-options.adoc   |  8 ++--
 .../languages/partials/language-options.adoc       |  8 ++--
 docs/gulpfile.js                                   |  4 +-
 .../camel/maven/packaging/UpdateReadmeMojo.java    | 48 ++++------------------
 6 files changed, 39 insertions(+), 69 deletions(-)

diff --git 
a/core/camel-core-engine/src/main/docs/modules/eips/partials/eip-options.adoc 
b/core/camel-core-engine/src/main/docs/modules/eips/partials/eip-options.adoc
index 12749e9..50fcb0f 100644
--- 
a/core/camel-core-engine/src/main/docs/modules/eips/partials/eip-options.adoc
+++ 
b/core/camel-core-engine/src/main/docs/modules/eips/partials/eip-options.adoc
@@ -4,13 +4,13 @@
 | value.defaultValue ? `${value.defaultValue}` : "" \
 |util.javaSimpleName(value.javaType)'
 :requires: 'util=util/jsonpath-util.js'
-include::jsonpathcount$example$json/{shortName}.json[queries='optioncount=nodes$.properties[?(@.displayName!="Id"
 && @.displayName!="Description" && @.displayName!="Expression" && 
@.displayName!="Outputs")]']
+include::jsonpathcount$example$json/{shortname}.json[queries='optioncount=nodes$.properties[?(@.displayName!="Id"
 && @.displayName!="Description" && @.displayName!="Expression" && 
@.displayName!="Outputs")]']
 
 ifeval::[{optioncount} == 0]
-The {docTitle} eip has no options.
+The {doctitle} eip has no options.
 endif::[]
 ifeval::[{optioncount} != 0]
-The {docTitle} eip supports {optioncount} options, which are listed below.
+The {doctitle} eip supports {optioncount} options, which are listed below.
 
 
 [{tablespec}]
@@ -18,6 +18,6 @@ The {docTitle} eip supports {optioncount} options, which are 
listed below.
 | Name | Description | Default | Type
 |===
 
-jsonpathTable2::example$json/{shortName}.json['nodes$.properties[?(@.displayName!="Id")]',{cellformats},{requires}]
+jsonpathTable2::example$json/{shortname}.json['nodes$.properties[?(@.displayName!="Id")]',{cellformats},{requires}]
 endif::[]
 
diff --git 
a/docs/components/modules/ROOT/partials/component-endpoint-options.adoc 
b/docs/components/modules/ROOT/partials/component-endpoint-options.adoc
index 62beafa..eb2df35 100644
--- a/docs/components/modules/ROOT/partials/component-endpoint-options.adoc
+++ b/docs/components/modules/ROOT/partials/component-endpoint-options.adoc
@@ -9,25 +9,25 @@
 |value.defaultValue ? `${value.defaultValue}` : "" \
 |util.javaSimpleName(value.javaType)
 :requires: 'util=util/jsonpath-util.js'
-include::jsonpath$example$json/{shortName}.json[query='$.component',formats='name,scheme,pascalcasescheme=util.pascalCase(scheme),syntax,apiSyntax',
 requires={requires}]
-include::jsonpathcount$example$json/{shortName}.json[queries='pathparametercount=nodes$.properties[?(@.kind=="path")],queryparametercount=nodes$.properties[?(@.kind=="parameter")],apicount=nodes$.apis.*']
+include::jsonpath$example$json/{shortname}.json[query='$.component',formats='name,scheme,pascalcasescheme=util.pascalCase(scheme),syntax,apiSyntax',
 requires={requires}]
+include::jsonpathcount$example$json/{shortname}.json[queries='pathparametercount=nodes$.properties[?(@.kind=="path")],queryparametercount=nodes$.properties[?(@.kind=="parameter")],apicount=nodes$.apis.*']
 
 == Component Options
 
-The {docTitle} component supports 
jsonpathCount:example$json/{shortName}.json['nodes$.componentProperties.*'] 
options, which are listed below.
+The {doctitle} component supports 
jsonpathCount:example$json/{shortname}.json['nodes$.componentProperties.*'] 
options, which are listed below.
 
 [{tablespec}]
 |===
 | Name | Description | Default | Type
 |===
 
-jsonpathTable2::example$json/{shortName}.json['nodes$.componentProperties.*','{component-option-name}{last-cell-formats}',{requires}]
+jsonpathTable2::example$json/{shortname}.json['nodes$.componentProperties.*','{component-option-name}{last-cell-formats}',{requires}]
 
 
 // endpoint options: START
 == Endpoint Options
 
-The {docTitle} endpoint is configured using URI syntax:
+The {doctitle} endpoint is configured using URI syntax:
 
 [subs='+attributes']
 ----
@@ -39,7 +39,7 @@ with the following path and query parameters:
 === Path Parameters ({pathparametercount} parameters)
 
 ifeval::[{pathparametercount} == 0]
-The {docTitle} endpoint has no path parameters.
+The {doctitle} endpoint has no path parameters.
 endif::[]
 
 ifeval::[{pathparametercount} != 0]
@@ -48,7 +48,7 @@ ifeval::[{pathparametercount} != 0]
 | Name | Description | Default | Type
 |===
 
-jsonpathTable2::example$json/{shortName}.json['nodes$.properties[?(@.kind=="path")]','{endpoint-path-option-name}{last-cell-formats}',{requires}]
+jsonpathTable2::example$json/{shortname}.json['nodes$.properties[?(@.kind=="path")]','{endpoint-path-option-name}{last-cell-formats}',{requires}]
 
 endif::[]
 
@@ -56,7 +56,7 @@ endif::[]
 === Query Parameters ({queryparametercount} parameters)
 
 ifeval::[{queryparametercount} == 0]
-The {docTitle} endpoint has no query parameters.
+The {doctitle} endpoint has no query parameters.
 endif::[]
 
 ifeval::[{queryparametercount} != 0]
@@ -65,14 +65,14 @@ ifeval::[{queryparametercount} != 0]
 | Name | Description | Default | Type
 |===
 
-jsonpathTable2::example$json/{shortName}.json['nodes$.properties[?(@.kind=="parameter")]','{endpoint-query-option-name}{last-cell-formats}',{requires}]
+jsonpathTable2::example$json/{shortname}.json['nodes$.properties[?(@.kind=="parameter")]','{endpoint-query-option-name}{last-cell-formats}',{requires}]
 endif::[]
 
 ifeval::[{apicount} != 0]
 
 == API Parameters ({apicount} APIs)
 
-The @{docTitle} endpoint is an API based component and has additional 
parameters based on which API name and API method is used.
+The @{doctitle} endpoint is an API based component and has additional 
parameters based on which API name and API method is used.
 The API name and API method is located in the endpoint URI as the 
`{apiSyntax}` path parameters:
 
 [subs='+attributes']
@@ -87,11 +87,11 @@ There are {apicount} API names as listed in the table below:
 | API Name | Type | Description
 |===
 
-jsonpathTable2::example$json/{shortName}.json['nodes$.apis.*','`<<#_api_${path[2]},*${path[2]}*>>`|
 value.consumerOnly ? "Consumer" : value.producerOnly ? "Producer" : "Both" | 
value.description']
+jsonpathTable2::example$json/{shortname}.json['nodes$.apis.*','`<<#_api_${path[2]},*${path[2]}*>>`|
 value.consumerOnly ? "Consumer" : value.producerOnly ? "Producer" : "Both" | 
value.description']
 
 Each API is documented in the following sections to come.
 
-[jsonpathBlock2, example$json/{shortName}.json, 
'nodes$.apis.*','apiname=path[2], producer-consumer = 
util.producerConsumerLong(value.consumerOnly\, value.producerOnly), 
methodcount=Object.keys(value.methods).length, aliases=value.aliases', 
{requires}]
+[jsonpathBlock2, example$json/{shortname}.json, 
'nodes$.apis.*','apiname=path[2], producer-consumer = 
util.producerConsumerLong(value.consumerOnly\, value.producerOnly), 
methodcount=Object.keys(value.methods).length, aliases=value.aliases', 
{requires}]
 ----
 
 [#_api_{apiname}]
@@ -120,16 +120,16 @@ The {methodcount} method(s) is listed in the table below, 
followed by detailed s
 | Method | Alias | Description
 |===
 
-jsonpathTable2::example$json/{shortName}.json['nodes$.apis["{apiname}"].methods.*','`<<#_api_{apiname}_method_${path[4]},*${path[4]}*>>`|util.alias(path[4],
 "{aliases}")|value.description', {requires}]
+jsonpathTable2::example$json/{shortname}.json['nodes$.apis["{apiname}"].methods.*','`<<#_api_{apiname}_method_${path[4]},*${path[4]}*>>`|util.alias(path[4],
 "{aliases}")|value.description', {requires}]
 
-[jsonpathBlock2, example$json/{shortName}.json, 
'nodes$.apis["{apiname}"].methods.*','methodname=path[4]', {requires}]
+[jsonpathBlock2, example$json/{shortname}.json, 
'nodes$.apis["{apiname}"].methods.*','methodname=path[4]', {requires}]
 ------
 [#_api_{apiname}_method_{methodname}]
 ==== Method {methodname}
 
 Signatures:
 
-jsonpathList2::example$json/{shortName}.json['nodes$.apis["{apiname}"].methods["{methodname}"].signatures.*','util.formatSignature(value)',
 {requires}]
+jsonpathList2::example$json/{shortname}.json['nodes$.apis["{apiname}"].methods["{methodname}"].signatures.*','util.formatSignature(value)',
 {requires}]
 
 The {name}/{methodname} API method has the parameters listed in the table 
below:
 
@@ -138,7 +138,7 @@ The {name}/{methodname} API method has the parameters 
listed in the table below:
 | Parameter | Description | Type
 |===
 
-jsonpathTable2::example$json/{shortName}.json['nodes$.apiProperties["{apiname}"].methods["{methodname}"].properties.*','`*${path[6]}*`|`${util.strong(value,
 "Required")} ${value.description}`|util.javaSimpleName(value.javaType)', 
{requires}]
+jsonpathTable2::example$json/{shortname}.json['nodes$.apiProperties["{apiname}"].methods["{methodname}"].properties.*','`*${path[6]}*`|`${util.strong(value,
 "Required")} ${value.description}`|util.javaSimpleName(value.javaType)', 
{requires}]
 
 ------
 
diff --git 
a/docs/components/modules/dataformats/partials/dataformat-options.adoc 
b/docs/components/modules/dataformats/partials/dataformat-options.adoc
index ab3a675..29f84ad 100644
--- a/docs/components/modules/dataformats/partials/dataformat-options.adoc
+++ b/docs/components/modules/dataformats/partials/dataformat-options.adoc
@@ -4,13 +4,13 @@
 |util.pascalCase(value.type) \
 |util.description(value)'
 :requires: 'util=util/jsonpath-util.js'
-include::jsonpathcount$example$json/{shortName}.json[queries='optioncount=nodes$.properties[?(@.displayName!="Id")]']
+include::jsonpathcount$example$json/{shortname}.json[queries='optioncount=nodes$.properties[?(@.displayName!="Id")]']
 
 ifeval::[{optioncount} == 0]
-The {docTitle} dataformat has no options.
+The {doctitle} dataformat has no options.
 endif::[]
 ifeval::[{optioncount} != 0]
-The {docTitle} dataformat supports {optioncount} options, which are listed 
below.
+The {doctitle} dataformat supports {optioncount} options, which are listed 
below.
 
 
 [{tablespec}]
@@ -18,6 +18,6 @@ The {docTitle} dataformat supports {optioncount} options, 
which are listed below
 | Name | Default | Java Type | Description
 |===
 
-jsonpathTable2::example$json/{shortName}.json['nodes$.properties[?(@.displayName!="Id")]',{cellformats},{requires}]
+jsonpathTable2::example$json/{shortname}.json['nodes$.properties[?(@.displayName!="Id")]',{cellformats},{requires}]
 endif::[]
 
diff --git a/docs/components/modules/languages/partials/language-options.adoc 
b/docs/components/modules/languages/partials/language-options.adoc
index 3b5ffdf..9b74ec7 100644
--- a/docs/components/modules/languages/partials/language-options.adoc
+++ b/docs/components/modules/languages/partials/language-options.adoc
@@ -4,13 +4,13 @@
 |util.pascalCase(value.type) \
 |util.description(value)'
 :requires: 'util=util/jsonpath-util.js'
-include::jsonpathcount$example$json/{shortName}.json[queries='optioncount=nodes$.properties[?(@.kind=="attribute"
 && @.displayName!="Id")]']
+include::jsonpathcount$example$json/{shortname}.json[queries='optioncount=nodes$.properties[?(@.kind=="attribute"
 && @.displayName!="Id")]']
 
 ifeval::[{optioncount} == 0]
-The {docTitle} language has no options.
+The {doctitle} language has no options.
 endif::[]
 ifeval::[{optioncount} != 0]
-The {docTitle} language supports {optioncount} options, which are listed below.
+The {doctitle} language supports {optioncount} options, which are listed below.
 
 
 [{tablespec}]
@@ -18,6 +18,6 @@ The {docTitle} language supports {optioncount} options, which 
are listed below.
 | Name | Default | Java Type | Description
 |===
 
-jsonpathTable2::example$json/{shortName}.json['nodes$.properties[?(@.kind=="attribute"
 && @.displayName!="Id")]',{cellformats},{requires}]
+jsonpathTable2::example$json/{shortname}.json['nodes$.properties[?(@.kind=="attribute"
 && @.displayName!="Id")]',{cellformats},{requires}]
 endif::[]
 
diff --git a/docs/gulpfile.js b/docs/gulpfile.js
index a49a1b7..d1a6998 100644
--- a/docs/gulpfile.js
+++ b/docs/gulpfile.js
@@ -27,10 +27,10 @@ const through2 = require('through2')
 const File = require('vinyl')
 
 function titleFrom (file) {
-  var maybeName = /(?::docTitle: )(.*)/.exec(file.contents.toString())
+  var maybeName = /(?::doctitle: )(.*)/.exec(file.contents.toString())
   if (maybeName === null) {
     //TODO investigate these... why dont they have them?
-    // console.warn(`${file.path} doesn't contain Asciidoc docTitle attribute 
(':docTitle: <Title>'`);
+    // console.warn(`${file.path} doesn't contain Asciidoc doctitle attribute 
(':doctitle: <Title>'`);
     maybeName = /(?:=|#) (.*)/.exec(file.contents.toString())
     if (maybeName === null) {
       throw new Error(
diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
index 069b5db..b25adbb 100644
--- 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
@@ -36,7 +36,6 @@ import java.util.TreeSet;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 import org.apache.camel.tooling.model.AnnotationModel;
 import org.apache.camel.tooling.model.ArtifactModel;
@@ -111,7 +110,7 @@ public class UpdateReadmeMojo extends AbstractGeneratorMojo 
{
     /**
      * The EIP documentation directory
      */
-    @Parameter(defaultValue = 
"${project.basedir}/src/main/docs/modules/eips/pages")
+    @Parameter
     protected File eipDocDir;
 
     /**
@@ -142,8 +141,6 @@ public class UpdateReadmeMojo extends AbstractGeneratorMojo 
{
         executeOther();
         executeDataFormat();
         executeLanguage();
-        File engine = findCamelDirectory(project.getBasedir(), 
"camel-core-engine");
-        eipDocDir = new File(engine, "/src/main/docs/modules/eips/pages");
         executeEips();
     }
 
@@ -171,35 +168,11 @@ public class UpdateReadmeMojo extends 
AbstractGeneratorMojo {
                     String title = asComponentTitle(model.getScheme(), 
model.getTitle());
                     model.setTitle(title);
 
-                    // we only want the first scheme as the alternatives do not
-                    // have their own readme file
-                    if (!Strings.isEmpty(model.getAlternativeSchemes())) {
-                        String first = 
model.getAlternativeSchemes().split(",")[0];
-                        if (!model.getScheme().equals(first)) {
-                            continue;
-                        }
-                    }
-
                     boolean updated = updateHeader(componentName, file, model, 
" Component", kind);
 
                     checkComponentHeader(file, model);
                     checkSince(file, model);
 
-                    // resolvePropertyPlaceholders is an option which only make
-                    // sense to use if the component has other options
-                    boolean hasOptions = model.getComponentOptions().stream()
-                            .anyMatch(o -> 
!o.getName().equals("resolvePropertyPlaceholders"));
-                    if (!hasOptions) {
-                        model.getComponentOptions().clear();
-                    }
-
-                    // Fix description in options
-                    Stream.concat(model.getComponentOptions().stream(), 
model.getEndpointOptions().stream()).forEach(option -> {
-                        String desc = option.getDescription();
-                        desc = desc.replaceAll("\\\\n", "\n");
-                        option.setDescription(desc);
-                    });
-
                     updated |= updateOptionsIn(file, "component-configure", 
"");
                     String options = 
evaluateTemplate("component-options.mvel", model);
                     updated |= updateOptionsIn(file, kind, options);
@@ -243,7 +216,6 @@ public class UpdateReadmeMojo extends AbstractGeneratorMojo 
{
                     File file = new File(componentDocDir, componentName + 
".adoc");
                     boolean exists = file.exists();
 
-                    // we only want the first scheme as the alternatives do not
                     boolean updated = updateHeader(componentName, file, model, 
" Component", kind);
                     checkSince(file, model);
 
@@ -378,7 +350,7 @@ public class UpdateReadmeMojo extends AbstractGeneratorMojo 
{
 
     private void executeEips() throws MojoExecutionException {
         // only run if in camel-core-engine
-        String currentDir = 
Paths.get(".").normalize().toAbsolutePath().toString();
+        String currentDir = project.getBasedir().toString();
         if (!currentDir.endsWith("camel-core-engine")) {
             return;
         }
@@ -386,9 +358,10 @@ public class UpdateReadmeMojo extends 
AbstractGeneratorMojo {
         final Set<File> jsonFiles = new TreeSet<>();
 
         // find all json files in camel-core
-        File coreDir = new File("./../camel-core-model");
+        File coreDir = findCamelDirectory(project.getBasedir(), 
"camel-core-model");
+
         if (coreDir.isDirectory()) {
-            File target = new File(coreDir, 
"target/classes/org/apache/camel/model");
+            File target = new File(coreDir, 
"src/generated/resources/org/apache/camel/model");
             PackageHelper.findJsonFiles(target, jsonFiles);
         }
 
@@ -498,26 +471,23 @@ public class UpdateReadmeMojo extends 
AbstractGeneratorMojo {
 
             List<String> newLines = new ArrayList<>(lines.length + 8);
 
-            //link
-            newLines.add("[[" + name + linkSuffix + "]]");
-
             //title
             String title = model.getTitle() + titleSuffix;
             if (model.isDeprecated()) {
                 title += " (deprecated)";
             }
             newLines.add("= " + title);
-            newLines.add(":docTitle: " + model.getTitle());
+            newLines.add(":doctitle: " + model.getTitle());
             String shortName = "mail".equals(name) ? "imap" : name;
-            newLines.add(":shortName: " + shortName);
+            newLines.add(":shortname: " + shortName);
 
             if (model instanceof ArtifactModel<?>) {
-                newLines.add(":artifactId: " + ((ArtifactModel<?>) 
model).getArtifactId());
+                newLines.add(":artifactid: " + ((ArtifactModel<?>) 
model).getArtifactId());
             }
             newLines.add(":description: " + model.getDescription());
             newLines.add(":since: " + model.getFirstVersionShort());
             //TODO put the deprecation into the actual support level.
-            newLines.add(":supportLevel: " + 
model.getSupportLevel().toString() + (model.isDeprecated() ? "-deprecated" : 
""));
+            newLines.add(":supportlevel: " + 
model.getSupportLevel().toString() + (model.isDeprecated() ? "-deprecated" : 
""));
             if (model.isDeprecated()) {
                 newLines.add(":deprecated: *deprecated*");
             }

Reply via email to