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 8c36841b075 CAMEL-17974: camel-jbang - Reload local kamelets
8c36841b075 is described below
commit 8c36841b0755359e528cee7cbeab4461d4a2055f
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Apr 16 19:01:55 2022 +0200
CAMEL-17974: camel-jbang - Reload local kamelets
---
.../org/apache/camel/dsl/jbang/core/commands/Run.java | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
index a8861b3ba3b..e73cb1256ed 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
@@ -245,6 +245,7 @@ class Run implements Callable<Integer> {
StringJoiner js = new StringJoiner(",");
StringJoiner sjReload = new StringJoiner(",");
StringJoiner sjClasspathFiles = new StringJoiner(",");
+ StringJoiner sjKamelets = new StringJoiner(",");
for (String file : files) {
@@ -286,6 +287,10 @@ class Run implements Callable<Integer> {
}
}
+ if (file.startsWith("file:") && file.endsWith(".kamelet.yaml")) {
+ sjKamelets.add(file);
+ }
+
// automatic map github https urls to github resolver
if (file.startsWith("https://github.com/")) {
String ext = FileUtil.onlyExt(file);
@@ -308,7 +313,8 @@ class Run implements Callable<Integer> {
if (kamelets.length() > 0) {
String loc =
main.getInitialProperties().getProperty("camel.component.kamelet.location");
if (loc != null) {
- loc = loc + "," + kamelets;
+ // local kamelets first
+ loc = kamelets + "," + loc;
} else {
loc = kamelets.toString();
}
@@ -330,6 +336,16 @@ class Run implements Callable<Integer> {
main.addInitialProperty("camel.jbang.classpathFiles",
sjClasspathFiles.toString());
}
+ if (sjKamelets.length() > 0) {
+ String loc =
main.getInitialProperties().getProperty("camel.component.kamelet.location");
+ if (loc != null) {
+ loc = loc + "," + sjKamelets;
+ } else {
+ loc = sjKamelets.toString();
+ }
+ main.addInitialProperty("camel.component.kamelet.location", loc);
+ }
+
// we can only reload if file based
if (reload && sjReload.length() > 0) {
main.addInitialProperty("camel.main.routesReloadEnabled", "true");