davsclaus opened a new pull request, #29929: URL: https://github.com/apache/camel/pull/29929
Item 6 of [CAMEL-26931](https://issues.apache.org/jira/browse/CAMEL-26931): `camel init` wrote the wrong file. ## Problems and changes - **The kind of a Kamelet came from the whole path.** `file.contains("source")` was checked on the path, so `src/main/resources/kamelets/my-filter.kamelet.yaml` became a source Kamelet ("resources" contains "source"). The kind now comes from the file name: `my-source.kamelet.yaml` is a source, `my-sink.kamelet.yaml` a sink, the others an action. - **A file given as `./x.yaml` ignored `--dir`.** It was written in the current directory, as the parent folder `.` was treated as "no folder". The file is now resolved in the directory and normalized, so `./x.yaml` with `--dir=out` is `out/x.yaml`. - **`camel init my-route.java` and `camel init 1bad.java` wrote classes that do not compile**, with exit 0. A Java file whose name is not a Java class name is now a usage error (exit 2), "my-route is not a Java class name: name the file like a class, such as MyRoute.java", and nothing is written. ## Tests - `InitTest`: a file given with `./` goes in the directory (and not in the current one); `my-filter.kamelet.yaml` under `resources` is an action Kamelet; `my-route.java` is refused with nothing written. - `InitTest`: 23 tests pass. camel-jbang-run: 303. camel-jbang-core: 3005 + 259. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
