-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (63 loc) · 1.85 KB
/
Makefile
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# ==============================================================================
# VARIABLES
# -- Hugo
THEME = blowfish
# -- Docker
DOCKER_UID = $(shell id -u)
DOCKER_GID = $(shell id -g)
DOCKER_USER = $(DOCKER_UID):$(DOCKER_GID)
COMPOSE = DOCKER_USER=$(DOCKER_USER) docker compose
COMPOSE_RUN = $(COMPOSE) run --rm
COMPOSE_RUN_HUGO = $(COMPOSE_RUN) hugo
COMPOSE_RUN_PRETTIER = $(COMPOSE_RUN) prettier
# ==============================================================================
# RULES
default: help
# -- Docker
run: ## run server
@$(COMPOSE) up --force-recreate -d hugo
.PHONY: run
stop: ## stop container
@$(COMPOSE) stop
.PHONY: stop
down: ## stop and remove container
@$(COMPOSE) down
.PHONY: down
logs: ## display hugo logs
@$(COMPOSE) logs -f hugo
.PHONY: logs
status: ## an alias for "docker-compose ps"
@$(COMPOSE) ps
.PHONY: status
## -- Git
git-modules-init: ## init git modules
git submodule update --init --recursive
.PHONY: git-modules-init
git-modules-update: ## update git modules
git submodule update --remote --recursive
.PHONY: git-modules-update
git-modules-status: ## display git modules status (e.g: to display version)
git submodule status
.PHONY: git-modules-status
git-clean: ## restore repository state as it was freshly cloned
git clean -idx
.PHONY: clean
# -- Project
bootstrap: ## bootstrap project
bootstrap: \
git-modules-init \
run
.PHONY: bootstrap
build: ## build static blog
@$(COMPOSE_RUN_HUGO) -t $(THEME)
.PHONY: build
lint-markdown: ## lint markdown file
@$(COMPOSE_RUN_PRETTIER) --check "content/**/*.md"
.PHONY: lint-markdown
lint-markdown-format: ## format markdown file
@$(COMPOSE_RUN_PRETTIER) --write "content/**/*.md"
.PHONY: lint-markdown
# -- Misc
help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: help