-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
54 lines (41 loc) · 1.51 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
export PROJECTNAME=$(shell basename "$(PWD)")
.SILENT: ; # no need for @
setup: ## Setup Virtual Env
python3 -m venv venv
./venv/bin/pip3 install -r requirements/dev.txt
deps: ## Install dependencies
./venv/bin/pip3 install -r requirements/dev.txt
lint: ## Runs black for code formatting
./venv/bin/black . --exclude venv
clean: ## Clean package
find . -type d -name '__pycache__' | xargs rm -rf
rm -rf build dist
deploy: clean ## Copies any changed file to the server
ssh ${PROJECTNAME} -C 'bash -l -c "mkdir -vp ./tele-vdo-rider"'
rsync -avzr \
env.cfg \
tele-vdo-rider.py \
bot \
common \
config \
requirements \
scripts \
${PROJECTNAME}:./tele-vdo-rider
start: deploy ## Sets up a screen session on the server and start the app
ssh ${PROJECTNAME} -C 'bash -l -c "./tele-vdo-rider/scripts/setup_bot.sh ${PROJECTNAME}"'
stop: deploy ## Stop any running screen session on the server
ssh ${PROJECTNAME} -C 'bash -l -c "./tele-vdo-rider/scripts/stop_bot.sh ${PROJECTNAME}"'
server: deploy ## Sets up dependencies required to run this bot
ssh ${PROJECTNAME} -C 'bash -l -c "./tele-vdo-rider/scripts/setup_dependencies.sh"'
ssh: ## SSH into the target VM
ssh ${PROJECTNAME}
run: lint ## Run bot locally
./venv/bin/python3 tele-vdo-rider.py
.PHONY: help
.DEFAULT_GOAL := help
help: Makefile
echo
echo " Choose a command run in "$(PROJECTNAME)":"
echo
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
echo