Repository: camel
Updated Branches:
  refs/heads/master c776464da -> 049220eaa


Component docs - Lets also count the number of JAR files.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/049220ea
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/049220ea
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/049220ea

Branch: refs/heads/master
Commit: 049220eaafb1d1da03fa8b559d8e96fa6f5e3e25
Parents: c776464
Author: Claus Ibsen <davscl...@apache.org>
Authored: Sat Mar 4 17:28:27 2017 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Sat Mar 4 17:28:27 2017 +0100

----------------------------------------------------------------------
 camel-core/readme.adoc                          |  6 +--
 components/readme.adoc                          |  8 ++--
 .../maven/packaging/PrepareReadmeMojo.java      | 46 ++++++++++++++++----
 .../src/main/resources/readme-components.mvel   |  2 +-
 .../src/main/resources/readme-dataformats.mvel  |  2 +-
 .../src/main/resources/readme-languages.mvel    |  2 +-
 .../src/main/resources/readme-others.mvel       |  2 +-
 7 files changed, 49 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/049220ea/camel-core/readme.adoc
----------------------------------------------------------------------
diff --git a/camel-core/readme.adoc b/camel-core/readme.adoc
index c95b0c0..3ab06fe 100644
--- a/camel-core/readme.adoc
+++ b/camel-core/readme.adoc
@@ -6,7 +6,7 @@ Components
 
 
 // components: START
-Number of Components: 25
+Number of Components: 25 in 1 JAR artifacts
 
 [width="100%",cols="4,1,5",options="header"]
 |=======================================================================
@@ -103,7 +103,7 @@ Data Formats
 
 
 // dataformats: START
-Number of Data Formats: 4
+Number of Data Formats: 4 in 36 JAR artifacts
 
 [width="100%",cols="4,1,5",options="header"]
 |=======================================================================
@@ -133,7 +133,7 @@ Expression Languages
 
 
 // languages: START
-Number of Languages: 10
+Number of Languages: 10 in 1 JAR artifacts
 
 [width="100%",cols="4,1,5",options="header"]
 |=======================================================================

http://git-wip-us.apache.org/repos/asf/camel/blob/049220ea/components/readme.adoc
----------------------------------------------------------------------
diff --git a/components/readme.adoc b/components/readme.adoc
index ff99b24..0904eab 100644
--- a/components/readme.adoc
+++ b/components/readme.adoc
@@ -2,7 +2,7 @@ Components
 ^^^^^^^^^^
 
 // components: START
-Number of Components: 220
+Number of Components: 220 in 175 JAR artifacts
 
 [width="100%",cols="4,1,5",options="header"]
 |=======================================================================
@@ -676,7 +676,7 @@ Data Formats
 ^^^^^^^^^^^^
 
 // dataformats: START
-Number of Data Formats: 45
+Number of Data Formats: 45 in 36 JAR artifacts
 
 [width="100%",cols="4,1,5",options="header"]
 |=======================================================================
@@ -779,7 +779,7 @@ Expression Languages
 ^^^^^^^^^^^^^^^^^^^^
 
 // languages: START
-Number of Languages: 24
+Number of Languages: 24 in 12 JAR artifacts
 
 [width="100%",cols="4,1,5",options="header"]
 |=======================================================================
@@ -840,7 +840,7 @@ Miscellaneous Components
 ^^^^^^^^^^^^^^^^^^^^^^^^
 
 // others: START
-Number of Miscellaneous Components: 36
+Number of Miscellaneous Components: 36 in 36 JAR artifacts
 
 [width="100%",cols="4,1,5",options="header"]
 |=======================================================================

http://git-wip-us.apache.org/repos/asf/camel/blob/049220ea/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareReadmeMojo.java
----------------------------------------------------------------------
diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareReadmeMojo.java
 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareReadmeMojo.java
index e42fc10..a6c4f40 100644
--- 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareReadmeMojo.java
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareReadmeMojo.java
@@ -27,6 +27,9 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
+import java.util.function.Function;
+import java.util.stream.Collector;
+import java.util.stream.Stream;
 
 import edu.emory.mathcs.backport.java.util.Collections;
 import org.apache.camel.maven.packaging.model.ComponentModel;
@@ -41,6 +44,9 @@ import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectHelper;
 import org.mvel2.templates.TemplateRuntime;
 
+import static java.util.stream.Collectors.counting;
+import static java.util.stream.Collectors.groupingBy;
+import static java.util.stream.Collectors.toSet;
 import static org.apache.camel.maven.packaging.PackageHelper.loadText;
 import static org.apache.camel.maven.packaging.PackageHelper.writeText;
 
@@ -231,6 +237,11 @@ public class PrepareReadmeMojo extends AbstractMojo {
                 }
             }
 
+            // how many different artifacts
+            int count = components.stream()
+                .map(ComponentModel::getArtifactId)
+                .collect(toSet()).size();
+
             // update the big readme file in the core/components dir
             File file;
             if (coreOnly) {
@@ -241,7 +252,7 @@ public class PrepareReadmeMojo extends AbstractMojo {
 
             // update regular components
             boolean exists = file.exists();
-            String changed = templateComponents(components);
+            String changed = templateComponents(components, count);
             boolean updated = updateComponents(file, changed);
 
             if (updated) {
@@ -278,12 +289,17 @@ public class PrepareReadmeMojo extends AbstractMojo {
             // sort the models
             Collections.sort(others, new OtherComparator());
 
+            // how many different artifacts
+            int count = others.stream()
+                .map(OtherModel::getArtifactId)
+                .collect(toSet()).size();
+
             // update the big readme file in the components dir
             File file = new File(readmeComponentsDir, "readme.adoc");
 
             // update regular components
             boolean exists = file.exists();
-            String changed = templateOthers(others);
+            String changed = templateOthers(others, count);
             boolean updated = updateOthers(file, changed);
 
             if (updated) {
@@ -326,6 +342,11 @@ public class PrepareReadmeMojo extends AbstractMojo {
             // sort the models
             Collections.sort(models, new DataFormatComparator());
 
+            // how many different artifacts
+            int count = models.stream()
+                .map(DataFormatModel::getArtifactId)
+                .collect(toSet()).size();
+
             // filter out camel-core
             List<DataFormatModel> dataFormats = new ArrayList<>();
             for (DataFormatModel model : models) {
@@ -350,7 +371,7 @@ public class PrepareReadmeMojo extends AbstractMojo {
 
             // update regular data formats
             boolean exists = file.exists();
-            String changed = templateDataFormats(dataFormats);
+            String changed = templateDataFormats(dataFormats, count);
             boolean updated = updateDataFormats(file, changed);
 
             if (updated) {
@@ -401,6 +422,11 @@ public class PrepareReadmeMojo extends AbstractMojo {
                 }
             }
 
+            // how many different artifacts
+            int count = languages.stream()
+                .map(LanguageModel::getArtifactId)
+                .collect(toSet()).size();
+
             // update the big readme file in the core/components dir
             File file;
             if (coreOnly) {
@@ -411,7 +437,7 @@ public class PrepareReadmeMojo extends AbstractMojo {
 
             // update regular data formats
             boolean exists = file.exists();
-            String changed = templateLanguages(languages);
+            String changed = templateLanguages(languages, count);
             boolean updated = updateLanguages(file, changed);
 
             if (updated) {
@@ -439,11 +465,12 @@ public class PrepareReadmeMojo extends AbstractMojo {
         }
     }
 
-    private String templateComponents(List<ComponentModel> models) throws 
MojoExecutionException {
+    private String templateComponents(List<ComponentModel> models, int 
artifacts) throws MojoExecutionException {
         try {
             String template = 
loadText(UpdateReadmeMojo.class.getClassLoader().getResourceAsStream("readme-components.mvel"));
             Map<String, Object> map = new HashMap<>();
             map.put("components", models);
+            map.put("numberOfArtifacts", artifacts);
             String out = (String) TemplateRuntime.eval(template, map);
             return out;
         } catch (Exception e) {
@@ -451,11 +478,12 @@ public class PrepareReadmeMojo extends AbstractMojo {
         }
     }
 
-    private String templateOthers(List<OtherModel> models) throws 
MojoExecutionException {
+    private String templateOthers(List<OtherModel> models, int artifacts) 
throws MojoExecutionException {
         try {
             String template = 
loadText(UpdateReadmeMojo.class.getClassLoader().getResourceAsStream("readme-others.mvel"));
             Map<String, Object> map = new HashMap<>();
             map.put("others", models);
+            map.put("numberOfArtifacts", artifacts);
             String out = (String) TemplateRuntime.eval(template, map);
             return out;
         } catch (Exception e) {
@@ -463,11 +491,12 @@ public class PrepareReadmeMojo extends AbstractMojo {
         }
     }
 
-    private String templateDataFormats(List<DataFormatModel> models) throws 
MojoExecutionException {
+    private String templateDataFormats(List<DataFormatModel> models, int 
artifacts) throws MojoExecutionException {
         try {
             String template = 
loadText(UpdateReadmeMojo.class.getClassLoader().getResourceAsStream("readme-dataformats.mvel"));
             Map<String, Object> map = new HashMap<>();
             map.put("dataformats", models);
+            map.put("numberOfArtifacts", artifacts);
             String out = (String) TemplateRuntime.eval(template, map);
             return out;
         } catch (Exception e) {
@@ -475,11 +504,12 @@ public class PrepareReadmeMojo extends AbstractMojo {
         }
     }
 
-    private String templateLanguages(List<LanguageModel> models) throws 
MojoExecutionException {
+    private String templateLanguages(List<LanguageModel> models, int 
artifacts) throws MojoExecutionException {
         try {
             String template = 
loadText(UpdateReadmeMojo.class.getClassLoader().getResourceAsStream("readme-languages.mvel"));
             Map<String, Object> map = new HashMap<>();
             map.put("languages", models);
+            map.put("numberOfArtifacts", artifacts);
             String out = (String) TemplateRuntime.eval(template, map);
             return out;
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/camel/blob/049220ea/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-components.mvel
----------------------------------------------------------------------
diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-components.mvel
 
b/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-components.mvel
index 53ce8ba..2e6440d 100644
--- 
a/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-components.mvel
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-components.mvel
@@ -1,6 +1,6 @@
 @if{!components.isEmpty()}
 
-Number of Components: @{components.size}
+Number of Components: @{components.size} in @{numberOfArtifacts} JAR artifacts
 
 [width="100%",cols="4,1,5",options="header"]
 |=======================================================================

http://git-wip-us.apache.org/repos/asf/camel/blob/049220ea/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-dataformats.mvel
----------------------------------------------------------------------
diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-dataformats.mvel
 
b/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-dataformats.mvel
index 5fdbc82..a79bb49 100644
--- 
a/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-dataformats.mvel
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-dataformats.mvel
@@ -1,6 +1,6 @@
 @if{!dataformats.isEmpty()}
 
-Number of Data Formats: @{dataformats.size}
+Number of Data Formats: @{dataformats.size} in @{numberOfArtifacts} JAR 
artifacts
 
 [width="100%",cols="4,1,5",options="header"]
 |=======================================================================

http://git-wip-us.apache.org/repos/asf/camel/blob/049220ea/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-languages.mvel
----------------------------------------------------------------------
diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-languages.mvel
 
b/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-languages.mvel
index 0815034..bd68b57 100644
--- 
a/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-languages.mvel
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-languages.mvel
@@ -1,6 +1,6 @@
 @if{!languages.isEmpty()}
 
-Number of Languages: @{languages.size}
+Number of Languages: @{languages.size} in @{numberOfArtifacts} JAR artifacts
 
 [width="100%",cols="4,1,5",options="header"]
 |=======================================================================

http://git-wip-us.apache.org/repos/asf/camel/blob/049220ea/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-others.mvel
----------------------------------------------------------------------
diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-others.mvel
 
b/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-others.mvel
index cf08936..85eafc0 100644
--- 
a/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-others.mvel
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/resources/readme-others.mvel
@@ -1,6 +1,6 @@
 @if{!others.isEmpty()}
 
-Number of Miscellaneous Components: @{others.size}
+Number of Miscellaneous Components: @{others.size} in @{numberOfArtifacts} JAR 
artifacts
 
 [width="100%",cols="4,1,5",options="header"]
 |=======================================================================

Reply via email to