forked from gdsbook/book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (53 loc) · 1.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
.PHONY: all html
lab:
docker run --rm \
-p 4000:4000 \
-p 8888:8888 \
--user root \
-e NB_UID=1001 \
-e NB_GID=100 \
-v ${PWD}:/home/jovyan/work \
darribas/gds_dev:5.0
sync:
jupytext --sync ./notebooks/*.ipynb
html: sync
echo "Cleaning up existing tmp_book folder..."
rm -rf docs
rm -rf tmp_book
echo "Populating build folder..."
mkdir tmp_book
mkdir tmp_book/notebooks
cp notebooks/*.ipynb tmp_book/notebooks/
cp notebooks/references.bib tmp_book/notebooks/
cp -r data tmp_book/data
cp -r figures tmp_book/figures
cp infrastructure/website_content/* tmp_book/
cp infrastructure/logo/ico_256x256.png tmp_book/logo.png
cp infrastructure/logo/favicon.ico tmp_book/favicon.ico
echo "Starting book build..."
jupyter-book build tmp_book
echo "Moving build..."
mv tmp_book/_build/html docs
echo "Cleaning up..."
rm -r tmp_book
touch docs/.nojekyll
reset_docs:
rm -rf docs/*
git checkout HEAD docs/*
# Run for example as: `make test_one nb=00_toc`
test_one:
jupyter nbconvert --to notebook \
--execute \
--ExecutePreprocessor.timeout=600 \
notebooks/$(nb).ipynb
rm notebooks/$(nb).nbconvert.ipynb
test:
rm -rf tests
mkdir tests
jupyter nbconvert --to notebook \
--execute \
--output-dir=tests \
--ExecutePreprocessor.timeout=600 \
notebooks/*.ipynb
rm -rf tests
echo "########\n\nAll blocks passed\n\n########"