From bd4eb84d02a60592868ab2feca9b9138b2e3ba38 Mon Sep 17 00:00:00 2001 From: ruinivist Date: Sun, 18 Jan 2026 02:13:56 +0000 Subject: [PATCH] add make command to scaffold test data --- Makefile | 13 ++++-- README.md | 6 ++- scripts/scaffold_data.sh | 59 +++++++++++++++++++++++++++ test_data/archive/old_ideas.md | 3 ++ test_data/personal/todo.md | 5 +++ test_data/welcome.md | 10 +++++ test_data/work/project_alpha/specs.md | 9 ++++ 7 files changed, 100 insertions(+), 5 deletions(-) create mode 100755 scripts/scaffold_data.sh create mode 100644 test_data/archive/old_ideas.md create mode 100644 test_data/personal/todo.md create mode 100644 test_data/welcome.md create mode 100644 test_data/work/project_alpha/specs.md diff --git a/Makefile b/Makefile index 3f599ae..726b1d0 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ -.PHONY: build test run clean +.PHONY: build test run clean scaffold BINARY_NAME=mend BUILD_DIR=bin +DATA_DIR=test_data build: @mkdir -p $(BUILD_DIR) @@ -10,8 +11,14 @@ build: test: go test ./... -run: - go run . +scaffold: + ./scripts/scaffold_data.sh + +run: scaffold + go run . $(DATA_DIR) clean: rm -rf $(BUILD_DIR) + +clean-data: + rm -rf $(DATA_DIR) diff --git a/README.md b/README.md index f67a56f..6295e0a 100644 --- a/README.md +++ b/README.md @@ -6,5 +6,7 @@ The project includes a `Makefile` for common tasks: - **Build**: `make build` (creates binary in `bin/mend`) - **Test**: `make test` -- **Run**: `make run` -- **Clean**: `make clean` +- **Run**: `make run` (automatically scaffolds `test_data` directory and runs app against it) +- **Scaffold**: `make scaffold` (generates sample data in `test_data`) +- **Clean**: `make clean` (removes binary) +- **Clean Data**: `make clean-data` (removes `test_data` directory) diff --git a/scripts/scaffold_data.sh b/scripts/scaffold_data.sh new file mode 100755 index 0000000..057829b --- /dev/null +++ b/scripts/scaffold_data.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# Directory +DATA_DIR="test_data" + +if [ -d "$DATA_DIR" ]; then + echo "Test data directory '$DATA_DIR' already exists." + exit 0 +fi + +echo "Scaffolding test data in '$DATA_DIR'..." +mkdir -p "$DATA_DIR/personal" +mkdir -p "$DATA_DIR/work/project_alpha" +mkdir -p "$DATA_DIR/archive" + +# Welcome Note +cat > "$DATA_DIR/welcome.md" < "$DATA_DIR/personal/todo.md" < "$DATA_DIR/work/project_alpha/specs.md" < "$DATA_DIR/archive/old_ideas.md" <