forked from susam/texme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
69 lines (62 loc) · 1.84 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
help:
@echo 'Usage: make [target]'
@echo
@echo 'Targets:'
@echo ' test Run tests.'
@echo ' coverage Run test coverage.'
@echo ' docs Generate documentation.'
@echo ' deps Install development dependencies.'
@echo ' pushdocs Publish documentation with GitHub Pages'
test: FORCE
npm test
coverage: FORCE
npm run coverage
docs: FORCE
rm -rf docs
npm run docs
deps:
npm install
TMP_REV = /tmp/rev.txt
CAT_REV = cat $(TMP_REV)
GIT_SRC = https://github.com/susam/texme
GIT_DST = https://github.com/opendocs/texme
WEB_URL = https://opendocs.github.io/texme/
TMP_GIT = /tmp/tmpgit
README = docs/README.md
pushdocs: docs
#
# Get current commit ID.
git rev-parse --short HEAD > $(TMP_REV)
#
# Copy examples.
mkdir docs/examples
for f in examples/*.html; do \
sed 's/...texme.js/https:\/\/cdn.jsdelivr.net\/npm\/[email protected]/' "$$f" > \
docs/examples/"$$(basename "$$f")"; \
done
#
# Create README.
echo TeXMe Documentation and Examples >> $(README)
echo ================================ >> $(README)
echo >> $(README)
echo Automatically generated from [susam/texme][GIT_SRC] >> $(README)
echo "([$$($(CAT_REV))][GIT_REV])". >> $(README)
echo >> $(README)
echo Visit $(WEB_URL) to view the documentation. >> $(README)
echo >> $(README)
echo [GIT_SRC]: $(GIT_SRC) >> $(README)
echo [WEB_URL]: $(WEB_URL) >> $(README)
echo [GIT_REV]: $(GIT_SRC)/commit/$$($(CAT_REV)) >> $(README)
#
# Create Git repo and push.
rm -rf $(TMP_GIT)
mv docs $(TMP_GIT)
cd $(TMP_GIT) && git init
cd $(TMP_GIT) && git config user.name Makesite
cd $(TMP_GIT) && git config user.email [email protected]
cd $(TMP_GIT) && git add .
cd $(TMP_GIT) && git commit -m "Generated from $(GIT_SRC) - $$($(CAT_REV))"
cd $(TMP_GIT) && git remote add origin "$(GIT_DST).git"
cd $(TMP_GIT) && git log
cd $(TMP_GIT) && git push -f origin master
FORCE: