Skip to content

Commit

Permalink
refactor: snapshot -> snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
tekumara committed Jul 14, 2024
1 parent 5590e9c commit 63e9a92
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 280 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ repos:
# formatters and linters are available in the virtualenv so they can be run from the makefile & vscode
- repo: local
hooks:
- id: snapshot
name: snapshot
entry: make snapshot
- id: snapshots
name: snapshots
entry: make snapshots
# run on all files
pass_filenames: false
language: system
30 changes: 14 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
MAKEFLAGS += --warn-undefined-variables
SHELL = /bin/bash -o pipefail
.DEFAULT_GOAL := help
.PHONY: help snapshot test outdated pc-update
.PHONY: help test outdated pc-update

## display help message
help:
@awk '/^##.*$$/,/^[~\/\.0-9a-zA-Z_-]+:/' $(MAKEFILE_LIST) | awk '!(NR%2){print $$0p}{p=$$0}' | awk 'BEGIN {FS = ":.*?##"}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' | sort

snapshot := snapshot/cookie
venv := .venv
cookiecutter := $(venv)/bin/cookiecutter

Expand All @@ -18,25 +17,24 @@ $(venv):
## create venv and install cookiecutter and hooks
install: $(venv) $(if $(value CI),,install-hooks)

## make the snapshot cookie
snapshot: $(snapshot)

## run hooks on snapshot cookie
test: $(snapshot)
cd $(snapshot) && git init && git add . && make hooks
## run hooks on default snapshot
test: snapshots
cd snapshots/default && git init && git add . && make hooks

$(snapshot): $(shell find {{cookiecutter.repo_name}}) cookiecutter* | $(venv)
rm -rf $(snapshot)
$(cookiecutter) -o $(snapshot)/../ -f --no-input --config-file cookiecutter-config.yaml .
touch $(snapshot)
## make the snapshots
snapshots: $(shell find {{cookiecutter.repo_name}}) snapshots/*.yaml | $(venv)
rm -rf snapshots/*/
for file in snapshots/*.yaml; do $(cookiecutter) -o snapshots -f --no-input --config-file $$file .; done
touch snapshots

$(snapshot)/.venv: $(snapshot)
cd $(snapshot) && make install
snapshots/default/.venv: snapshots
cd snapshots/default && make install

## list outdated packages
outdated: $(snapshot)/.venv
$(snapshot)/.venv/bin/pip list --outdated
cd $(snapshot) && npm outdated
outdated: snapshots/default/.venv
snapshots/default/.venv/bin/pip list --outdated
cd snapshots/default && npm outdated

## update pre-commit hooks
pc-update: $(snapshot)/.venv
Expand Down
18 changes: 0 additions & 18 deletions snapshot/cookie/.gitignore

This file was deleted.

36 changes: 0 additions & 36 deletions snapshot/cookie/.pre-commit-config.yaml

This file was deleted.

1 change: 0 additions & 1 deletion snapshot/cookie/.python-version

This file was deleted.

23 changes: 0 additions & 23 deletions snapshot/cookie/CONTRIBUTING.md

This file was deleted.

3 changes: 0 additions & 3 deletions snapshot/cookie/Makefile

This file was deleted.

67 changes: 0 additions & 67 deletions snapshot/cookie/Makefile-common.mk

This file was deleted.

9 changes: 0 additions & 9 deletions snapshot/cookie/README.md

This file was deleted.

Empty file.
9 changes: 0 additions & 9 deletions snapshot/cookie/mypackage/main.py

This file was deleted.

1 change: 0 additions & 1 deletion snapshot/cookie/mypackage/py.typed

This file was deleted.

5 changes: 0 additions & 5 deletions snapshot/cookie/package.json

This file was deleted.

87 changes: 0 additions & 87 deletions snapshot/cookie/pyproject.toml

This file was deleted.

Empty file removed snapshot/cookie/tests/__init__.py
Empty file.
2 changes: 0 additions & 2 deletions snapshot/cookie/tests/test_example.py

This file was deleted.

File renamed without changes.

0 comments on commit 63e9a92

Please sign in to comment.