forked from RosettaCommons/PyRosetta.notebooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-student-nb.bash
executable file
·66 lines (50 loc) · 1.67 KB
/
make-student-nb.bash
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
#!/bin/bash
# This script generates the "student-notebooks" folder with student versions of
# the workshops in the "notebooks" folder. It also updates the TOC and keyword
# index based on the workshops in the "notebooks" folder.
# Make sure you have already installed nbgrader
# (https://nbgrader.readthedocs.io/en/stable/user_guide/installation.html)
# and nbpages (https://pypi.org/project/nbpages/).
# Update TOC and indexes
nbpages
# Re-creating student-notebooks folder
rm -r student-notebooks
nbgrader quickstart student-notebooks
# Copying notebooks in instructor's folder to the new source folder in student-notebooks folder
for i in ./notebooks/*.ipynb
do
s=${i##*/}
fname=${s%.ipynb}
mkdir ./student-notebooks/source/$fname
cp $i ./student-notebooks/source/$fname/$fname.ipynb
done
# Create assignments in release folder
cd student-notebooks
for i in ./source/*
do
nbgrader db assignment add ${i##*/}
nbgrader assign ${i##*/}
done
# Delete source folder
rm -r source
# Re-format student-notebooks folder and delete release folder
for i in ./release/*
do
s=${i##*/}
fname=${s%.ipynb}
#echo $fname
chmod 777 $i/*
cp $i/* ./$fname.ipynb
done
rm -r release
# Copy over the Media and other folders to student-notebooks folder
cp -r ../notebooks/Media ./Media
cp -r ../notebooks/expected_outputs ./expected_outputs
cp -r ../notebooks/outputs ./outputs
cp -r ../notebooks/inputs ./inputs
# Edit TOC and index so that links are to the student versions
sed 's/\/notebooks\//\/student-notebooks\//g' toc.ipynb > _toc.ipynb
sed 's/\/notebooks\//\/student-notebooks\//g' index.ipynb > _index.ipynb
# Remove old toc file and index file
rm toc.ipynb
rm index.ipynb