You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2021/11/24 18:04:48 UTC

[camel] branch main updated: CAMEL-17230: added support for loading unpublished local Kamelets

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

orpiske 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 59899e5  CAMEL-17230: added support for loading unpublished local Kamelets
59899e5 is described below

commit 59899e50ed1483078e0e47825f2a04e883a98bca
Author: Otavio Rodolfo Piske <op...@redhat.com>
AuthorDate: Wed Nov 24 18:05:43 2021 +0100

    CAMEL-17230: added support for loading unpublished local Kamelets
---
 docs/user-manual/modules/ROOT/pages/camel-jbang.adoc           | 10 ++++++++++
 .../java/org/apache/camel/dsl/jbang/core/commands/Run.java     |  8 ++++++++
 2 files changed, 18 insertions(+)

diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
index 84344c3..0f16071 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
@@ -176,6 +176,16 @@ For example to run one of the Camel K examples you can do:
 jbang -Dcamel.jbang.version=3.14.0 CamelJBang@apache/camel run run github:apache:camel-k:examples/languages/routes.yaml
 ----
 
+=== Running local Kamelets
+
+You can also use Camel JBang to try local Kamelets, without the need to publish them on Github or package them in a jar.
+
+[source,bash]
+----
+jbang -Dcamel.jbang.version=3.14.0 CamelJBang@apache/camel run --local-kamelet-dir=/path/to/local/kamelets earthquake.yaml
+----
+
+
 == Installation
 
 It is not necessary to install Camel JBang. However, if you prefer to do so, JBang makes it easy for us by providing an installation feature that works with Github. If you have JBang installed on your system, then you can run the following command to install CamelJBang:
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 4b0999b..21f03bb 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
@@ -76,6 +76,10 @@ class Run implements Callable<Integer> {
             description = "Whether to create a temporary file lock, which upon deleting triggers this process to terminate")
     private boolean fileLock = true;
 
+    @Option(names = { "--local-kamelet-dir" },
+            description = "Load a Kamelets from a local directory instead of resolving them from the classpath or GitHub")
+    private String localKameletDir;
+
     @Override
     public Integer call() throws Exception {
         if (stopRequested) {
@@ -123,6 +127,10 @@ class Run implements Callable<Integer> {
             main.addInitialProperty("camel.main.durationMaxIdleSeconds", String.valueOf(maxIdleSeconds));
         }
 
+        if (!localKameletDir.isEmpty()) {
+            main.addInitialProperty("camel.component.kamelet.location", "file://" + localKameletDir);
+        }
+
         if (fileLock) {
             lockFile = createLockFile();
             if (!lockFile.exists()) {