-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (75 loc) · 2.71 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
82
83
84
85
86
87
88
89
90
91
92
93
dotmodules = zsh vim git gnupg editorconfig kitty
vimplugurl = https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
artifacts_dir = ci-artifacts
.PHONY: *
install: dotfiles-dir stow vim-plug prezto post-install
uninstall: unstow
homebrew-required:
$(info Installing required homebrew packages)
@brew bundle --file=modules/macOS/required/Brewfile
homebrew-essentials:
$(info Installing essential homebrew packages)
@brew bundle --file=modules/macOS/essentials/Brewfile
homebrew-extra:
$(info Installing extra homebrew packages)
@brew bundle --file=modules/macOS/extra/Brewfile
dotfiles-dir:
$(info Writing install path to ~/.dotfiles-dir)
@pwd > ~/.dotfiles-dir
prezto:
$(info Setting up prezto)
@git submodule update --quiet --init --recursive
@mkdir -p modules/prezto/contrib
@cd modules/prezto/contrib && ln -sf ../../prompt-aleks .
stow:
$(info Verifying if no current configs installed)
@stow -n -d modules -t ~ $(dotmodules)
$(info Installing dotfiles with stow)
@stow -v -d modules -t ~ $(dotmodules)
unstow:
$(info Uninstalling dotfiles with stow)
@stow -D -d modules -t ~ $(dotmodules)
vim-plug:
$(info Setting up vim-plug)
@curl -fLso ~/.vim/autoload/plug.vim --create-dirs $(vimplugurl)
@vim +PlugInstall +qall
post-install:
$(info Running post-install hooks)
@find hooks/post-install -maxdepth 1 -type f -exec {} \;
update-prezto:
$(info Updating prezto git submodule to the latest version)
@git submodule update --remote prezto
reset-prezto:
$(info Resetting prezto git submodule to checked in version)
@git submodule deinit -f prezto
@git submodule update --init prezto
zprof:
$(info Profiling single zsh run)
@__zprof=1 zsh -i -c exit
ztime:
ifeq ($(shell uname),Darwin)
$(info Starting/stopping zsh 10 times)
@zsh -c "cd / && for i in $(shell seq 1 10); do /usr/bin/time zsh -i -c exit 2>&1 | sed -n 's/^[ ]*\([^ ]*\).*$$/\1/p'; done"
else
$(info Starting/stopping zsh 10 times)
@zsh -c "cd / && for i in $(shell seq 1 10); do /usr/bin/time -f '%e' zsh -i -c exit; done"
endif
ztime_avg:
$(info Average zsh startup time:)
@cat $(artifacts_dir)/ztime | tail +2 | awk '{ sum += $$1 } END { print(sum / NR) }'
test:
$(info Testing dotfiles)
@mkdir -p $(artifacts_dir)
@$(MAKE) -s install
@$(MAKE) -s zprof > $(artifacts_dir)/zprof 2>&1
@$(MAKE) -s ztime > $(artifacts_dir)/ztime 2>&1
@$(MAKE) -s ztime_avg > $(artifacts_dir)/ztime_avg 2>&1
@$(MAKE) -s uninstall
docker-build:
$(info Building container image for running tests)
@docker build --target test -t dotfiles-test .
docker-test:
$(info Running test in container)
@mkdir -p $(artifacts_dir)
@chmod 777 $(artifacts_dir)
@docker run -v $(PWD)/$(artifacts_dir):/home/test-user/dotfiles/$(artifacts_dir) --rm -t dotfiles-test