-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
40 lines (34 loc) · 1.3 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
.DEFAULT_GOAL := help
# This will output the help for each task. This is denoted by the `##` following the target.
# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help:
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: init
init: ## Runs first initilization of dotfiles
ifndef CODESPACES
@export BW_SESSION=$$(bw login --raw) && \
bw sync && \
reset && \
chezmoi init -v -S . && \
chezmoi apply -v && \
echo "Restart your terminal for the changes to take affect"
else
@chezmoi init -v -S . && \
chezmoi apply -v && \
echo "Restart your terminal for the changes to take affect"
endif
.PHONY: apply
apply: ## Apply dotfiles
@bw sync && \
reset && \
chezmoi apply -v
build: Dockerfile ## Build Docker image for testing dotfiles
docker build -t dotfiles .
@touch build
.PHONY: test
test: build ## Test interactive dotfiles in a container
docker run -it -v "${PWD}:/home/maverick/dev/dotfiles" -v "${PWD}/makefile:/home/maverick/makefile" dotfiles /bin/bash
.PHONY: test-headless
test-headless: build ## Test noninteractive dotfiles in a container
docker run -it -e CODESPACES=true -v "${PWD}:/home/maverick/dev/dotfiles" -v "${PWD}/makefile:/home/maverick/makefile" dotfiles /bin/bash