-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
89 lines (69 loc) · 2.29 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
78
79
80
81
82
83
84
85
86
87
88
89
PROJECT_NAME = pcs
STATIC_LIBS_DIR = ./$(PROJECT_NAME)/static/libs
default: lint test
test:
# Run all tests and report coverage
# Requires coverage
coverage run manage.py test
coverage report -m --fail-under 80
lint-py:
# Check for Python formatting issues
# Requires flake8
flake8 .
lint-js:
# Check JS for any problems
# Requires jshint
find -name "*.js" -not -path "${STATIC_LIBS_DIR}*" -print0 | xargs -0 jshint
lint: lint-py lint-js
$(STATIC_LIBS_DIR):
mkdir -p $@
update-static-libs: $(LIBS)
# Generate a random string of desired length
generate-secret: length = 32
generate-secret:
@strings /dev/urandom | grep -o '[[:alnum:]]' | head -n $(length) | tr -d '\n'; echo
conf/%.pub.ssh:
# Generate SSH deploy key for a given environment
ssh-keygen -t rsa -b 4096 -f $*.priv -C "$*@${PROJECT_NAME}"
@mv $*.priv.pub $@
staging-deploy-key: conf/staging.pub.ssh
production-deploy-key: conf/production.pub.ssh
# Translation helpers
makemessages:
# Extract English messages from our source code
python manage.py makemessages --ignore 'conf/*' --ignore 'docs/*' --ignore 'requirements/*' \
--no-location --no-obsolete -l en
compilemessages:
# Compile PO files into the MO files that Django will use at runtime
python manage.py compilemessages
pushmessages:
# Upload the latest English PO file to Transifex
tx push -s
pullmessages:
# Pull the latest Arabic PO file from Transifex
tx pull -af
setup:
virtualenv -p `which python3.4` $(WORKON_HOME)/pcs
$(WORKON_HOME)/pcs/bin/pip install -U pip wheel
$(WORKON_HOME)/pcs/bin/pip install -Ur requirements/dev.txt
npm install
npm update
cp pcs/settings/local.example.py pcs/settings/local.py
echo "DJANGO_SETTINGS_MODULE=pcs.settings.local" > .env
createdb -E UTF-8 pcs
$(WORKON_HOME)/pcs/bin/python manage.py migrate
if [ -e project.travis.yml ] ; then mv project.travis.yml .travis.yml; fi
@echo
@echo "The pcs project is now setup on your machine."
@echo "Run the following commands to activate the virtual environment and run the"
@echo "development server:"
@echo
@echo " workon pcs"
@echo " npm run dev"
update:
$(WORKON_HOME)/pcs/bin/pip install -U -r requirements/dev.txt
npm install
npm update
.PHONY: default test lint lint-py lint-js generate-secret makemessages \
pushmessages pullmessages compilemessages
.PRECIOUS: conf/%.pub.ssh