Skip to content

Commit

Permalink
Update mustache format in archetype files (helidon-io#6287)
Browse files Browse the repository at this point in the history
Signed-off-by: tvallin <thibault.vallin@oracle.com>
  • Loading branch information
tvallin authored Feb 28, 2023
1 parent b7512d1 commit 1b0cf7a
Show file tree
Hide file tree
Showing 19 changed files with 44 additions and 88 deletions.
6 changes: 2 additions & 4 deletions archetypes/helidon/src/main/archetype/common/docker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ docker build -t {{artifactId}} .
## Running the Docker Image
{{#docker-run-readme-section}}
{{.}}
{{#docker-run-readme-section}}{{.}}
{{/docker-run-readme-section}}
{{^docker-run-readme-section}}
```
Expand All @@ -92,8 +91,7 @@ Exercise the application as described above.
<![CDATA[
## Building a Native Image
{{#native-sections}}
{{.}}
{{#native-sections}}{{.}}
{{/native-sections}}
]]>
</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

## Build and run

{{#readme-run-notes}}
{{.}}
{{#readme-run-notes}}{{.}}
{{/readme-run-notes}}

{{#readme-run-commands}}
{{.}}
{{#readme-run-commands}}{{.}}
{{/readme-run-commands}}
{{^readme-run-commands}}
With JDK17+
Expand All @@ -20,10 +18,8 @@ java -jar target/{{artifactId}}.jar
{{/readme-run-commands}}

## Exercise the application
{{#readme-exercise-the-application}}
{{.}}
{{#readme-exercise-the-application}}{{.}}
{{/readme-exercise-the-application}}

{{#readme-sections}}
{{.}}
{{#readme-sections}}{{.}}
{{/readme-sections}}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
</execution>
</executions>
</plugin>
{{#maven-plugins}}
{{.}}
{{#maven-plugins}}{{.}}
{{/maven-plugins}}
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,7 @@ curl -H 'Accept: application/json' -X GET http://localhost:8080/metrics
<value template="mustache" order="0"><![CDATA[
HealthSupport health = HealthSupport.builder()
.addLiveness(HealthChecks.healthChecks()) // Adds a convenient set of checks
{{#Main-healthBuilder}}
{{.}}
{{#Main-healthBuilder}}{{.}}
{{/Main-healthBuilder}}
.build();]]>
</value>
Expand Down
3 changes: 1 addition & 2 deletions archetypes/helidon/src/main/archetype/common/packaging.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ kubectl get pods # Verify connectivity to cluster
{{#k8s-readme-sections}}
{{#first}}
{{/first}}
{{.}}
{{/first}}{{.}}
{{/k8s-readme-sections}}
### Deploy the application to Kubernetes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ server.host=0.0.0.0
# Change the following to true to enable the optional MicroProfile Metrics REST.request metrics
metrics.rest-request.enabled=false

{{#microprofile-config-entries}}
{{.}}
{{#microprofile-config-entries}}{{.}}
{{/microprofile-config-entries}}

{{#database-hikari}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
{{#security}}
security:
providers:
{{#providers-config-entries}}
{{.}}
{{#providers-config-entries}}{{.}}
{{/providers-config-entries}}
web-server:
# protected paths on the web server - do not include paths served by Jersey, as those are protected directly
paths:
{{#paths-config-entries}}
{{.}}
{{#paths-config-entries}}{{.}}
{{/paths-config-entries}}
{{/security}}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ handlers=io.helidon.common.HelidonConsoleHandler
{{#oci-logging-entries}}
{{#first}}

{{/first}}
{{.}}
{{/first}}{{.}}
{{/oci-logging-entries}}

# HelidonConsoleHandler uses a SimpleFormatter subclass that replaces "!thread!" with the current thread
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ import {{.}};
{{/helidon-test}}
class MainTest {
{{#helidon-test}}
{{#MainTest-static-fields}}
{{.}}
{{#MainTest-static-fields}}{{.}}
{{/MainTest-static-fields}}

@Inject
private WebTarget target;

{{#MainTest-methods}}
{{.}}
{{#MainTest-methods}}{{.}}
{{/MainTest-methods}}
{{/helidon-test}}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import org.eclipse.microprofile.config.inject.ConfigProperty;
*/
@Path("/simple-greet")
public class SimpleGreetResource {
{{#SimpleGreetResource-static-fields}}
{{.}}
{{#SimpleGreetResource-static-fields}}{{.}}
{{/SimpleGreetResource-static-fields}}
private final String message;

Expand All @@ -50,8 +49,7 @@ public class SimpleGreetResource {
return message;
}

{{#SimpleGreetService-methods}}
{{.}}
{{#SimpleGreetService-methods}}{{.}}
{{/SimpleGreetService-methods}}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ import org.eclipse.microprofile.config.inject.ConfigProperty;
*/
@Path("/simple-greet")
public class SimpleGreetResource {
{{#SimpleGreetResource-static-fields}}
{{.}}
{{#SimpleGreetResource-static-fields}}{{.}}
{{/SimpleGreetResource-static-fields}}
private static final JsonBuilderFactory JSON = Json.createBuilderFactory(Collections.emptyMap());

Expand All @@ -55,8 +54,7 @@ public class SimpleGreetResource {
.build();
}

{{#SimpleGreetService-methods}}
{{.}}
{{#SimpleGreetService-methods}}{{.}}
{{/SimpleGreetService-methods}}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import org.eclipse.microprofile.config.inject.ConfigProperty;
*/
@Path("/simple-greet")
public class SimpleGreetResource {
{{#SimpleGreetResource-static-fields}}
{{.}}
{{#SimpleGreetResource-static-fields}}{{.}}
{{/SimpleGreetResource-static-fields}}

private final String message;
Expand All @@ -48,8 +47,7 @@ public class SimpleGreetResource {
return String.format("%s %s!", message, "World");
}

{{#SimpleGreetService-methods}}
{{.}}
{{#SimpleGreetService-methods}}{{.}}
{{/SimpleGreetService-methods}}

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public final class Main {
WebServer server = WebServer.builder(createRouting(config))
.config(config.get("server"))
{{#Main-serverBuilder}}
{{.}}
{{#Main-serverBuilder}}{{.}}
{{/Main-serverBuilder}}
.build();

Expand All @@ -77,17 +76,14 @@ public final class Main {
* @param config configuration of this server
*/
private static Routing createRouting(Config config) {
{{#Main-createRouting}}
{{.}}
{{#Main-createRouting}}{{.}}
{{/Main-createRouting}}

Routing.Builder builder = Routing.builder()
{{#Main-routingBuilder}}
{{.}}{{#last}}; {{/last}}
{{#Main-routingBuilder}}{{.}}{{#last}}; {{/last}}
{{/Main-routingBuilder}}

{{#Main-security-routing-section}}
{{.}}
{{#Main-security-routing-section}}{{.}}
{{/Main-security-routing-section}}

return builder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@ server:
port: 8080
host: 0.0.0.0

{{#application-yaml-entries}}
{{.}}
{{#application-yaml-entries}}{{.}}
{{/application-yaml-entries}}

{{#security}}
security:
providers:
{{#providers-config-entries}}
{{.}}
{{#providers-config-entries}}{{.}}
{{/providers-config-entries}}
web-server:
# protected paths on the web server - do not include paths served by Jersey, as those are protected directly
paths:
{{#paths-config-entries}}
{{.}}
{{#paths-config-entries}}{{.}}
{{/paths-config-entries}}
{{/security}}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import {{.}};

class MainTest {
{{#MainTest-static-fields}}
{{.}}
{{#MainTest-static-fields}}{{.}}
{{/MainTest-static-fields}}

private static WebServer webServer;
Expand All @@ -32,8 +31,7 @@ class MainTest {
webClient = WebClient.builder()
.baseUri("http://localhost:" + webServer.port())
{{#MainTest-clientBuilder}}
{{.}}
{{#MainTest-clientBuilder}}{{.}}
{{/MainTest-clientBuilder}}
.build();
}
Expand All @@ -47,7 +45,6 @@ class MainTest {
}
}

{{#MainTest-methods}}
{{.}}
{{#MainTest-methods}}{{.}}
{{/MainTest-methods}}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ app:
security:
enabled: false

{{#config-test}}
{{.}}
{{#config-test}}{{.}}
{{/config-test}}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import io.helidon.webserver.Service;
public class SimpleGreetService implements Service {
private static final Logger LOGGER = Logger.getLogger(SimpleGreetService.class.getName());
{{#SimpleGreetResource-static-fields}}
{{.}}
{{#SimpleGreetResource-static-fields}}{{.}}
{{/SimpleGreetResource-static-fields}}

private final String greeting;
Expand All @@ -32,8 +31,7 @@ public class SimpleGreetService implements Service {
greeting = config.get("app.greeting").asString().orElse("Ciao");
}

{{#SimpleGreetResource-constructor}}
{{.}}
{{#SimpleGreetResource-constructor}}{{.}}
{{/SimpleGreetResource-constructor}}

/**
Expand All @@ -44,8 +42,7 @@ public class SimpleGreetService implements Service {
@Override
public void update(Routing.Rules rules) {
rules.get("/", this::getDefaultMessageHandler);
{{#SimpleGreetResource-update}}
{{.}}
{{#SimpleGreetResource-update}}{{.}}
{{/SimpleGreetResource-update}}
}

Expand All @@ -65,7 +62,6 @@ public class SimpleGreetService implements Service {
response.send(message);
}

{{#SimpleGreetService-methods}}
{{.}}
{{#SimpleGreetService-methods}}{{.}}
{{/SimpleGreetService-methods}}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public class SimpleGreetService implements Service {
private static final Logger LOGGER = Logger.getLogger(SimpleGreetService.class.getName());
private static final JsonBuilderFactory JSON = Json.createBuilderFactory(Collections.emptyMap());
{{#SimpleGreetResource-static-fields}}
{{.}}
{{#SimpleGreetResource-static-fields}}{{.}}
{{/SimpleGreetResource-static-fields}}

private final String greeting;
Expand All @@ -38,8 +37,7 @@ public class SimpleGreetService implements Service {
greeting = config.get("app.greeting").asString().orElse("Ciao");
}

{{#SimpleGreetResource-constructor}}
{{.}}
{{#SimpleGreetResource-constructor}}{{.}}
{{/SimpleGreetResource-constructor}}

/**
Expand All @@ -50,8 +48,7 @@ public class SimpleGreetService implements Service {
@Override
public void update(Routing.Rules rules) {
rules.get("/", this::getDefaultMessageHandler);
{{#SimpleGreetResource-update}}
{{.}}
{{#SimpleGreetResource-update}}{{.}}
{{/SimpleGreetResource-update}}
}

Expand All @@ -70,7 +67,6 @@ public class SimpleGreetService implements Service {
response.send(returnObject);
}

{{#SimpleGreetService-methods}}
{{.}}
{{#SimpleGreetService-methods}}{{.}}
{{/SimpleGreetService-methods}}
}
Loading

0 comments on commit 1b0cf7a

Please sign in to comment.