-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (56 loc) · 2.41 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
NAME := virtual-zenn
.PHONY: main
main: docker-build docker-run-vim
.PHONY: book
book: docker-build docker-run-vim-book
.PHONY: create
create: docker-build docker-run-create
.PHONY: edit
edit: docker-build docker-run-edit
.PHONY: ls
ls: docker-build docker-run-check
.PHONY: reset
reset: docker-run-rm
.PHONY: update
update:
git pull origin master
.PHONY: upload
upload:
git add $(shell pwd)/articles/ ; git commit -m "VIRTUALZENN: auto upload articles" ; git push origin HEAD
.PHONY: docker-build
docker-build:
docker build -t $(NAME) .
.PHONY: docker-run-rm
docker-run-rm:
docker run --rm $(NAME)
.PHONY: docker-run-create
docker-run-create:
docker run -v $(shell pwd)/articles:/virtual-zenn/articles -it $(NAME) zsh -c "npx zenn new:article"
.PHONY: docker-run-check
docker-run-check:
docker run -v $(shell pwd)/articles:/virtual-zenn/articles -it $(NAME) zsh -c "npx zenn list:articles"
docker run -v $(shell pwd)/articles:/virtual-zenn/articles -it $(NAME) zsh -c "npx zenn list:articles"
docker run -v $(shell pwd)/articles:/virtual-zenn/articles -it $(NAME) zsh -c "npx zenn list:books"
docker run -v $(shell pwd)/articles:/virtual-zenn/articles -it $(NAME) zsh -c "npx zenn list:books"
.PHONY: create-book
create-book: docker-build docker-run-create-book
.PHONY: edit-book
edit-book: docker-build docker-run-edit-book
.PHONY: docker-run-create-book
docker-run-create-book:
docker run -v $(shell pwd)/books:/virtual-zenn/books -it $(NAME) zsh -c "npx zenn new:book"
.PHONY: upload-book
upload-book:
git add $(shell pwd)/books/ ; git commit -m "VIRTUALZENN: auto upload books" ; git push origin HEAD
.PHONY: docker-run-vim
docker-run-vim:
open http://localhost:8001 ; docker run -p 8001:8000 -v $(shell pwd)/articles:/virtual-zenn/articles -it $(NAME) zsh -c "npx zenn new:article ; npx zenn preview & ; vim articles"
.PHONY: docker-run-edit
docker-run-edit:
open http://localhost:8002 ; docker run -p 8002:8000 -v $(shell pwd)/articles:/virtual-zenn/articles -it $(NAME) zsh -c "npx zenn preview & ; vim articles"
.PHONY: docker-run-vim-book
docker-run-vim-book:
open http://localhost:8003 ; docker run -p 8003:8000 -v $(shell pwd)/books:/virtual-zenn/books -it $(NAME) zsh -c "npx zenn new:book ; npx zenn preview & ; vim books"
.PHONY: docker-run-edit-book
docker-run-edit-book:
open http://localhost:8004 ; docker run -p 8004:8000 -v $(shell pwd)/books:/virtual-zenn/books -it $(NAME) zsh -c "npx zenn preview & ; vim books"