refactor: Convert scenarios to ERB templates

- Move scenario JSON files to app/assets/scenarios/
- Rename to .erb extension (24 scenarios converted)
- Keep .ink files in scenarios/ink/ for JIT compilation
- Each scenario now in own directory
- Add conversion script for future use
This commit is contained in:
Z. Cliffe Schreuders
2025-11-21 15:27:53 +00:00
parent ea70cf4297
commit d2ef5ff6aa
25 changed files with 41 additions and 0 deletions

41
scripts/convert-scenarios.sh Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/bash
# Convert all scenario JSON files to ERB structure
echo "Converting scenario files to ERB templates..."
# Get all scenario JSON files
scenarios=$(ls scenarios/*.json 2>/dev/null | xargs -n1 basename | sed 's/\.json$//')
# Process all scenarios
echo ""
echo "=== Processing Scenarios ==="
for scenario in $scenarios; do
if [ -f "scenarios/${scenario}.json" ]; then
echo "Processing: $scenario"
# Create directory
mkdir -p "app/assets/scenarios/${scenario}"
# Move and rename (just rename to .erb, don't modify content yet)
mv "scenarios/${scenario}.json" "app/assets/scenarios/${scenario}/scenario.json.erb"
echo " ✓ Moved to app/assets/scenarios/${scenario}/scenario.json.erb"
else
echo " ⚠ File not found: scenarios/${scenario}.json (skipping)"
fi
done
echo ""
echo "=== Summary ==="
echo "Converted files:"
find app/assets/scenarios -name "scenario.json.erb" | wc -l
echo ""
echo "Directory structure:"
ls -d app/assets/scenarios/*/
echo ""
echo "✓ Conversion complete!"
echo ""
echo "IMPORTANT:"
echo "- Files have been renamed to .erb but content is still JSON"
echo "- ERB randomization (random_password, etc.) will be added in Phase 4"
echo "- For now, scenarios work as-is with static passwords"