diff --git a/Makefile b/Makefile index 22d77ab..43d5d65 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,5 @@ .PHONY: default bootstrap setup test lint fmt fmt-check check docker hooks build clean try -TESTDIR := $(HOME)/Documents/_SYSADMIN/cyberdyne - # The version `make build` stamps into the binary: the git tag or short # commit, -dirty with uncommitted changes. `make build VERSION=x` stamps x, # which is how the Dockerfile passes its version in. @@ -45,13 +43,22 @@ build: clean clean: @rm -f attrsum +# Runs the binary on three small files in a new temporary directory, which +# the trap removes when the recipe ends, also when a step fails. The check +# after clear is expected to fail, so its exit status is ignored. try: build - ./attrsum sum add -v $(TESTDIR) - ./attrsum check -v $(TESTDIR) - ./attrsum clear -v $(TESTDIR) - -./attrsum check -v $(TESTDIR) - ./attrsum sum add -v $(TESTDIR) - ./attrsum check -v $(TESTDIR) - touch $(TESTDIR)/* - ./attrsum sum update -v $(TESTDIR) - ./attrsum check -v $(TESTDIR) + @set -ex; \ + dir=$$(mktemp -d); \ + trap 'rm -rf "$$dir"' EXIT; \ + echo one >"$$dir/a"; \ + echo two >"$$dir/b"; \ + echo three >"$$dir/c"; \ + ./attrsum sum add -v "$$dir"; \ + ./attrsum check -v "$$dir"; \ + ./attrsum clear -v "$$dir"; \ + ./attrsum check -v "$$dir" || true; \ + ./attrsum sum add -v "$$dir"; \ + ./attrsum check -v "$$dir"; \ + touch "$$dir"/*; \ + ./attrsum sum update -v "$$dir"; \ + ./attrsum check -v "$$dir" diff --git a/TODO.md b/TODO.md index 4a231e5..f07fc05 100644 --- a/TODO.md +++ b/TODO.md @@ -20,12 +20,13 @@ have landed since the tag. Policy scaffold commit: add LICENSE, REPO_POLICIES.md, .editorconfig, .golangci.yml, and a comprehensive .gitignore (currently only the attrsum binary), and extend the Makefile (only test/build/clean/try -today) with lint, fmt, fmt-check, check, and hooks targets. Fix the try -target to use a temp fixture instead of the hardcoded -$(HOME)/Documents/_SYSADMIN/cyberdyne path. +today) with lint, fmt, fmt-check, check, and hooks targets. # Completed Steps +* 2026-10-05: `make try` runs on three small files in a temporary + directory that it removes afterwards, also when a step fails, + instead of on a fixed directory on one person's machine * 2026-10-02: `attrsum --version` reports the git tag or short commit, stamped by `make build` and by a plain `docker build .` of a clone; `.dockerignore` sends `.git` without `.git/config` and keeps a