forked from gratipay/gratipay.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
92 lines (72 loc) · 2.57 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
python := "$(shell { command -v python2.7 || command -v python; } 2>/dev/null)"
# Set the relative path to installed binaries under the project virtualenv.
# NOTE: Creating a virtualenv on Windows places binaries in the 'Scripts' directory.
bin_dir := $(shell $(python) -c 'import sys; bin = "Scripts" if sys.platform == "win32" else "bin"; print(bin)')
env_bin := env/$(bin_dir)
venv := "./vendor/virtualenv-1.9.1.py"
test_env_files := defaults.env,tests/test.env,tests/local.env
pip := $(env_bin)/pip
honcho := $(env_bin)/honcho
honcho_run := $(honcho) -e defaults.env,local.env run
py_test := $(honcho) -e $(test_env_files) run $(env_bin)/py.test
env: requirements.txt requirements_tests.txt setup.py
$(python) $(venv) \
--unzip-setuptools \
--prompt="[gratipay] " \
--never-download \
--extra-search-dir=./vendor/ \
--distribute \
./env/
$(pip) install -r requirements.txt
$(pip) install -r requirements_tests.txt
$(pip) install -e ./
clean:
rm -rf env *.egg *.egg-info
find . -name \*.pyc -delete
schema: env
$(honcho_run) ./recreate-schema.sh
data:
$(honcho_run) $(env_bin)/fake_data fake_data
run: env
PATH=$(env_bin):$(PATH) $(honcho_run) web
py: env
$(honcho_run) $(env_bin)/python -i -c 'from gratipay.wireup import env, db; db = db(env())'
test-schema: env
$(honcho) -e $(test_env_files) run ./recreate-schema.sh
pyflakes: env
$(env_bin)/pyflakes bin gratipay tests
test: test-schema pytest jstest
pytest: env
$(py_test) --cov gratipay ./tests/py/
@$(MAKE) --no-print-directory pyflakes
retest: env
$(py_test) ./tests/py/ --lf
@$(MAKE) --no-print-directory pyflakes
test-cov: env
$(py_test) --cov-report html --cov gratipay ./tests/py/
tests: test
node_modules: package.json
npm install
@if [ -d node_modules ]; then touch node_modules; fi
jstest: node_modules
./node_modules/.bin/grunt test
transifexrc:
@echo '[https://www.transifex.com]' >.transifexrc
@echo 'hostname = https://www.transifex.com' >>.transifexrc
@echo "password = $$TRANSIFEX_PASS" >>.transifexrc
@echo 'token = ' >>.transifexrc
@echo "username = $$TRANSIFEX_USER" >>.transifexrc
tx:
@if [ ! -x $(env_bin)/tx ]; then $(env_bin)/pip install transifex-client; fi
i18n_upload: env tx
$(env_bin)/pybabel extract -F .babel_extract --no-wrap -o i18n/core.pot templates www
$(env_bin)/tx push -s
rm i18n/*.pot
i18n_download: env tx
$(env_bin)/tx pull -a -f --mode=reviewed --minimum-perc=50
@for f in i18n/*/*.po; do \
sed -E -e '/^"POT?-[^-]+-Date: /d' \
-e '/^"Last-Translator: /d' \
-e '/^#: /d' "$$f" >"$$f.new"; \
mv "$$f.new" "$$f"; \
done