Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions dbuild/templates/README.j2
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,19 @@ 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" }
{{ cb.example_env | trim }}
```

**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 }}
Expand Down
5 changes: 5 additions & 0 deletions dbuild/templates/README.mkdocs.j2
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@
{% 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" }
{{ cb.example_env_site | trim }}
```

**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 }}
Expand Down
15 changes: 15 additions & 0 deletions tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading