forked from sunainapai/makesite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (64 loc) · 2.23 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
site:
./makesite.py
serve: site
cd _site && python -m SimpleHTTPServer 2> /dev/null || python3 -m http.server
venv2:
virtualenv ~/.venv/makesite
echo . ~/.venv/makesite/bin/activate > venv
. ./venv && pip install commonmark coverage
venv: FORCE
python3 -m venv ~/.venv/makesite
echo . ~/.venv/makesite/bin/activate > venv
. ./venv && pip install commonmark coverage
test: FORCE
. ./venv && python -m unittest -bv
coverage:
. ./venv && coverage run --branch --source=. -m unittest discover -bv; :
. ./venv && coverage report -m
. ./venv && coverage html
clean:
find . -name "__pycache__" -exec rm -r {} +
find . -name "*.pyc" -exec rm {} +
rm -rf .coverage htmlcov
REV = cat /tmp/rev.txt
example:
#
# Remove existing output directories.
rm -rf _site /tmp/_site
#
# Create params.json for makesite-demo.
echo '{ "base_path": "/makesite-demo", "site_url":' \
'"https://tmug.github.io/makesite-demo" }' > params.json
#
# Generate the website.
. ./venv && ./makesite.py
rm params.json
#
# Get current commit ID.
git rev-parse --short HEAD > /tmp/rev.txt
#
# Write a README for makesite-demo repository.
echo makesite.py demo > _site/README.md
echo ================ >> _site/README.md
echo This is the HTML/CSS source of an example static >> _site/README.md
echo website auto-generated with [sunainapai/makesite][makesite] >> _site/README.md
echo "([$$($(REV))][commit])". >> _site/README.md
echo >> _site/README.md
echo Visit "<https://tmug.github.io/makesite-demo>" to >> _site/README.md
echo view the example website. >> _site/README.md
echo >> _site/README.md
echo [makesite]: https://github.com/sunainapai/makesite >> _site/README.md
echo [commit]: https://github.com/sunainapai/makesite/commit/$$($(REV)) >> _site/README.md
echo [demo]: https://tmug.github.io/makesite-demo >> _site/README.md
#
# Publish makesite-demo.
mv _site /tmp
cd /tmp/_site && git init
cd /tmp/_site && git add .
cd /tmp/_site && git commit -m "Auto-generated with sunainapai/makesite - $$($(REV))"
cd /tmp/_site && git remote add origin https://github.com/tmug/makesite-demo.git
cd /tmp/_site && git log
cd /tmp/_site && git push -f origin master
loc:
grep -vE '^[[:space:]]*#|^[[:space:]]*$$|^[[:space:]]*"""' makesite.py | wc -l
FORCE: