Skip to content

Commit

Permalink
Use main.java for JBang projects
Browse files Browse the repository at this point in the history
  • Loading branch information
ebullient committed Jun 3, 2021
1 parent cc94f11 commit 2f8cc95
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ Path valdiateJBangSourcePackage(Path project, String name) {
Assertions.assertTrue(packagePath.toFile().isDirectory(),
"Package directory should be a directory: " + packagePath.toAbsolutePath().toString());

return packagePath.resolve("GreetingResource.java");
return packagePath.resolve("main.java");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ language:
base:
data:
command:
class-name: GreetingCommand
class-name: main
name: Greeting
dependencies:
- io.quarkus:quarkus-picocli
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ language:
base:
data:
resource:
class-name: GreetingResource
class-name: main
path: "/hello-resteasy"
response: "Hello RESTEasy"
dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void generateDefaultProject(TestInfo testInfo) throws Throwable {
final Path projectDir = testDirPath.resolve("default");
getCatalog().createProject(input).generate(projectDir);
assertThatDirectoryTreeMatchSnapshots(testInfo, projectDir);
assertThatMatchSnapshot(testInfo, projectDir, "src/GreetingResource.java");
assertThatMatchSnapshot(testInfo, projectDir, "src/main.java");
}

@Test
Expand All @@ -47,7 +47,7 @@ void generatePicocliProject(TestInfo testInfo) throws Throwable {
final Path projectDir = testDirPath.resolve("picocli");
getCatalog().createProject(input).generate(projectDir);
assertThatDirectoryTreeMatchSnapshots(testInfo, projectDir);
assertThatMatchSnapshot(testInfo, projectDir, "src/GreetingCommand.java");
assertThatMatchSnapshot(testInfo, projectDir, "src/main.java");
}

private QuarkusJBangCodestartCatalog getCatalog() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ README.md
jbang
jbang.cmd
src/
src/GreetingResource.java
src/main.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@Path("/hello-resteasy")
@ApplicationScoped
public class GreetingResource {
public class main {

@GET
public String sayHello() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ README.md
jbang
jbang.cmd
src/
src/GreetingCommand.java
src/main.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import picocli.CommandLine.Parameters;

@Command(name = "Greeting", mixinStandardHelpOptions = true)
public class GreetingCommand {
public class main {

@Parameters(paramLabel = "<name>", defaultValue = "picocli",
description = "Your name.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void createRESTEasy() throws Exception {

assertThat(projectDir.resolve("jbang")).exists();

assertThat(projectDir.resolve("src/GreetingResource.java"))
assertThat(projectDir.resolve("src/main.java"))
.exists()
.satisfies(checkContains("//usr/bin/env jbang \"$0\" \"$@\" ; exit $?"))
.satisfies(checkContains("//DEPS io.quarkus:quarkus-resteasy"));
Expand All @@ -45,7 +45,7 @@ public void createRESTEasyWithNoJBangWrapper() throws Exception {

assertThat(projectDir.resolve("jbang")).doesNotExist();

assertThat(projectDir.resolve("src/GreetingResource.java"))
assertThat(projectDir.resolve("src/main.java"))
.exists()
.satisfies(checkContains("//usr/bin/env jbang \"$0\" \"$@\" ; exit $?"))
.satisfies(checkContains("//DEPS io.quarkus:quarkus-resteasy"));
Expand All @@ -65,7 +65,7 @@ public void createRESTEasyWithExtensions() throws Exception {

assertThat(projectDir.resolve("jbang")).exists();

assertThat(projectDir.resolve("src/GreetingResource.java"))
assertThat(projectDir.resolve("src/main.java"))
.exists()
.satisfies(checkContains("//usr/bin/env jbang \"$0\" \"$@\" ; exit $?"))
.satisfies(checkContains("//DEPS io.quarkus:quarkus-resteasy"))
Expand Down

0 comments on commit 2f8cc95

Please sign in to comment.