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
4 changes: 2 additions & 2 deletions a2ml/docs/CONTRACTILES-A2ML-V1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,6 @@ The validator and emitter support explicit types:

[source,bash]
----
python3 scripts/contractiles-a2ml-tool.py validate --type mustfile tests/contractiles/fixtures/invalid-mustfile.a2ml
python3 scripts/contractiles-a2ml-tool.py emit --type trustfile contractiles/trust/Trustfile.a2ml /tmp/trustfile.json
deno run --allow-read --allow-write scripts/contractiles-a2ml-tool.js validate --type mustfile tests/contractiles/fixtures/invalid-mustfile.a2ml
deno run --allow-read --allow-write scripts/contractiles-a2ml-tool.js emit --type trustfile contractiles/trust/Trustfile.a2ml /tmp/trustfile.json
----
2 changes: 1 addition & 1 deletion a2ml/docs/RELEASE-CHECKLIST-CONTRACTILES-A2ML-V1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
== Pre-Release

- [ ] Specs updated: `docs/CONTRACTILES-A2ML-V1.adoc` and `contractiles/spec/contractiles-v1.json`
- [ ] Validator/emitter tool updated: `scripts/contractiles-a2ml-tool.py`
- [ ] Validator/emitter tool updated: `scripts/contractiles-a2ml-tool.js`
- [ ] Fixtures updated: `tests/contractiles/fixtures/*`
- [ ] Expected outputs updated: `tests/contractiles/expected/*`
- [ ] CI workflow present: `.github/workflows/contractiles-a2ml.yml`
Expand Down
2 changes: 1 addition & 1 deletion a2ml/docs/RELEASE-NOTES-CONTRACTILES-A2ML-V1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ just contractiles-k9-validate

* `docs/CONTRACTILES-A2ML-V1.adoc`
* `contractiles/spec/contractiles-v1.json`
* `scripts/contractiles-a2ml-tool.py`
* `scripts/contractiles-a2ml-tool.js`
* `tests/contractiles/fixtures/*`
* `.github/workflows/contractiles-a2ml.yml`

Expand Down
11 changes: 6 additions & 5 deletions a2ml/scripts/contractiles-a2ml-emit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
out_dir="${1:-$root/build/contractiles}"
mkdir -p "$out_dir"

tool="$root/scripts/contractiles-a2ml-tool.py"
tool="$root/scripts/contractiles-a2ml-tool.js"
runtool() { deno run --quiet --allow-read --allow-write "$tool" "$@"; }

python3 "$tool" emit "$root/contractiles/must/Mustfile.a2ml" "$out_dir/mustfile.json"
python3 "$tool" emit "$root/contractiles/trust/Trustfile.a2ml" "$out_dir/trustfile.json"
python3 "$tool" emit "$root/contractiles/dust/Dustfile.a2ml" "$out_dir/dustfile.json"
python3 "$tool" emit "$root/contractiles/lust/Intentfile.a2ml" "$out_dir/intentfile.json"
runtool emit "$root/contractiles/must/Mustfile.a2ml" "$out_dir/mustfile.json"
runtool emit "$root/contractiles/trust/Trustfile.a2ml" "$out_dir/trustfile.json"
runtool emit "$root/contractiles/dust/Dustfile.a2ml" "$out_dir/dustfile.json"
runtool emit "$root/contractiles/lust/Intentfile.a2ml" "$out_dir/intentfile.json"

echo "Wrote: $out_dir/mustfile.json"
echo "Wrote: $out_dir/trustfile.json"
Expand Down
18 changes: 10 additions & 8 deletions a2ml/scripts/contractiles-a2ml-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ set -euo pipefail

root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)

tool="$root/scripts/contractiles-a2ml-tool.py"
tool="$root/scripts/contractiles-a2ml-tool.js"
fixtures="$root/tests/contractiles/fixtures"
expected="$root/tests/contractiles/expected"

python3 "$tool" validate \
runtool() { deno run --quiet --allow-read --allow-write "$tool" "$@"; }

runtool validate \
"$fixtures/Mustfile.a2ml" \
"$fixtures/Trustfile.a2ml" \
"$fixtures/Dustfile.a2ml" \
"$fixtures/Intentfile.a2ml"

python3 "$tool" emit "$fixtures/Mustfile.a2ml" "$expected/mustfile.json.tmp"
python3 "$tool" emit "$fixtures/Trustfile.a2ml" "$expected/trustfile.json.tmp"
python3 "$tool" emit "$fixtures/Dustfile.a2ml" "$expected/dustfile.json.tmp"
python3 "$tool" emit "$fixtures/Intentfile.a2ml" "$expected/intentfile.json.tmp"
runtool emit "$fixtures/Mustfile.a2ml" "$expected/mustfile.json.tmp"
runtool emit "$fixtures/Trustfile.a2ml" "$expected/trustfile.json.tmp"
runtool emit "$fixtures/Dustfile.a2ml" "$expected/dustfile.json.tmp"
runtool emit "$fixtures/Intentfile.a2ml" "$expected/intentfile.json.tmp"

diff -u "$expected/mustfile.json" "$expected/mustfile.json.tmp"
diff -u "$expected/trustfile.json" "$expected/trustfile.json.tmp"
Expand All @@ -25,7 +27,7 @@ diff -u "$expected/intentfile.json" "$expected/intentfile.json.tmp"

expect_fail() {
local file="$1"
if python3 "$tool" validate "$file"; then
if runtool validate "$file"; then
echo "Expected validation failure: $file" >&2
exit 1
fi
Expand All @@ -34,7 +36,7 @@ expect_fail() {
expect_fail_type() {
local file="$1"
local type="$2"
if python3 "$tool" validate --type "$type" "$file"; then
if runtool validate --type "$type" "$file"; then
echo "Expected validation failure: $file ($type)" >&2
exit 1
fi
Expand Down
Loading
Loading