Просмотр исходного кода

docs: isolate latching toggle screenshot fixture and stop on capture failure

The latching toggle screenshots read and wrote /etc/OliveTin/entities, which
failed on a clean checkout and overwrote the state of an installed example.
They now use a gitignored fixture next to the config, seeded before OliveTin
starts, and bind to loopback. The shared screenshot target also stops
OliveTin when capture fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jamesread 16 часов назад
Родитель
Сommit
ea0def2b76

+ 1 - 1
docs/modules/ROOT/images/screenshots.mk

@@ -45,5 +45,5 @@ stop:
 	exit 0
 
 update-screenshots: stop start
-	cd "$(CONFIGDIR)" && repo-helper screenshot --config screenshots.ini
+	@cd "$(CONFIGDIR)" && repo-helper screenshot --config screenshots.ini || { $(MAKE) stop; exit 1; }
 	@$(MAKE) stop

+ 1 - 0
docs/modules/ROOT/images/solutions/latching-toggle/.gitignore

@@ -1,2 +1,3 @@
 custom-webui/
 __pycache__/
+water_valve.yaml

+ 8 - 5
docs/modules/ROOT/images/solutions/latching-toggle/Makefile

@@ -1,15 +1,18 @@
 CONFIGDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
-ENTITY_FILE := /etc/OliveTin/entities/water_valve.yaml
 ENTITY_SEED := $(CONFIGDIR)../../../examples/solutions/latching-toggle/water_valve.yaml
 
+# The screenshot config reads and writes this fixture, so captures never touch
+# a real /etc/OliveTin install.
+export WATER_VALVE_ENTITY_FILE := $(CONFIGDIR)water_valve.yaml
+
 include ../../screenshots.mk
 
+start: seed-entity
+
 .DEFAULT_GOAL := screenshots
 .PHONY: screenshots seed-entity
 
 seed-entity:
-	cp "$(ENTITY_SEED)" "$(ENTITY_FILE)"
+	cp "$(ENTITY_SEED)" "$(WATER_VALVE_ENTITY_FILE)"
 
-screenshots: seed-entity
-	$(MAKE) update-screenshots
-	$(MAKE) seed-entity
+screenshots: update-screenshots

+ 4 - 4
docs/modules/ROOT/images/solutions/latching-toggle/config.yaml

@@ -1,12 +1,12 @@
 ---
-listenAddressSingleHTTPFrontend: 0.0.0.0:11337
+listenAddressSingleHTTPFrontend: 127.0.0.1:11337
 
 logLevel: "WARN"
 checkForUpdates: false
 showFooter: false
 
 entities:
-  - file: /etc/OliveTin/entities/water_valve.yaml
+  - file: ${{ WATER_VALVE_ENTITY_FILE }}
     name: water_valve
 
 actions:
@@ -17,7 +17,7 @@ actions:
     shell: |
       set -e
       echo "Opening {{ .CurrentEntity.title }}"
-      printf -- '- title: %s\n  state: open\n' "{{ .CurrentEntity.title }}" > /etc/OliveTin/entities/water_valve.yaml
+      printf -- '- title: %s\n  state: open\n' "{{ .CurrentEntity.title }}" > "${{ WATER_VALVE_ENTITY_FILE }}"
 
   - title: Close valve
     icon: '&#128683;'
@@ -26,7 +26,7 @@ actions:
     shell: |
       set -e
       echo "Closing {{ .CurrentEntity.title }}"
-      printf -- '- title: %s\n  state: closed\n' "{{ .CurrentEntity.title }}" > /etc/OliveTin/entities/water_valve.yaml
+      printf -- '- title: %s\n  state: closed\n' "{{ .CurrentEntity.title }}" > "${{ WATER_VALVE_ENTITY_FILE }}"
 
 dashboards:
   - title: Water Valve