use of io.micronaut.starter.template.Writable in project micronaut-starter by micronaut-projects.
the class Readme method apply.
@Override
public void apply(GeneratorContext generatorContext) {
List<Feature> featuresWithDocumentationLinks = generatorContext.getFeatures().getFeatures().stream().filter(feature -> feature.getMicronautDocumentation() != null || feature.getThirdPartyDocumentation() != null).collect(Collectors.toList());
List<Writable> helpTemplates = generatorContext.getHelpTemplates();
if (!helpTemplates.isEmpty() || !featuresWithDocumentationLinks.isEmpty()) {
generatorContext.addTemplate("readme", new Template() {
@Override
public String getPath() {
return "README.md";
}
@Override
public void write(OutputStream outputStream) throws IOException {
for (Writable writable : generatorContext.getHelpTemplates()) {
writable.write(outputStream);
}
for (Feature feature : featuresWithDocumentationLinks) {
Writable writable = new RockerWritable(readme.template(feature));
writable.write(outputStream);
}
}
});
}
}
Aggregations