From 7402b9c4149d6b07d68ecd6098a66fa1bfdf9988 Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Sat, 17 Oct 2026 05:37:32 -0400 Subject: [PATCH] fix(docs): no .env step when a combo has no .env --- dbuild/templates/README.j2 | 6 ++++++ dbuild/templates/README.mkdocs.j2 | 5 +++++ tests/test_docs.py | 15 +++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/dbuild/templates/README.j2 b/dbuild/templates/README.j2 index e52a615..5fdcb80 100644 --- a/dbuild/templates/README.j2 +++ b/dbuild/templates/README.j2 @@ -440,6 +440,8 @@ Before deploying, ensure your host environment is ready. See the [Quick Start Gu {{ cb.doc }} {%- endif %} +{%- if cb.example_env | trim %} + **1.** Save as `.env`{% if cb.ask %} and fill in {{ cb.ask | map(attribute='label') | join(', ') }}{% else %} and fill in what is empty{% endif %}: ```env { data-zip-bundle="{{ cb.zip }}" data-zip-filename=".env" } @@ -447,6 +449,10 @@ Before deploying, ensure your host environment is ready. See the [Quick Start Gu ``` **2.** Save as `compose.yaml`: +{%- else %} + +Save as `compose.yaml`: +{%- endif %} ```yaml { data-zip-bundle="{{ cb.zip }}" data-zip-filename="compose.yaml" } {{ cb.compose_text | trim }} diff --git a/dbuild/templates/README.mkdocs.j2 b/dbuild/templates/README.mkdocs.j2 index a66b279..9e78374 100644 --- a/dbuild/templates/README.mkdocs.j2 +++ b/dbuild/templates/README.mkdocs.j2 @@ -44,6 +44,8 @@ {% if cb.doc %} {{ cb.doc }} {% endif %} +{#- No .env at all (SQLite: nothing to set): no step asking to fill one in. #} +{% if cb.example_env_site | trim -%} **1.** Save as `.env`{% if cb.ask %} and fill in {{ cb.ask | map(attribute='label') | join(', ') }}{% else %} and fill in what is empty{% endif %}: ```env { data-zip-bundle="{{ cb.zip }}" data-zip-filename=".env" } @@ -51,6 +53,9 @@ ``` **2.** Save as `compose.yaml`: +{%- else -%} +Save as `compose.yaml`: +{%- endif %} ```yaml { data-zip-bundle="{{ cb.zip }}" data-zip-filename="compose.yaml" } {{ cb.compose_text_site | trim }} diff --git a/tests/test_docs.py b/tests/test_docs.py index b84fa3d..e714c7a 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -1081,3 +1081,18 @@ def test_a_plain_quote_is_left_alone(self): def test_important_and_caution_keep_their_word(self): self.assertTrue(docs._site_alerts("> [!IMPORTANT]\n> x\n").startswith('!!! info "Important"\n')) self.assertTrue(docs._site_alerts("> [!CAUTION]\n> x\n").startswith('!!! danger "Caution"\n')) + + +class TestNoEnvStep(unittest.TestCase): + def test_a_combination_without_env_has_no_env_step(self): + with tempfile.TemporaryDirectory() as d: + tmp = Path(d) + (tmp / "compose.yaml").write_text(_toggles_compose(2)) + (tmp / "Containerfile.j2").write_text(CONTAINERFILE_J2) + with _chdir(tmp): + cfg = dbuild_config.load(tmp) + outputs, errors = docs.render_generated(cfg, argparse.Namespace(community=None), tmp) + self.assertEqual(errors, []) + podman = outputs["README.md"].split("### Podman Compose", 1)[1].split("### AppJail", 1)[0] + self.assertNotIn("Save as `.env`", podman, "no .env to fill in") + self.assertIn("Save as `compose.yaml`:", podman)