You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2021/04/08 08:55:59 UTC

[camel] branch master updated (cdb8d34 -> 38318a8)

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

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from cdb8d34  camel-sql - Expose template. options on sql-stored. Fixed using the correct jdbc template. Polished docs. Added unit test.
     new 100238d  CAMEL-16467 - Camel-Examples: Group the example for grouped componets in a middle folder
     new 776b495  CAMEL-16467 - Camel-Examples: Group the example for grouped componets in a middle folder
     new 38318a8  CAMEL-16467 - Camel-Examples: Group the example for grouped componets in a middle folder

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/maven/packaging/PrepareExampleMojo.java  | 94 +++++++++++++---------
 1 file changed, 56 insertions(+), 38 deletions(-)

[camel] 02/03: CAMEL-16467 - Camel-Examples: Group the example for grouped componets in a middle folder

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 776b4952516b85bdaf56bde344bb4c2143867a0d
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Apr 8 09:35:21 2021 +0200

    CAMEL-16467 - Camel-Examples: Group the example for grouped componets in a middle folder
---
 .../java/org/apache/camel/maven/packaging/PrepareExampleMojo.java  | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareExampleMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareExampleMojo.java
index d1f71d3..da0e303 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareExampleMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareExampleMojo.java
@@ -63,7 +63,7 @@ public class PrepareExampleMojo extends AbstractMojo {
     protected String filter = "camel-example";
 
     @Parameter(property = "filterMiddleFolder", required = false, readonly = true)
-    protected List<String> filterMiddleFolder = Arrays.asList(new String[] { "aws" });
+    protected String filterMiddleFolder = "aws";
 
     /**
      * Maven ProjectHelper.
@@ -84,7 +84,7 @@ public class PrepareExampleMojo extends AbstractMojo {
 
     protected void executeExamplesReadme() throws MojoExecutionException, MojoFailureException {
         Set<File> examples = new TreeSet<>();
-
+        List<String> middleFolders = Arrays.asList(filterMiddleFolder.split(","));
         String currentDir = Paths.get(".").normalize().toAbsolutePath().toString();
         if (startingFolder != null && !startingFolder.isEmpty()) {
             // only run in examples directory where the main readme.adoc file is located
@@ -104,7 +104,8 @@ public class PrepareExampleMojo extends AbstractMojo {
 
             for (File file : examples) {
                 if (file.isDirectory()) {
-                    if (!filterMiddleFolder.contains(file.getName())) {
+                    getLog().info(middleFolders.toString());
+                    if (!middleFolders.contains(file.getName())) {
                         File pom = new File(file, "pom.xml");
                         if (pom.exists()) {
                             processExamples(models, file, pom);

[camel] 01/03: CAMEL-16467 - Camel-Examples: Group the example for grouped componets in a middle folder

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 100238d16a97931df2b5fe3bc37e4b5beda6194c
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Apr 8 09:23:12 2021 +0200

    CAMEL-16467 - Camel-Examples: Group the example for grouped componets in a middle folder
---
 .../camel/maven/packaging/PrepareExampleMojo.java  | 92 +++++++++++++---------
 1 file changed, 55 insertions(+), 37 deletions(-)

diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareExampleMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareExampleMojo.java
index 74952d4..d1f71d3 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareExampleMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareExampleMojo.java
@@ -62,6 +62,9 @@ public class PrepareExampleMojo extends AbstractMojo {
     @Parameter(property = "filter", required = true, readonly = true, defaultValue = "camel-example")
     protected String filter = "camel-example";
 
+    @Parameter(property = "filterMiddleFolder", required = false, readonly = true)
+    protected List<String> filterMiddleFolder = Arrays.asList(new String[] { "aws" });
+
     /**
      * Maven ProjectHelper.
      */
@@ -101,45 +104,21 @@ public class PrepareExampleMojo extends AbstractMojo {
 
             for (File file : examples) {
                 if (file.isDirectory()) {
-
-                    File pom = new File(file, "pom.xml");
-                    if (pom.exists()) {
-                        String existing = FileUtils.readFileToString(pom, Charset.defaultCharset());
-
-                        ExampleModel model = new ExampleModel();
-                        model.setFileName(file.getName());
-
-                        String name = Strings.between(existing, "<name>", "</name>");
-                        String title = Strings.between(existing, "<title>", "</title>");
-                        String description = Strings.between(existing, "<description>", "</description>");
-                        String category = Strings.between(existing, "<category>", "</category>");
-
-                        if (title != null) {
-                            model.setTitle(title);
-                        } else {
-                            // fallback and use file name as title
-                            model.setTitle(asTitle(file.getName()));
-                        }
-                        if (description != null) {
-                            model.setDescription(description);
+                    if (!filterMiddleFolder.contains(file.getName())) {
+                        File pom = new File(file, "pom.xml");
+                        if (pom.exists()) {
+                            processExamples(models, file, pom);
                         }
-                        if (category != null) {
-                            model.setCategory(category);
+                    } else {
+                        File[] subFiles = file.listFiles();
+                        for (File innerFile : subFiles) {
+                            if (innerFile.isDirectory()) {
+                                File pom = new File(innerFile, "pom.xml");
+                                if (pom.exists()) {
+                                    processExamples(models, innerFile, pom);
+                                }
+                            }
                         }
-                        if (name != null && name.contains("(deprecated)")) {
-                            model.setDeprecated("true");
-                        } else {
-                            model.setDeprecated("false");
-                        }
-
-                        // readme files is either readme.md or readme.adoc
-                        String[] readmes = new File(file, ".")
-                                .list((folder, fileName) -> fileName.regionMatches(true, 0, "readme", 0, "readme".length()));
-                        if (readmes != null && readmes.length == 1) {
-                            model.setReadmeFileName(readmes[0]);
-                        }
-
-                        models.add(model);
                     }
                 }
             }
@@ -171,6 +150,45 @@ public class PrepareExampleMojo extends AbstractMojo {
         }
     }
 
+    private void processExamples(List<ExampleModel> models, File file, File pom) throws IOException {
+        String existing = FileUtils.readFileToString(pom, Charset.defaultCharset());
+
+        ExampleModel model = new ExampleModel();
+        model.setFileName(file.getName());
+
+        String name = Strings.between(existing, "<name>", "</name>");
+        String title = Strings.between(existing, "<title>", "</title>");
+        String description = Strings.between(existing, "<description>", "</description>");
+        String category = Strings.between(existing, "<category>", "</category>");
+
+        if (title != null) {
+            model.setTitle(title);
+        } else {
+            // fallback and use file name as title
+            model.setTitle(asTitle(file.getName()));
+        }
+        if (description != null) {
+            model.setDescription(description);
+        }
+        if (category != null) {
+            model.setCategory(category);
+        }
+        if (name != null && name.contains("(deprecated)")) {
+            model.setDeprecated("true");
+        } else {
+            model.setDeprecated("false");
+        }
+
+        // readme files is either readme.md or readme.adoc
+        String[] readmes = new File(file, ".")
+                .list((folder, fileName) -> fileName.regionMatches(true, 0, "readme", 0, "readme".length()));
+        if (readmes != null && readmes.length == 1) {
+            model.setReadmeFileName(readmes[0]);
+        }
+
+        models.add(model);
+    }
+
     private String templateExamples(List<ExampleModel> models, long deprecated) throws MojoExecutionException {
         try {
             String template = PackageHelper

[camel] 03/03: CAMEL-16467 - Camel-Examples: Group the example for grouped componets in a middle folder

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 38318a8ca8ffdafed3dfeefea1bfb29987555522
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Apr 8 09:36:40 2021 +0200

    CAMEL-16467 - Camel-Examples: Group the example for grouped componets in a middle folder
---
 .../main/java/org/apache/camel/maven/packaging/PrepareExampleMojo.java   | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareExampleMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareExampleMojo.java
index da0e303..937ee70 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareExampleMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareExampleMojo.java
@@ -104,7 +104,6 @@ public class PrepareExampleMojo extends AbstractMojo {
 
             for (File file : examples) {
                 if (file.isDirectory()) {
-                    getLog().info(middleFolders.toString());
                     if (!middleFolders.contains(file.getName())) {
                         File pom = new File(file, "pom.xml");
                         if (pom.exists()) {