~hristoast/mousikofidi

ref: 0.23 mousikofidi/Makefile -rw-r--r-- 4.3 KiB
664fc01eHristos N. Triantafillou Build status in a table 10 months ago
                                                                                
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
proj_dir := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))

.DEFAULT_GOAL:= server

annotations:
	annotatepy $(proj_dir)/mousikofidi > $(proj_dir)/annotations.json

clean: githooks
	rm -fr $(proj_dir)/__pycache__ \
    $(proj_dir)/annotations.json \
    $(proj_dir)/mousikofidi/__pycache__ \
    $(proj_dir)/.pytest_cache \
    $(proj_dir)/MousikoFidi.egg-info \
    $(proj_dir)/build $(proj_dir)/dist

githooks:
	$(proj_dir)/pre-commit.sh --install

install:
	pip3 install --user --upgrade $(proj_dir)

install-global:
	pip3 install --upgrade $(proj_dir)

uninstall:
	pip3 uninstall MousikoFidi

distribution-archive:
	cd $(proj_dir) && python3 setup.py sdist bdist_wheel

upload-distribution-archive-test:
	test -d $(proj_dir)/dist || exit 1
	cd $(proj_dir) && twine upload --repository-url https://test.pypi.org/legacy/ dist/*

upload-distribution-archive:
	@test -d $(proj_dir)/dist || exit 1
	cd $(proj_dir) && twine upload dist/*

minify-css:
	yuicompressor --type css $(proj_dir)/mousikofidi/static/css/fidi.css -o $(proj_dir)/mousikofidi/static/css/fidi.min.css --charset utf-8
	yuicompressor --type css $(proj_dir)/mousikofidi/static/css/fidi-nes.css -o $(proj_dir)/mousikofidi/static/css/fidi-nes.min.css --charset utf-8
	yuicompressor --type css $(proj_dir)/mousikofidi/static/css/terminal.css -o $(proj_dir)/mousikofidi/static/css/terminal.min.css --charset utf-8
	yuicompressor --type css $(proj_dir)/mousikofidi/static/css/terminal-green.css -o $(proj_dir)/mousikofidi/static/css/terminal-green.min.css --charset utf-8
	yuicompressor --type css $(proj_dir)/mousikofidi/static/css/terminal-solarized.css -o $(proj_dir)/mousikofidi/static/css/terminal-solarized.min.css --charset utf-8

minify-css-quiet:
	@yuicompressor --type css $(proj_dir)/mousikofidi/static/css/fidi.css -o $(proj_dir)/mousikofidi/static/css/fidi.min.css --charset utf-8
	@yuicompressor --type css $(proj_dir)/mousikofidi/static/css/fidi-nes.css -o $(proj_dir)/mousikofidi/static/css/fidi-nes.min.css --charset utf-8
	@yuicompressor --type css $(proj_dir)/mousikofidi/static/css/terminal.css -o $(proj_dir)/mousikofidi/static/css/terminal.min.css --charset utf-8
	@yuicompressor --type css $(proj_dir)/mousikofidi/static/css/terminal-green.css -o $(proj_dir)/mousikofidi/static/css/terminal-green.min.css --charset utf-8
	@yuicompressor --type css $(proj_dir)/mousikofidi/static/css/terminal-solarized.css -o $(proj_dir)/mousikofidi/static/css/terminal-solarized.min.css --charset utf-8

minify-js:
	yuicompressor --type js $(proj_dir)/mousikofidi/static/js/player.js -o $(proj_dir)/mousikofidi/static/js/player.min.js --charset utf-8

minify-js-quiet:
	@yuicompressor --type css $(proj_dir)/mousikofidi/static/js/player.js -o $(proj_dir)/mousikofidi/static/js/player.min.js --charset utf-8

minify: minify-css minify-js

minify-quiet: minify-css-quiet minify-js-quiet

all-requirements: requirements dev-requirements

requirements:
	pip3 install --user -r $(proj_dir)/requirements.txt

dev-requirements: githooks
	pip3 install --user -r $(proj_dir)/dev-requirements.txt

test: githooks test-black test-css-is-minified test-flake8 test-pytest

# TODO: read an env var to decide if we are quiet or verbose
test-verbose: githooks test-black-verbose test-css-is-minified-verbose test-flake8-verbose test-pytest-verbose

test-quiet: githooks test-black-quiet test-css-is-minified-quiet test-flake8-quiet test-pytest-quiet

test-black:
	black --check $(proj_dir)

test-black-quiet:
	@black --quiet --check $(proj_dir)

test-black-verbose:
	black --verbose --check $(proj_dir)

test-css-is-minified: minify-css
	cd $(proj_dir) && ./test_stuff_is_minified.sh

test-css-is-minified-quiet: minify-css-quiet
	@cd $(proj_dir) && ./test_stuff_is_minified.sh

test-css-is-minified-verbose: minify-css
	cd $(proj_dir) && bash -x ./test_stuff_is_minified.sh

test-flake8:
	flake8 $(proj_dir)

test-flake8-quiet:
	@flake8 --quiet $(proj_dir)

test-flake8-verbose:
	flake8 --verbose $(proj_dir)

test-pytest:
	FIDI_CFG=$(proj_dir)/example/fidi.yml pytest $(proj_dir)

test-pytest-quiet:
	@FIDI_CFG=$(proj_dir)/example/fidi.yml pytest --quiet $(proj_dir)

test-pytest-verbose:
	FIDI_CFG=$(proj_dir)/example/fidi.yml pytest --verbosity=2 $(proj_dir)

server: dev-server

dev-server:
	FLASK_APP=$(proj_dir)/mousikofidi.py FLASK_ENV=development flask run

uwsgi-server:
	uwsgi --processes $(shell nproc) --chdir $(proj_dir) --ini $(proj_dir)/example/uwsgi.ini