You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/06/30 13:13:46 UTC
[GitHub] [camel] orpiske opened a new pull request #5770: WIP: preliminary support for Jbang within Camel
orpiske opened a new pull request #5770:
URL: https://github.com/apache/camel/pull/5770
Example usage:
[](https://asciinema.org/a/423125)
[](https://asciinema.org/a/423121)
<!-- Uncomment and fill this section if your PR is not trivial
- [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line and body.
- [ ] If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [ ] Run `mvn clean install -Psourcecheck` in your module with source check enabled to make sure basic checks pass and there are no checkstyle violations. A more thorough check will be performed on your pull request automatically.
Below are the contribution guidelines:
https://github.com/apache/camel/blob/main/CONTRIBUTING.md
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: Support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-875366314
> In case you missed it jbang supports default property values.
>
> ${camel.jbang.version:RELEASE}
Thanks, I didn't know about the `:RELEASE` part!
>
> Then default use of jbang camel@apache/camel will get latest release.
>
> And you can always do jbang -Dcamel.jbang.version=3.0.2 camel@apache/camel for specific version control.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on a change in pull request #5770: Support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on a change in pull request #5770:
URL: https://github.com/apache/camel/pull/5770#discussion_r663087345
##########
File path: dsl/camel-jbang/CamelJBang.java
##########
@@ -0,0 +1,249 @@
+///usr/bin/env jbang "$0" "$@" ; exit $?
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//REPOS mavencentral,apache=https://repository.apache.org/snapshots
+//DEPS org.apache.camel:camel-bom:3.12.0-SNAPSHOT@pom
+//DEPS org.apache.camel:camel-core
+//DEPS org.apache.camel:camel-core-model
+//DEPS org.apache.camel:camel-api
+//DEPS org.apache.camel:camel-main
+//DEPS org.apache.camel:camel-kamelet-main
+//DEPS org.apache.camel:camel-file-watch
+//DEPS org.apache.camel:camel-resourceresolver-github
+//DEPS org.apache.logging.log4j:log4j-api:2.13.3
+//DEPS org.apache.logging.log4j:log4j-core:2.13.3
+//DEPS org.apache.logging.log4j:log4j-slf4j-impl:2.13.3
+//DEPS info.picocli:picocli:4.5.0
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.concurrent.Callable;
+import java.util.function.Consumer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.github.GitHubResourceResolver;
+import org.apache.camel.main.KameletMain;
+import org.apache.camel.spi.Resource;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.config.Configurator;
+import org.apache.logging.log4j.core.config.DefaultConfiguration;
+
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.Option;
+import picocli.CommandLine.Parameters;
+
+@Command(name = "run", description = "Run a Kamelet")
+class Run implements Callable<Integer> {
+ private CamelContext context;
+
+ @Parameters(description = "The path to the kamelet binding", arity = "1")
+ private String binding;
+
+ @Option(names = {"--debug-level"}, defaultValue = "info", description = "Default debug level")
+ private String debugLevel;
+
+ class ShutdownRoute extends RouteBuilder {
+ private File lockFile;
+
+ public ShutdownRoute(File lockFile) {
+ this.lockFile = lockFile;
+ }
+
+ public void configure() {
+ fromF("file-watch://%s?events=DELETE&antInclude=%s", lockFile.getParent(), lockFile.getName())
+ .process(p -> context.shutdown());
+ }
+ }
+
+ @Override
+ public Integer call() throws Exception {
+ switch (debugLevel) {
+ case "trace": Configurator.setRootLevel(Level.TRACE); break;
+ case "debug": Configurator.setRootLevel(Level.DEBUG); break;
+ case "info": Configurator.setRootLevel(Level.INFO); break;
+ case "warn": Configurator.setRootLevel(Level.WARN); break;
+ case "fatal": Configurator.setRootLevel(Level.FATAL); break;
+ default: {
+ System.err.println("Invalid debug level " + debugLevel);
+ return 1;
+ }
+ }
+
+ File bindingFile = new File(binding);
+ if (!bindingFile.exists()) {
+ System.err.println("The binding file does not exist");
+
+ return 1;
+ }
+
+ System.setProperty("camel.main.routes-include-pattern", "file:" + binding);
+ System.setProperty("camel.main.name", "CamelJBang");
+
+ System.out.println("Starting Camel JBang!");
+ KameletMain main = new KameletMain();
+
+ main.configure().addRoutesBuilder(new ShutdownRoute(createLockFile()));
+ main.start();
+ context = main.getCamelContext();
+
+ main.run();
+ return 0;
+ }
+
+ public File createLockFile() throws IOException {
+ File lockFile = File.createTempFile(".run", ".camel.lock", new File("."));
+
+ System.out.printf("A new lock file was created on %s. Delete this file to stop running%n",
+ lockFile.getAbsolutePath());
+ lockFile.deleteOnExit();
+
+ return lockFile;
+ }
+}
+
+@Command(name = "search", description = "Search for a Kamelet in the Kamelet catalog")
+class Search implements Callable<Integer> {
+
+ @Option(names = {"--search-term"}, defaultValue = "", description = "Default debug level")
+ private String searchTerm;
+
+ private void downloadResource(File indexFile) throws Exception {
+ KameletMain main = new KameletMain();
+ main.start();
+ CamelContext context = main.getCamelContext();
+
+ try (GitHubResourceResolver resolver = new GitHubResourceResolver()) {
+ resolver.setCamelContext(context);
+
+ Resource resource = resolver.resolve("github:apache:camel-kamelets:docs/modules/ROOT/nav.adoc");
+
+ if (!resource.exists()) {
+ throw new Exception("The resource does not exist");
+ }
+
+ try (FileWriter w = new FileWriter(indexFile)) {
+ Reader resourceReader = resource.getReader();
+
+ resourceReader.transferTo(w);
Review comment:
This API is Java 10+, so we cannot use it for the moment. I'll have to use a different one.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] davsclaus commented on pull request #5770: WIP: preliminary support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
davsclaus commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-872181770
> @orpiske add a jbang-catalog.json file and you can do jbang camel@apache/camel and it will show up on jbang.dev/appstore too :)
Max, should the jbang-catalog.json file be in the root folder?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: Support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-876982506
> Yeah sounds good, its good to get something out there and you can also write a blog , record a video or something to start introducing this
Thanks. +1! Today I'll start writing the documentation to include on the website and I'll prepare a blog post with some screen casts or videos as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] maxandersen commented on pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
maxandersen commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-872028129
@orpiske add a jbang-catalog.json file and you can do jbang camel@apache/camel and it will show up on jbang.dev/appstore too :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: Support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-873082310
Today's update is that I modified the packaging a bit so that:
1. We don't rely on fixed dependency versions on the script
2. While also ensuring the code remains valid Java/JBang code
The intention is to ensure it remains aligned with the dependencies on the Camel Core but still allowing for the nice JBang features such as app install and so on. This may be a bit unusual, so I described it in the module's `README.md` file, but at first sight it doesn't seem like it would impact the release process (might be good to review that, though).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] zhfeng commented on a change in pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
zhfeng commented on a change in pull request #5770:
URL: https://github.com/apache/camel/pull/5770#discussion_r661985484
##########
File path: dsl/camel-jbang/CamelJbang.java
##########
@@ -0,0 +1,255 @@
+///usr/bin/env jbang "$0" "$@" ; exit $?
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//DEPS info.picocli:picocli:4.5.0
+//DEPS org.apache.camel:camel-core:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-core-model:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-api:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-main:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-kamelet-main:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-file-watch:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-resourceresolver-github:3.12.0-SNAPSHOT
+//DEPS org.apache.logging.log4j:log4j-api:2.13.3
+//DEPS org.apache.logging.log4j:log4j-core:2.13.3
+//DEPS org.apache.logging.log4j:log4j-slf4j-impl:2.13.3
+//FILES application.properties
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.nio.channels.Channels;
+import java.nio.channels.FileChannel;
+import java.nio.channels.ReadableByteChannel;
+import java.util.concurrent.Callable;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.function.Consumer;
+
+import org.apache.camel.main.KameletMain;
+import org.apache.camel.spi.Resource;
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.github.GitHubResourceResolver;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.config.Configurator;
+import org.apache.logging.log4j.core.config.DefaultConfiguration;
+
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.Parameters;
+import picocli.CommandLine.Option;
+
+@Command(name = "run", description = "Run a Kamelet")
+class Run implements Callable<Integer> {
+ private CamelContext context;
+
+ @Parameters(description = "The path to the kamelet binding", defaultValue = "")
+ private String binding;
+
+ @Option(names = {"--debug-level"}, defaultValue = "info", description = "Default debug level")
+ private String debugLevel;
+
+ class ShutdownRoute extends RouteBuilder {
+ private File lockFile;
+
+ public ShutdownRoute(File lockFile) {
+ this.lockFile = lockFile;
+ }
+
+ public void configure() {
+ fromF("file-watch://%s?events=DELETE&antInclude=%s", lockFile.getParent(), lockFile.getName())
+ .process(p -> context.shutdown());
+ }
+ }
+
+ @Override
+ public Integer call() throws Exception {
+ switch (debugLevel) {
+ case "trace": Configurator.setRootLevel(Level.TRACE); break;
+ case "debug": Configurator.setRootLevel(Level.DEBUG); break;
+ case "info": Configurator.setRootLevel(Level.INFO); break;
+ case "warn": Configurator.setRootLevel(Level.WARN); break;
+ case "fatal": Configurator.setRootLevel(Level.FATAL); break;
+ default: {
+ System.err.println("Invalid debug level " + debugLevel);
+ return 1;
+ }
+ }
+
+ System.out.println("Starting Camel Jbang!");
+
+ if (binding.isEmpty()) {
+ System.err.println("You must provide a binding file (check --help)");
+
+ return 1;
+ }
+
+ File bindingFile = new File(binding);
+ if (!bindingFile.exists()) {
+ System.err.println("The binding file does not exist");
+
+ return 1;
+ }
+
+ System.setProperty("camel.main.routes-include-pattern", "file:" + binding);
+ System.setProperty("camel.main.name", "CamelJbang");
+
+ KameletMain main = new KameletMain();
+
+ main.configure().addRoutesBuilder(new ShutdownRoute(createLockFile()));
+ main.start();
+ context = main.getCamelContext();
+
+ main.run();
+ return 0;
+ }
+
+ public File createLockFile() throws IOException {
+ File lockFile = File.createTempFile(".run", ".vicuna.lock", new File("."));
+
+ System.out.printf("A new lock file was created on %s. Delete this file to stop running%n",
+ lockFile.getAbsolutePath());
+ lockFile.deleteOnExit();
+
+ return lockFile;
+ }
+}
+
+@Command(name = "search", description = "Run a Kamelet")
Review comment:
A typo of description ? it should be "Search a Kamelet"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-872029004
> @orpiske add a jbang-catalog.json file and you can do jbang camel@apache/camel and it will show up on jbang.dev/appstore too :)
Cool, that makes it very nice! I'll include that :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on a change in pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on a change in pull request #5770:
URL: https://github.com/apache/camel/pull/5770#discussion_r662003656
##########
File path: dsl/camel-jbang/CamelJbang.java
##########
@@ -0,0 +1,255 @@
+///usr/bin/env jbang "$0" "$@" ; exit $?
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//DEPS info.picocli:picocli:4.5.0
+//DEPS org.apache.camel:camel-core:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-core-model:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-api:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-main:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-kamelet-main:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-file-watch:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-resourceresolver-github:3.12.0-SNAPSHOT
Review comment:
Thanks @tadayosi! I will try that one today :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: Support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-872943090
I am currently working on removing the fixed camel version on the //DEPS part, so we don't have extra work releasing this. Therefore, I believe we can wait a bit more before merging it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: WIP: preliminary support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-872183416
I'm tempted to say that it does, but I guess @maxandersen can confirm for good. For now, I got it working with:
```
jbang app install CamelJBang@orpiske/camel/camel-16612~dsl/camel-jbang
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: WIP: preliminary support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-872234911
Thanks everyone for the reviews, comments and suggestions. I am marking this one as ready for review.
I also updated the screen casts to match the latest fixes:
Running Kamelet bindings:
[](https://asciinema.org/a/423346)
Searching for Kamelets in the catalog:
[](https://asciinema.org/a/423349)
There are a few more things I'd like to do - like a command to create new Kamelets bindings and so on - but this requires changes in other sub-projects.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske edited a comment on pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske edited a comment on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-871394791
In addition to the community feedback, there's still a few things I want to do before considering this ready:
- Cleanup deps ... maybe using a bom pom
- Take a look at verbosity and see if it can be tuned
- Review packaging ... right now, there's none
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on a change in pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on a change in pull request #5770:
URL: https://github.com/apache/camel/pull/5770#discussion_r662082846
##########
File path: dsl/camel-jbang/CamelJbang.java
##########
@@ -0,0 +1,252 @@
+///usr/bin/env jbang "$0" "$@" ; exit $?
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//REPOS mavencentral,apache=https://repository.apache.org/snapshots
+//DEPS org.apache.camel:camel-bom:3.12.0-SNAPSHOT@pom
+//DEPS org.apache.camel:camel-core
+//DEPS org.apache.camel:camel-core-model
+//DEPS org.apache.camel:camel-api
+//DEPS org.apache.camel:camel-main
+//DEPS org.apache.camel:camel-kamelet-main
+//DEPS org.apache.camel:camel-file-watch
+//DEPS org.apache.camel:camel-resourceresolver-github
+//DEPS org.apache.logging.log4j:log4j-api:2.13.3
+//DEPS org.apache.logging.log4j:log4j-core:2.13.3
+//DEPS org.apache.logging.log4j:log4j-slf4j-impl:2.13.3
+//DEPS info.picocli:picocli:4.5.0
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.concurrent.Callable;
+import java.util.function.Consumer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.github.GitHubResourceResolver;
+import org.apache.camel.main.KameletMain;
+import org.apache.camel.spi.Resource;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.config.Configurator;
+import org.apache.logging.log4j.core.config.DefaultConfiguration;
+
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.Option;
+import picocli.CommandLine.Parameters;
+
+@Command(name = "run", description = "Run a Kamelet")
+class Run implements Callable<Integer> {
+ private CamelContext context;
+
+ @Parameters(description = "The path to the kamelet binding", defaultValue = "")
+ private String binding;
+
+ @Option(names = {"--debug-level"}, defaultValue = "info", description = "Default debug level")
+ private String debugLevel;
+
+ class ShutdownRoute extends RouteBuilder {
+ private File lockFile;
+
+ public ShutdownRoute(File lockFile) {
+ this.lockFile = lockFile;
+ }
+
+ public void configure() {
+ fromF("file-watch://%s?events=DELETE&antInclude=%s", lockFile.getParent(), lockFile.getName())
+ .process(p -> context.shutdown());
+ }
+ }
+
+ @Override
+ public Integer call() throws Exception {
+ switch (debugLevel) {
+ case "trace": Configurator.setRootLevel(Level.TRACE); break;
+ case "debug": Configurator.setRootLevel(Level.DEBUG); break;
+ case "info": Configurator.setRootLevel(Level.INFO); break;
+ case "warn": Configurator.setRootLevel(Level.WARN); break;
+ case "fatal": Configurator.setRootLevel(Level.FATAL); break;
+ default: {
+ System.err.println("Invalid debug level " + debugLevel);
+ return 1;
+ }
+ }
+
+ System.out.println("Starting Camel Jbang!");
+
+ if (binding.isEmpty()) {
+ System.err.println("You must provide a binding file (check --help)");
+
+ return 1;
+ }
+
+ File bindingFile = new File(binding);
+ if (!bindingFile.exists()) {
+ System.err.println("The binding file does not exist");
+
+ return 1;
+ }
+
+ System.setProperty("camel.main.routes-include-pattern", "file:" + binding);
+ System.setProperty("camel.main.name", "CamelJbang");
+
+ KameletMain main = new KameletMain();
+
+ main.configure().addRoutesBuilder(new ShutdownRoute(createLockFile()));
+ main.start();
+ context = main.getCamelContext();
+
+ main.run();
+ return 0;
+ }
+
+ public File createLockFile() throws IOException {
+ File lockFile = File.createTempFile(".run", ".vicuna.lock", new File("."));
+
+ System.out.printf("A new lock file was created on %s. Delete this file to stop running%n",
+ lockFile.getAbsolutePath());
+ lockFile.deleteOnExit();
+
+ return lockFile;
+ }
+}
+
+@Command(name = "search", description = "Search for a Kamelet in the Kamelet catalog")
+class Search implements Callable<Integer> {
+
+ @Option(names = {"--search-term"}, defaultValue = "", description = "Default debug level")
+ private String searchTerm;
+
+ private void downloadResource(File indexFile) throws Exception {
+ KameletMain main = new KameletMain();
+ main.start();
+ CamelContext context = main.getCamelContext();
+
+ try (GitHubResourceResolver resolver = new GitHubResourceResolver()) {
+ resolver.setCamelContext(context);
+
+ Resource resource = resolver.resolve("github:apache:camel-kamelets:docs/modules/ROOT/nav.adoc");
+
+ if (!resource.exists()) {
+ throw new Exception("The resource does not exist");
+ }
+
+ try (FileWriter w = new FileWriter(indexFile)) {
+ Reader resourceReader = resource.getReader();
+
+ resourceReader.transferTo(w);
+ }
+ }
+ }
+
+ /*
+ * Matches the following line. Separate them into groups and pick the last
+ * which contains the description:
+ *
+ * xref:ROOT:mariadb-sink.adoc[image:kamelets/mariadb-sink.svg[] MariaDB Sink]
+ */
+ private void checkForMatches(String line) {
+ Pattern pat = Pattern.compile("(.*):(.*):(.*)\\[(.*)\\[\\] (.*)\\]");
+
+ Matcher matcher = pat.matcher(line);
+
+ if (matcher.find()) {
+ String description = matcher.group(5);
+ String kamelet = matcher.group(3).replace(".adoc", "");
+
+ if (description.toLowerCase().contains(searchTerm.toLowerCase())) {
+ System.out.printf("%-35s %-45s%n", kamelet, description);
+ }
+ }
+ }
+
+ private void printAll(String line) {
+ Pattern pat = Pattern.compile("(.*):(.*):(.*)\\[(.*)\\[\\] (.*)\\]");
+
+ Matcher matcher = pat.matcher(line);
+
+ if (matcher.find()) {
+ String kamelet = matcher.group(3).replace(".adoc", "");
+ String description = matcher.group(5);
+
+ System.out.printf("%-35s %-45s%n", kamelet, description);
+ }
+ }
+
+ private void readFileByLine(File indexFile, Consumer<String> consumer) throws IOException, FileNotFoundException {
+ FileReader indexFileReader = new FileReader(indexFile);
+ try (BufferedReader br = new BufferedReader(indexFileReader)) {
+
+ String line;
+ do {
+ line = br.readLine();
+
+ if (line == null) {
+ break;
+ }
+
+ consumer.accept(line);
+
+ } while (line != null);
+ }
+ }
+
+ @Override
+ public Integer call() throws Exception {
+ File indexFile = new File("index");
+ indexFile.deleteOnExit();
+
+ downloadResource(indexFile);
+
+ System.out.printf("%-35s %-45s%n", "KAMELET", "DESCRIPTION");
+ System.out.printf("%-35s %-45s%n", "-------", "-----------");
+ if (!searchTerm.isEmpty()) {
+ readFileByLine(indexFile, this::checkForMatches);
+ } else {
+ readFileByLine(indexFile, this::printAll);
+ }
+
+ return 0;
+ }
+}
+
+@Command(name = "CamelJbang", mixinStandardHelpOptions = true, version = "CamelJbang 3.12.0-SNAPSHOT",
Review comment:
Thanks. I think I corrected it now :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] tadayosi commented on a change in pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
tadayosi commented on a change in pull request #5770:
URL: https://github.com/apache/camel/pull/5770#discussion_r662001835
##########
File path: dsl/camel-jbang/CamelJbang.java
##########
@@ -0,0 +1,255 @@
+///usr/bin/env jbang "$0" "$@" ; exit $?
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//DEPS info.picocli:picocli:4.5.0
+//DEPS org.apache.camel:camel-core:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-core-model:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-api:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-main:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-kamelet-main:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-file-watch:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-resourceresolver-github:3.12.0-SNAPSHOT
Review comment:
Yeah you can use BOM for the camel deps.
https://github.com/tadayosi/jbang-sandbox/blob/main/camel/camel.java#L2-L5
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] maxandersen commented on a change in pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
maxandersen commented on a change in pull request #5770:
URL: https://github.com/apache/camel/pull/5770#discussion_r662078962
##########
File path: dsl/camel-jbang/CamelJbang.java
##########
@@ -0,0 +1,252 @@
+///usr/bin/env jbang "$0" "$@" ; exit $?
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//REPOS mavencentral,apache=https://repository.apache.org/snapshots
+//DEPS org.apache.camel:camel-bom:3.12.0-SNAPSHOT@pom
+//DEPS org.apache.camel:camel-core
+//DEPS org.apache.camel:camel-core-model
+//DEPS org.apache.camel:camel-api
+//DEPS org.apache.camel:camel-main
+//DEPS org.apache.camel:camel-kamelet-main
+//DEPS org.apache.camel:camel-file-watch
+//DEPS org.apache.camel:camel-resourceresolver-github
+//DEPS org.apache.logging.log4j:log4j-api:2.13.3
+//DEPS org.apache.logging.log4j:log4j-core:2.13.3
+//DEPS org.apache.logging.log4j:log4j-slf4j-impl:2.13.3
+//DEPS info.picocli:picocli:4.5.0
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.concurrent.Callable;
+import java.util.function.Consumer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.github.GitHubResourceResolver;
+import org.apache.camel.main.KameletMain;
+import org.apache.camel.spi.Resource;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.config.Configurator;
+import org.apache.logging.log4j.core.config.DefaultConfiguration;
+
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.Option;
+import picocli.CommandLine.Parameters;
+
+@Command(name = "run", description = "Run a Kamelet")
+class Run implements Callable<Integer> {
+ private CamelContext context;
+
+ @Parameters(description = "The path to the kamelet binding", defaultValue = "")
+ private String binding;
+
+ @Option(names = {"--debug-level"}, defaultValue = "info", description = "Default debug level")
+ private String debugLevel;
+
+ class ShutdownRoute extends RouteBuilder {
+ private File lockFile;
+
+ public ShutdownRoute(File lockFile) {
+ this.lockFile = lockFile;
+ }
+
+ public void configure() {
+ fromF("file-watch://%s?events=DELETE&antInclude=%s", lockFile.getParent(), lockFile.getName())
+ .process(p -> context.shutdown());
+ }
+ }
+
+ @Override
+ public Integer call() throws Exception {
+ switch (debugLevel) {
+ case "trace": Configurator.setRootLevel(Level.TRACE); break;
+ case "debug": Configurator.setRootLevel(Level.DEBUG); break;
+ case "info": Configurator.setRootLevel(Level.INFO); break;
+ case "warn": Configurator.setRootLevel(Level.WARN); break;
+ case "fatal": Configurator.setRootLevel(Level.FATAL); break;
+ default: {
+ System.err.println("Invalid debug level " + debugLevel);
+ return 1;
+ }
+ }
+
+ System.out.println("Starting Camel Jbang!");
+
+ if (binding.isEmpty()) {
+ System.err.println("You must provide a binding file (check --help)");
+
+ return 1;
+ }
+
+ File bindingFile = new File(binding);
+ if (!bindingFile.exists()) {
+ System.err.println("The binding file does not exist");
+
+ return 1;
+ }
+
+ System.setProperty("camel.main.routes-include-pattern", "file:" + binding);
+ System.setProperty("camel.main.name", "CamelJbang");
+
+ KameletMain main = new KameletMain();
+
+ main.configure().addRoutesBuilder(new ShutdownRoute(createLockFile()));
+ main.start();
+ context = main.getCamelContext();
+
+ main.run();
+ return 0;
+ }
+
+ public File createLockFile() throws IOException {
+ File lockFile = File.createTempFile(".run", ".vicuna.lock", new File("."));
+
+ System.out.printf("A new lock file was created on %s. Delete this file to stop running%n",
+ lockFile.getAbsolutePath());
+ lockFile.deleteOnExit();
+
+ return lockFile;
+ }
+}
+
+@Command(name = "search", description = "Search for a Kamelet in the Kamelet catalog")
+class Search implements Callable<Integer> {
+
+ @Option(names = {"--search-term"}, defaultValue = "", description = "Default debug level")
+ private String searchTerm;
+
+ private void downloadResource(File indexFile) throws Exception {
+ KameletMain main = new KameletMain();
+ main.start();
+ CamelContext context = main.getCamelContext();
+
+ try (GitHubResourceResolver resolver = new GitHubResourceResolver()) {
+ resolver.setCamelContext(context);
+
+ Resource resource = resolver.resolve("github:apache:camel-kamelets:docs/modules/ROOT/nav.adoc");
+
+ if (!resource.exists()) {
+ throw new Exception("The resource does not exist");
+ }
+
+ try (FileWriter w = new FileWriter(indexFile)) {
+ Reader resourceReader = resource.getReader();
+
+ resourceReader.transferTo(w);
+ }
+ }
+ }
+
+ /*
+ * Matches the following line. Separate them into groups and pick the last
+ * which contains the description:
+ *
+ * xref:ROOT:mariadb-sink.adoc[image:kamelets/mariadb-sink.svg[] MariaDB Sink]
+ */
+ private void checkForMatches(String line) {
+ Pattern pat = Pattern.compile("(.*):(.*):(.*)\\[(.*)\\[\\] (.*)\\]");
+
+ Matcher matcher = pat.matcher(line);
+
+ if (matcher.find()) {
+ String description = matcher.group(5);
+ String kamelet = matcher.group(3).replace(".adoc", "");
+
+ if (description.toLowerCase().contains(searchTerm.toLowerCase())) {
+ System.out.printf("%-35s %-45s%n", kamelet, description);
+ }
+ }
+ }
+
+ private void printAll(String line) {
+ Pattern pat = Pattern.compile("(.*):(.*):(.*)\\[(.*)\\[\\] (.*)\\]");
+
+ Matcher matcher = pat.matcher(line);
+
+ if (matcher.find()) {
+ String kamelet = matcher.group(3).replace(".adoc", "");
+ String description = matcher.group(5);
+
+ System.out.printf("%-35s %-45s%n", kamelet, description);
+ }
+ }
+
+ private void readFileByLine(File indexFile, Consumer<String> consumer) throws IOException, FileNotFoundException {
+ FileReader indexFileReader = new FileReader(indexFile);
+ try (BufferedReader br = new BufferedReader(indexFileReader)) {
+
+ String line;
+ do {
+ line = br.readLine();
+
+ if (line == null) {
+ break;
+ }
+
+ consumer.accept(line);
+
+ } while (line != null);
+ }
+ }
+
+ @Override
+ public Integer call() throws Exception {
+ File indexFile = new File("index");
+ indexFile.deleteOnExit();
+
+ downloadResource(indexFile);
+
+ System.out.printf("%-35s %-45s%n", "KAMELET", "DESCRIPTION");
+ System.out.printf("%-35s %-45s%n", "-------", "-----------");
+ if (!searchTerm.isEmpty()) {
+ readFileByLine(indexFile, this::checkForMatches);
+ } else {
+ readFileByLine(indexFile, this::printAll);
+ }
+
+ return 0;
+ }
+}
+
+@Command(name = "CamelJbang", mixinStandardHelpOptions = true, version = "CamelJbang 3.12.0-SNAPSHOT",
Review comment:
fyi, its JBang, jbang is the command, Jbang is a mistake :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on a change in pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on a change in pull request #5770:
URL: https://github.com/apache/camel/pull/5770#discussion_r662003202
##########
File path: dsl/camel-jbang/CamelJbang.java
##########
@@ -0,0 +1,255 @@
+///usr/bin/env jbang "$0" "$@" ; exit $?
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//DEPS info.picocli:picocli:4.5.0
+//DEPS org.apache.camel:camel-core:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-core-model:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-api:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-main:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-kamelet-main:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-file-watch:3.12.0-SNAPSHOT
+//DEPS org.apache.camel:camel-resourceresolver-github:3.12.0-SNAPSHOT
+//DEPS org.apache.logging.log4j:log4j-api:2.13.3
+//DEPS org.apache.logging.log4j:log4j-core:2.13.3
+//DEPS org.apache.logging.log4j:log4j-slf4j-impl:2.13.3
+//FILES application.properties
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.nio.channels.Channels;
+import java.nio.channels.FileChannel;
+import java.nio.channels.ReadableByteChannel;
+import java.util.concurrent.Callable;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.function.Consumer;
+
+import org.apache.camel.main.KameletMain;
+import org.apache.camel.spi.Resource;
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.github.GitHubResourceResolver;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.config.Configurator;
+import org.apache.logging.log4j.core.config.DefaultConfiguration;
+
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+import picocli.CommandLine.Parameters;
+import picocli.CommandLine.Option;
+
+@Command(name = "run", description = "Run a Kamelet")
+class Run implements Callable<Integer> {
+ private CamelContext context;
+
+ @Parameters(description = "The path to the kamelet binding", defaultValue = "")
+ private String binding;
+
+ @Option(names = {"--debug-level"}, defaultValue = "info", description = "Default debug level")
+ private String debugLevel;
+
+ class ShutdownRoute extends RouteBuilder {
+ private File lockFile;
+
+ public ShutdownRoute(File lockFile) {
+ this.lockFile = lockFile;
+ }
+
+ public void configure() {
+ fromF("file-watch://%s?events=DELETE&antInclude=%s", lockFile.getParent(), lockFile.getName())
+ .process(p -> context.shutdown());
+ }
+ }
+
+ @Override
+ public Integer call() throws Exception {
+ switch (debugLevel) {
+ case "trace": Configurator.setRootLevel(Level.TRACE); break;
+ case "debug": Configurator.setRootLevel(Level.DEBUG); break;
+ case "info": Configurator.setRootLevel(Level.INFO); break;
+ case "warn": Configurator.setRootLevel(Level.WARN); break;
+ case "fatal": Configurator.setRootLevel(Level.FATAL); break;
+ default: {
+ System.err.println("Invalid debug level " + debugLevel);
+ return 1;
+ }
+ }
+
+ System.out.println("Starting Camel Jbang!");
+
+ if (binding.isEmpty()) {
+ System.err.println("You must provide a binding file (check --help)");
+
+ return 1;
+ }
+
+ File bindingFile = new File(binding);
+ if (!bindingFile.exists()) {
+ System.err.println("The binding file does not exist");
+
+ return 1;
+ }
+
+ System.setProperty("camel.main.routes-include-pattern", "file:" + binding);
+ System.setProperty("camel.main.name", "CamelJbang");
+
+ KameletMain main = new KameletMain();
+
+ main.configure().addRoutesBuilder(new ShutdownRoute(createLockFile()));
+ main.start();
+ context = main.getCamelContext();
+
+ main.run();
+ return 0;
+ }
+
+ public File createLockFile() throws IOException {
+ File lockFile = File.createTempFile(".run", ".vicuna.lock", new File("."));
+
+ System.out.printf("A new lock file was created on %s. Delete this file to stop running%n",
+ lockFile.getAbsolutePath());
+ lockFile.deleteOnExit();
+
+ return lockFile;
+ }
+}
+
+@Command(name = "search", description = "Run a Kamelet")
Review comment:
You are right! thanks @zhfeng :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] maxandersen commented on pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
maxandersen commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-872029227
oh and jbang app install camel@apache/camel and you get camel in your path.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: Support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-875560397
Today's feature is that I added the ability to also search for component information (with links).
The search command changed a bit, it is now `search kamelets --search-term=jms` or `search components --search-term=jms`. Later I'll add search for languages and data formats.
Here's the screencast:
[](https://asciinema.org/a/424286)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] davsclaus commented on pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
davsclaus commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-871922234
Oh the search thingy with the embedded catalog is lovely
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-871394791
In addition to the community feedback, there's still a few things I want to do before consider this ready:
- Cleanup deps ... maybe using a bom pom
- Take a look at verbosity and see if it can be tuned
- Review packaging ... right now, there's none
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske edited a comment on pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske edited a comment on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-872029004
> @orpiske add a jbang-catalog.json file and you can do jbang camel@apache/camel and it will show up on jbang.dev/appstore too :)
Thanks! Cool, that makes it very nice! I'll include that :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] davsclaus commented on pull request #5770: Support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
davsclaus commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-873072265
The more features you add, then the more we look forward to your write a blog post to introduce this and publish on the camel front page
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske edited a comment on pull request #5770: Support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske edited a comment on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-872943090
I am currently working on removing the fixed camel version on the `//DEPS` part, so we don't have extra work releasing this. Therefore, I believe we can wait a bit more before merging it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: Support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-876580222
@davsclaus @oscerd I think I've got enough for an initial PR and we are good to go. There are more things I'd like to implement, but I'd like to wait for Claus' work on CAMEL-16757 so I can extend on top of that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: WIP: preliminary support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-872200268
> If you want the short name then yes.
>
> It can also be in subfolders but then you need to add the path = longer name.
>
> Alternatively create Apache/jbang-catalog and it can be jbang camwl@apache - even shorter :)
@maxandersen Thanks. I tried moving the catalog file to the root and modified it like this:
```
{
"catalogs": {},
"aliases": {
"CamelJBang": {
"script-ref": "dsl/camel-jbang/CamelJBang.java",
"description": "A JBang-based Camel app for running Kamelets"
}
}
}
```
But it did not seem to have worked. Did I miss anything?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: Support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-873074004
> The more features you add, then the more we look forward to your write a blog post to introduce this and publish on the camel front page
Oh, count me in @davsclaus :+1: I am looking forward to getting this one in a good shape and writing a nice blog post with that as well!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske merged pull request #5770: Support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske merged pull request #5770:
URL: https://github.com/apache/camel/pull/5770
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] maxandersen commented on pull request #5770: WIP: preliminary support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
maxandersen commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-872206624
You'll need to use your branch repo name to have it work.
The short name won't work until merged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] maxandersen commented on pull request #5770: Support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
maxandersen commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-873170820
In case you missed it jbang supports default property values.
${camel.jbang.version:RELEASE}
Then default use of jbang camel@apache/camel will get latest release.
And you can always do jbang -Dcamel.jbang.version=3.0.2 camel@apache/camel for specific version control.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: WIP: preliminary support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-872206864
> But it did not seem to have worked. Did I miss anything?
Nevermind. I had to remove `~/.jbang`. Now this worked:
`jbang app install CamelJBang@orpiske/camel/camel-16612`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] maxandersen commented on pull request #5770: Support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
maxandersen commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-872441648
You shouldn't have to remove .Jbang. At most run with jbang --fresh to ensure you get the latest.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] davsclaus commented on pull request #5770: Support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
davsclaus commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-876981330
Yeah sounds good, its good to get something out there and you can also write a blog , record a video or something to start introducing this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-871593904
@davsclaus Thanks!
Here's a fresh new feature ... searching for Kamelets via CLI
[](https://asciinema.org/a/423188)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] maxandersen commented on pull request #5770: WIP: preliminary support for JBang within Camel
Posted by GitBox <gi...@apache.org>.
maxandersen commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-872197279
If you want the short name then yes.
It can also be in subfolders but then you need to add the path = longer name.
Alternatively create Apache/jbang-catalog and it can be jbang camwl@apache - even shorter :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-872020637
As for packaging, I am not sure if it is actually needed. I was playing with Apache Short URL service and I think we could just have something like this on the website:
```
jbang https://s.apache.org/try-camel-jbang-dev search --search-term=jms
```
Of course, we replace the `try-camel-jbang-dev` with `try-camel` or similar.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on pull request #5770: WIP: preliminary support for Jbang within Camel
Posted by GitBox <gi...@apache.org>.
orpiske commented on pull request #5770:
URL: https://github.com/apache/camel/pull/5770#issuecomment-871399687
A few limitations:
* Native mode is not supported because dependencies cannot be resolved during build time
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org