-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
33 lines (29 loc) · 902 Bytes
/
Makefile
File metadata and controls
33 lines (29 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
.PHONY: init shell nuke nuke-force
PROJECT_NAME := $(shell basename $(shell pwd))
HASH := $(shell echo -n "$(shell pwd)" | shasum | cut -c1-4)
CONTAINER_NAME := sc-$(PROJECT_NAME)-$(HASH)
init:
@./init.sh
nuke:
@echo "Destroying container $(CONTAINER_NAME)..."
@docker rm -f $(CONTAINER_NAME) 2>/dev/null || true
@docker volume rm vscode 2>/dev/null || true
@echo ""
@sh -c ' \
GIT_STATUS="$$(git status --short)"; \
printf "%s\n" "$$GIT_STATUS"; \
if [ -n "$$GIT_STATUS" ]; then \
echo ""; \
echo "WARNING: Git workspace is not clean."; \
echo "Run make nuke-force to discard all changes and reset."; \
fi \
'
@echo "Done."
nuke-force:
@echo "Resetting git workspace..."
@git reset --hard
@git clean -fd
@echo "Destroying container $(CONTAINER_NAME)..."
@docker rm -f $(CONTAINER_NAME) 2>/dev/null || true
@docker volume rm vscode 2>/dev/null || true
@echo "Done."