-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (55 loc) · 1.72 KB
/
Makefile
File metadata and controls
72 lines (55 loc) · 1.72 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
.PHONEY: test watch lint do-lint deploy push-archive extract upgrade git-tag git-porcelain err
SHELL=/bin/bash
VERSION_NUM?=$(shell cat .current-version)
VERSION?=${VERSION_NUM}
TARBALL=${VERSION}.tar.gz
REMOTE_DIR=/home/deploy_user/python-base
duplicates_cmd := find python_base/test -mindepth 1 -type f | sed "s/.*\///" | sort | uniq -d
duplicates := $(shell $(duplicates_cmd))
define line-break
endef
ifdef duplicates
ERR = $(error Cannot have multiple test files with same name.$(line-break)$(duplicates))
endif
err: ; $(ERR)
test: err
pipenv run python -B -m green -vvv
watch:
find . -name '*.py' | entr -dc sh -c '\
find . -type f -name "*.py[co]" -delete;\
find . -type d -name "__pycache__" -delete;\
ctags -R > /dev/null 2>&1;\
if [ -z "$(duplicates)" ]; then\
pipenv run python -B -m green -vvv;\
else\
echo "Cannot have multiple test files with same name.\n"$(duplicates);\
fi'
lint:
pipenv run flake8
do-lint:
find . -name '*.py' | xargs -I {} autopep8 {} -i
git-porcelain:
@[[ -z "`git status --porcelain`" ]]
git-tag: git-porcelain
git tag ${VERSION}
git push --tags
builds/${TARBALL}:
mkdir -p builds
tar zcvf $@ .current-version run config Pipfile Pipfile.lock
deploy: test git-tag builds/${TARBALL} push-archive extract
push-archive:
scp builds/${TARBALL} ${HOST}:${REMOTE_DIR}/builds/${TARBALL}
extract:
ssh -t ${HOST} "\
cd ${REMOTE_DIR}; \
mkdir -p app/${VERSION}; \
tar xzf builds/${TARBALL} --directory app/${VERSION}; \
sudo chgrp -R production app/${VERSION}/; \
cd app/${VERSION};"
upgrade:
ssh -t ${HOST} "\
cd ${REMOTE_DIR}/app; \
rm current; \
ln -s ${VERSION} current; \
cd current; \
/usr/local/bin/pipenv sync;"