-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
73 lines (61 loc) · 2.37 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
# including env file if it exists
-include .env
# setting up shell as bash
SHELL := /bin/bash
# storing git creds for use in commands
NAME=$$(git config user.name)
EMAIL=$$(git config user.email)
# starts container
start: env_check
@echo "== 🟢 Starting containers... ==============="
@docker compose up -d
@make -s url_print
@echo "== 💜 TiBillet docs are up! ==============="
# changes locale to en in env file with text replacement utility
en: env_check
@echo "== 🗨 Selecting English locale. ============"
@sed -i '/DOCUSAURUS_LOCALE=/s/=\w\+/=en/' .env
# changes locale to fr in env file with text replacement utility
fr: env_check
@echo "== 🗨 Selecting French locale. ============="
@sed -i '/DOCUSAURUS_LOCALE=/s/=\w\+/=fr/' .env
# stops container
stop:
@echo "== 🛑 Shutting down containers... =========="
@docker compose down
@echo "== 💀 TiBillet docs shut down. ============="
# rebuilds image and starts container
build: env_check
@echo "== ➰ Building containers... ==============="
@docker compose up -d --build
@make -s url_print
@echo "== 🛠️ TiBillet docs built from scratch! ===="
# opens a bash shell inside the container (for easier access to yarn, mostly)
shell: env_check
@echo "== 🔐 Entering container... ================"
@docker exec -ti tibillet_docusaurus bash
@echo "== 🔒 Welcome back! ========================"
# executes a pre-configured yarn deploy that sends the generated site on a
# github pages branch
deploy: build
@echo "== 🐱 Deploying to Github... ==============="
@docker exec -ti tibillet_docusaurus yarn deploy
@echo "== 🚀 TiBillet docs are online! ============"
# copies env file, then adds the name and email found at the beginning to your
# env file with text replacement utility
init:
@echo "== ✨ Initiating environment... ============"
@cp env_example .env
@echo "== 🧑 Setting up your Git credentials... ==="
@echo "${NAME} <${EMAIL}>"
@sed -i "/GIT_NAME=/s/=.*/=${NAME}/" .env
@sed -i "/GIT_EMAIL=/s/=.*/=${EMAIL}/" .env
@echo "== 🪪 All done! ============================"
# check for env file and make recursive call to make init if not found
env_check:
@[ -f .env ] || make -s init
# displays the local server, adding the locale folder unless it's English
url_print:
@echo ".. Running at http://localhost:3000/$$( \
[ ${DOCUSAURUS_LOCALE} = "en" ] || echo "${DOCUSAURUS_LOCALE}/" \
)"