feat(gherkin-to-asciidoc): write report snippets and support custom Mustache templates - #79
Merged
Merged
Conversation
…ustache templates Adds two DSL properties, consulted only when trackProgress is true: - snippetDir (default: build/generated-docs/features/snippets): every run now writes listed.adoc/defined.adoc/implemented.adoc snippet files containing exactly the scenario bullets that status's section would otherwise embed. When groupByFeature is also true, a status with at least one scenario writes one snippet file per feature instead, under <snippetDir>/<camelCaseFeatureTitle>/<status>.adoc. Snippets are written unconditionally, regardless of whether a template is configured. - template (optional): a Mustache file used to render the report so that it references the snippets via include:: directives instead of embedding their content verbatim. Without one, the report looks exactly as it did before this change. groupByFeature is now also genuinely respected in tracking mode instead of being unconditionally forced on internally: it still defaults to true whenever trackProgress is true (same as before), but can be explicitly set to false to get a flat, non-grouped progress report - needed to produce flat snippets/reports at all. New classes: FeatureNameFormatter (camelCase directory naming), SnippetWriter (+ FeatureSnippet/StatusSnippets), ProgressReportOptions, ReportTemplateRenderer (Mustache, via com.github.spullara.mustache.java), ReportText (explanatory copy shared between the default writer and the template context), StatusSummary. ProgressReportWriter now orchestrates classification, snippet writing, and dispatches to either the template renderer or the existing verbatim writer. Includes two reference templates (test resources templates/grouped.mustache and templates/flat.mustache, also documented in the plugin README) verified by DefaultEquivalentTemplatesTest to reproduce - once their include:: directives are resolved - byte-identical output to the report with no template configured, for both grouped and flat modes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…g all 4 combinations
Adds a new example project that registers four GenerateFeatureDocsTask
instances directly in build.gradle - one per combination of
groupByFeature (grouped/flat) and template (with/without) - all
against the same auth + billing feature/glue content used by the
progress-tracking example, so the four generated reports are easy to
compare side by side. Bypassing the gherkinToAsciidoc { } extension
like this only makes sense for demonstrating multiple configurations
from one project; a real project only needs one.
Includes the two reference templates from the plugin README
(templates/grouped.mustache, templates/flat.mustache) copied verbatim,
and a generateAllReports task that runs all four.
Verified against a local publishToMavenLocal build before pinning the
version catalog to 1.2.0 (the next version given this is an additive,
non-breaking pair of properties on top of the released 1.1.0); won't
build against the Gradle Plugin Portal until 1.2.0 is actually
released - same caveat as previous example additions.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…deprecated buildDir Explains what sections[].blurb means in the Mustache context table (previously only listed as a field name) and breaks down every sections field individually. Adds the "a" (AsciiDoc) column style so the new bullet list actually renders as a list instead of flat text. Also replaces the deprecated Groovy buildDir project property in the DSL default-value docs (outputDir, snippetDir) with layout.buildDirectory, matching what the plugin's own code and Kotlin DSL examples already used. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Owner
Author
|
🎉 This PR is included in version 1.2.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
snippetDir(defaultbuild/generated-docs/features/snippets): whenevertrackProgressis on,listed.adoc/defined.adoc/implemented.adocsnippet files are now always written, containing exactly the scenario bullets each status's section would otherwise embed. WhengroupByFeatureis also true, a status with at least one scenario writes one snippet file per feature instead, under<snippetDir>/<camelCaseFeatureTitle>/<status>.adoc. Snippets are written unconditionally, regardless of whether a template is configured.template(optional): a Mustache file used to render the report so it references the snippets viainclude::directives instead of embedding their content verbatim. Without one, the report looks exactly as it did before this change.groupByFeatureis now genuinely respected in tracking mode instead of being unconditionally forced on internally — it still defaults totruewhenevertrackProgressistrue, but can be explicitly set tofalsefor a flat, non-grouped progress report (needed to produce the flat/non-grouped combination at all).FeatureNameFormatter(camelCase directory naming),SnippetWriter(+FeatureSnippet/StatusSnippets),ProgressReportOptions,ReportTemplateRenderer(viacom.github.spullara.mustache.java),ReportText,StatusSummary.templates/grouped.mustache,templates/flat.mustache), documented in full in the plugin README with the Mustache context data model spelled out, are verified byDefaultEquivalentTemplatesTestto reproduce — once theirinclude::directives are resolved — byte-identical output to the report with no template configured, for both grouped and flat modes.snippet-templatesregisters all four combinations (grouped/flat × template/no-template) as separate tasks in onebuild.gradle, so the four reports are easy to compare side by side.