This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 6dda313 camel-jbang: align features to ensure they match the same version of CamelJBang by default (#5975) 6dda313 is described below commit 6dda3135993588484478efc2389d073aea8854ac Author: Otavio Rodolfo Piske <orpi...@users.noreply.github.com> AuthorDate: Sat Aug 21 20:00:37 2021 +0200 camel-jbang: align features to ensure they match the same version of CamelJBang by default (#5975) Fixed commit 8fc78df4ba22a5f0f4ffdf7778d6b6db25fff351 (reverted by 1189f27e0d6f7228ea671d93a13f5773669b3b79) --- .../dsl/jbang/core/commands/AbstractSearch.java | 6 ++++++ .../camel-jbang-main/dist/CamelJBang.java | 20 ++++++++++++++++++++ .../src/main/jbang/main/CamelJBang.java | 20 ++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/AbstractSearch.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/AbstractSearch.java index 3128e93..41e6c1c 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/AbstractSearch.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/AbstractSearch.java @@ -34,6 +34,7 @@ import org.apache.commons.io.IOUtils; public abstract class AbstractSearch { private String resourceLocation; + private String branch; // Only used for the search subcommand protected AbstractSearch() { @@ -47,6 +48,10 @@ public abstract class AbstractSearch { this.resourceLocation = baseResourceLocation + ":" + resourcePath; } + public void setBranch(String branch) { + this.branch = branch; + } + protected void downloadResource(File indexFile) throws ResourceDoesNotExist, IOException { KameletMain main = new KameletMain(); main.start(); @@ -54,6 +59,7 @@ public abstract class AbstractSearch { try (GitHubResourceResolver resolver = new GitHubResourceResolver()) { resolver.setCamelContext(context); + resolver.setBranch(branch); Resource resource = resolver.resolve(resourceLocation); diff --git a/dsl/camel-jbang/camel-jbang-main/dist/CamelJBang.java b/dsl/camel-jbang/camel-jbang-main/dist/CamelJBang.java index 4119b5a..ff013fa 100755 --- a/dsl/camel-jbang/camel-jbang-main/dist/CamelJBang.java +++ b/dsl/camel-jbang/camel-jbang-main/dist/CamelJBang.java @@ -235,6 +235,10 @@ class SearchKamelets extends AbstractSearch implements Callable<Integer> { description = "Where to download the resources from") private String resourceLocation; + @Option(names = { "--branch" }, defaultValue = "main", hidden = true, + description = "The branch to use when downloading resources from (used for development/testing)") + private String branch; + @Override public void printHeader() { System.out.printf("%-35s %-45s %s%n", "KAMELET", "DESCRIPTION", "LINK"); @@ -244,6 +248,7 @@ class SearchKamelets extends AbstractSearch implements Callable<Integer> { @Override public Integer call() throws Exception { setResourceLocation(resourceLocation, "camel-kamelets:docs/modules/ROOT/nav.adoc"); + setBranch(branch); MatchExtractor<Kamelet> matchExtractor; @@ -282,6 +287,10 @@ class SearchComponents extends AbstractSearch implements Callable<Integer> { description = "Where to download the resources from") private String resourceLocation; + @Option(names = { "--branch" }, defaultValue = "camel-3.12.0-SNAPSHOT", hidden = true, + description = "The branch to use when downloading or searching resources (mostly used for development/testing)") + private String branch; + @Override public void printHeader() { System.out.printf("%-35s %-45s %s%n", "COMPONENT", "DESCRIPTION", "LINK"); @@ -291,6 +300,7 @@ class SearchComponents extends AbstractSearch implements Callable<Integer> { @Override public Integer call() throws Exception { setResourceLocation(resourceLocation, "camel:docs/components/modules/ROOT/nav.adoc"); + setBranch(branch); MatchExtractor<Component> matchExtractor; if (searchTerm.isEmpty()) { @@ -333,6 +343,10 @@ class SearchLanguages extends AbstractSearch implements Callable<Integer> { description = "Where to download the resources from") private String resourceLocation; + @Option(names = { "--branch" }, defaultValue = "camel-3.12.0-SNAPSHOT", hidden = true, + description = "The branch to use when downloading or searching resources (mostly used for development/testing)") + private String branch; + @Override public void printHeader() { System.out.printf("%-35s %-45s %s%n", "LANGUAGE", "DESCRIPTION", "LINK"); @@ -342,6 +356,7 @@ class SearchLanguages extends AbstractSearch implements Callable<Integer> { @Override public Integer call() throws Exception { setResourceLocation(resourceLocation, "camel:docs/components/modules/languages/nav.adoc"); + setBranch(branch); MatchExtractor<Language> matchExtractor; if (searchTerm.isEmpty()) { @@ -383,6 +398,10 @@ class SearchOthers extends AbstractSearch implements Callable<Integer> { description = "Where to download the resources from") private String resourceLocation; + @Option(names = { "--branch" }, defaultValue = "camel-3.12.0-SNAPSHOT", hidden = true, + description = "The branch to use when downloading or searching resources (mostly used for development/testing)") + private String branch; + @Override public void printHeader() { System.out.printf("%-35s %-45s %s%n", "COMPONENT", "DESCRIPTION", "LINK"); @@ -392,6 +411,7 @@ class SearchOthers extends AbstractSearch implements Callable<Integer> { @Override public Integer call() throws Exception { setResourceLocation(resourceLocation, "camel:docs/components/modules/others/nav.adoc"); + setBranch(branch); MatchExtractor<Other> matchExtractor; if (searchTerm.isEmpty()) { diff --git a/dsl/camel-jbang/camel-jbang-main/src/main/jbang/main/CamelJBang.java b/dsl/camel-jbang/camel-jbang-main/src/main/jbang/main/CamelJBang.java index 11ffa9a..f1d2989 100755 --- a/dsl/camel-jbang/camel-jbang-main/src/main/jbang/main/CamelJBang.java +++ b/dsl/camel-jbang/camel-jbang-main/src/main/jbang/main/CamelJBang.java @@ -235,6 +235,10 @@ class SearchKamelets extends AbstractSearch implements Callable<Integer> { description = "Where to download the resources from") private String resourceLocation; + @Option(names = { "--branch" }, defaultValue = "main", hidden = true, + description = "The branch to use when downloading resources from (used for development/testing)") + private String branch; + @Override public void printHeader() { System.out.printf("%-35s %-45s %s%n", "KAMELET", "DESCRIPTION", "LINK"); @@ -244,6 +248,7 @@ class SearchKamelets extends AbstractSearch implements Callable<Integer> { @Override public Integer call() throws Exception { setResourceLocation(resourceLocation, "camel-kamelets:docs/modules/ROOT/nav.adoc"); + setBranch(branch); MatchExtractor<Kamelet> matchExtractor; @@ -282,6 +287,10 @@ class SearchComponents extends AbstractSearch implements Callable<Integer> { description = "Where to download the resources from") private String resourceLocation; + @Option(names = { "--branch" }, defaultValue = "camel-${camel.jbang.version}", hidden = true, + description = "The branch to use when downloading or searching resources (mostly used for development/testing)") + private String branch; + @Override public void printHeader() { System.out.printf("%-35s %-45s %s%n", "COMPONENT", "DESCRIPTION", "LINK"); @@ -291,6 +300,7 @@ class SearchComponents extends AbstractSearch implements Callable<Integer> { @Override public Integer call() throws Exception { setResourceLocation(resourceLocation, "camel:docs/components/modules/ROOT/nav.adoc"); + setBranch(branch); MatchExtractor<Component> matchExtractor; if (searchTerm.isEmpty()) { @@ -333,6 +343,10 @@ class SearchLanguages extends AbstractSearch implements Callable<Integer> { description = "Where to download the resources from") private String resourceLocation; + @Option(names = { "--branch" }, defaultValue = "camel-${camel.jbang.version}", hidden = true, + description = "The branch to use when downloading or searching resources (mostly used for development/testing)") + private String branch; + @Override public void printHeader() { System.out.printf("%-35s %-45s %s%n", "LANGUAGE", "DESCRIPTION", "LINK"); @@ -342,6 +356,7 @@ class SearchLanguages extends AbstractSearch implements Callable<Integer> { @Override public Integer call() throws Exception { setResourceLocation(resourceLocation, "camel:docs/components/modules/languages/nav.adoc"); + setBranch(branch); MatchExtractor<Language> matchExtractor; if (searchTerm.isEmpty()) { @@ -383,6 +398,10 @@ class SearchOthers extends AbstractSearch implements Callable<Integer> { description = "Where to download the resources from") private String resourceLocation; + @Option(names = { "--branch" }, defaultValue = "camel-${camel.jbang.version}", hidden = true, + description = "The branch to use when downloading or searching resources (mostly used for development/testing)") + private String branch; + @Override public void printHeader() { System.out.printf("%-35s %-45s %s%n", "COMPONENT", "DESCRIPTION", "LINK"); @@ -392,6 +411,7 @@ class SearchOthers extends AbstractSearch implements Callable<Integer> { @Override public Integer call() throws Exception { setResourceLocation(resourceLocation, "camel:docs/components/modules/others/nav.adoc"); + setBranch(branch); MatchExtractor<Other> matchExtractor; if (searchTerm.isEmpty()) {