public void apply()

in grails-forge-core/src/main/java/org/grails/forge/feature/other/Readme.java [53:79]


    public void apply(GeneratorContext generatorContext) {
        List<Feature> featuresWithDocumentationLinks = generatorContext.getFeatures().getFeatures().stream().filter(feature -> feature.getDocumentation() != 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 {
                    Writable mainDocsWritable = new RockerWritable(maindocs.template());
                    mainDocsWritable.write(outputStream);

                    for (Writable writable : generatorContext.getHelpTemplates()) {
                        writable.write(outputStream);
                    }

                    for (Feature feature : featuresWithDocumentationLinks) {
                        Writable writable = new RockerWritable(readme.template(feature));
                        writable.write(outputStream);
                    }
                }
            });
        }
    }