add make command to scaffold test data
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Executable
+59
@@ -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" <<EOF
|
||||
# Welcome to Mend
|
||||
|
||||
This is a scaffolded test environment.
|
||||
|
||||
## Features
|
||||
- **File Tree**: Navigate using arrow keys.
|
||||
- **Notes**: View rendered Markdown.
|
||||
- **Hints**: Toggle hints with Space.
|
||||
|
||||
Try hinting: **Space out**
|
||||
EOF
|
||||
|
||||
# Personal Note
|
||||
cat > "$DATA_DIR/personal/todo.md" <<EOF
|
||||
# Personal Todos
|
||||
|
||||
- [ ] Buy groceries
|
||||
- [ ] Call mom
|
||||
- [ ] Fix the **sink**
|
||||
EOF
|
||||
|
||||
# Work Note
|
||||
cat > "$DATA_DIR/work/project_alpha/specs.md" <<EOF
|
||||
# Project Alpha Specs
|
||||
|
||||
## Overview
|
||||
This is a **top secret** project.
|
||||
|
||||
## Requirements
|
||||
1. Fast
|
||||
2. Reliable
|
||||
3. __Secure__
|
||||
EOF
|
||||
|
||||
# Archive Note
|
||||
cat > "$DATA_DIR/archive/old_ideas.md" <<EOF
|
||||
# Old Ideas
|
||||
|
||||
Just some random thoughts from the past.
|
||||
EOF
|
||||
|
||||
echo "Done."
|
||||
@@ -0,0 +1,3 @@
|
||||
# Old Ideas
|
||||
|
||||
Just some random thoughts from the past.
|
||||
@@ -0,0 +1,5 @@
|
||||
# Personal Todos
|
||||
|
||||
- [ ] Buy groceries
|
||||
- [ ] Call mom
|
||||
- [ ] Fix the **sink**
|
||||
@@ -0,0 +1,10 @@
|
||||
# Welcome to Mend
|
||||
|
||||
This is a scaffolded test environment.
|
||||
|
||||
## Features
|
||||
- **File Tree**: Navigate using arrow keys.
|
||||
- **Notes**: View rendered Markdown.
|
||||
- **Hints**: Toggle hints with Space.
|
||||
|
||||
Try hinting: **Space out**
|
||||
@@ -0,0 +1,9 @@
|
||||
# Project Alpha Specs
|
||||
|
||||
## Overview
|
||||
This is a **top secret** project.
|
||||
|
||||
## Requirements
|
||||
1. Fast
|
||||
2. Reliable
|
||||
3. __Secure__
|
||||
Reference in New Issue
Block a user