-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
94 lines (67 loc) · 2.46 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
90
91
92
93
94
# TODO: Replace with project name
PROJECT_NAME = project_name
STATIC_LIBS_DIR = ./$(PROJECT_NAME)/static/libs
LESS_VERSION = 2.1.0
MODERNIZR_VERSION = 2.8.3
JQUERY_VERSION = 1.11.2
BOOTSTRAP_VERSION = 3.3.1
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 $@
$(STATIC_LIBS_DIR)/less.js: $(STATIC_LIBS_DIR)
wget https://cdnjs.cloudflare.com/ajax/libs/less.js/$(LESS_VERSION)/less.js -O $@
LIBS := $(STATIC_LIBS_DIR)/less.js
$(STATIC_LIBS_DIR)/modernizr.js: $(STATIC_LIBS_DIR)
wget https://cdnjs.cloudflare.com/ajax/libs/modernizr/$(MODERNIZR_VERSION)/modernizr.js -O $@
LIBS += $(STATIC_LIBS_DIR)/modernizr.js
$(STATIC_LIBS_DIR)/jquery.js: $(STATIC_LIBS_DIR)
wget https://cdnjs.cloudflare.com/ajax/libs/jquery/$(JQUERY_VERSION)/jquery.js -O $@
LIBS += $(STATIC_LIBS_DIR)/jquery.js
$(STATIC_LIBS_DIR)/bootstrap: $(STATIC_LIBS_DIR)
wget https://github.com/twbs/bootstrap/releases/download/v${BOOTSTRAP_VERSION}/bootstrap-${BOOTSTRAP_VERSION}-dist.zip -O bootstrap.zip
unzip bootstrap.zip
mv dist $@
rm bootstrap.zip
LIBS += $(STATIC_LIBS_DIR)/bootstrap
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
.PHONY: default test lint lint-py lint-js generate-secret makemessages \
pushmessages pullmessages compilemessages
.PRECIOUS: conf/%.pub.ssh