You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/07/17 13:45:01 UTC

[camel] 03/13: CAMEL-12644: Generate spring boot auto configuration in the docs.

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

davsclaus pushed a commit to branch camel-12644
in repository https://gitbox.apache.org/repos/asf/camel.git

commit e3df558be6b19d44164cb1a199316cab9da7c0f4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jul 16 20:25:38 2018 +0200

    CAMEL-12644: Generate spring boot auto configuration in the docs.
---
 .../UpdateSpringBootAutoConfigurationReadmeMojo.java          | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java
index 0fad8af..ffab8a8 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateSpringBootAutoConfigurationReadmeMojo.java
@@ -174,6 +174,17 @@ public class UpdateSpringBootAutoConfigurationReadmeMojo extends AbstractMojo {
             String text = loadText(new FileInputStream(file));
 
             String existing = StringHelper.between(text, "// spring-boot-auto-configure options: START", "// spring-boot-auto-configure options: END");
+            if (existing == null) {
+                // attach to the end of the endpoint options
+                int pos = text.indexOf("// endpoint options: END");
+                if (pos != -1) {
+                    String before = text.substring(0, pos);
+                    String after = text.substring(pos + 24);
+                    text = before + "// endpoint options: END\n// spring-boot-auto-configure options: START\n// spring-boot-auto-configure options: END\n" + after;
+                    writeText(file, text);
+                    existing = StringHelper.between(text, "// spring-boot-auto-configure options: START", "// spring-boot-auto-configure options: END");
+                }
+            }
             if (existing != null) {
                 // remove leading line breaks etc
                 existing = existing.trim();