This repository was archived by the owner on Jan 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (41 loc) · 1.67 KB
/
Makefile
File metadata and controls
54 lines (41 loc) · 1.67 KB
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
.PHONY: help, pip, test, clean, pep8, install-git-hooks, build, crawl, web
PRE_COMMIT_EXISTS := $(shell [ -f .git/hooks/pre-commit ] && echo 1 || echo 0)
CODE = cdhouse tests manage.py gunicorn_config.py wsgi.py
default: help
install-git-hooks:
ifeq ($(PRE_COMMIT_EXISTS), 0)
$(info install git hooks: .git/hooks/pre-commit.sh)
curl -s -o .git/hooks/pre-commit https://raw.githubusercontent.com/google/yapf/master/plugins/pre-commit.sh && \
chmod +x .git/hooks/pre-commit
@echo "Success install yapf commit hook"
endif
pip:
pipenv install --python=3.6.4 --dev
pep8: isort
pipenv run yapf -ir --style=google $(CODE)
test: clean
pipenv run python -m pytest
clean:
@echo "Clean ..."
@find ./ -name '*.pyc' -exec rm -f {} +
@find ./ -name '*.pyo' -exec rm -f {} +
@find ./ -name '*~' -exec rm -f {} +
@find ./ -name '__pycache__' -exec rm -rf {} +
crawl: clean
pipenv run scrapy crawl cdfangxie
web: clean
pipenv run gunicorn -c gunicorn_config.py wsgi:app
build: clean
docker-compose build --force-rm
isort: clean
isort -rc $(CODE)
help:
@echo " \033[35mmake\033[0m \033[1m命令使用说明\033[0m"
@echo " \033[35mmake pip\033[0m\t\033[0m\t--- 安装依赖"
@echo " \033[35mmake clean\033[0m\t\033[0m\t--- 清理 Python 缓存文件"
@echo " \033[35mmake test\033[0m\t\033[0m\t--- 运行测试用例"
@echo " \033[35mmake pep8\033[0m\t\033[0m\t--- 格式化代码"
@echo " \033[35mmake install-git-hooks\033[0m\t\033[0m\t--- 下载yapf commit hook"
@echo " \033[35mmake crawl\033[0m\t\033[0m\t--- 运行爬虫"
@echo " \033[35mmake run\033[0m\t\033[0m\t--- 运行web服务"
@echo " \033[35mmake build\033[0m\t\033[0m\t--- 构建docker镜像"