Skip to content

Commit dbce526

Browse files
committed
Update build scripts to deploy new shiny Jekyll site linking to course assets
1 parent 4ff8352 commit dbce526

File tree

10 files changed

+175
-18
lines changed

10 files changed

+175
-18
lines changed

build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ done
2323

2424
# Go through each module
2525
for mod in module-*; do
26-
# Create folder for each module
26+
# Create folder for module
2727
mkdir "$mod"
2828

29-
# Generate lesson plans .pdf
29+
# Generate lesson plan .pdf
3030
doc="$mod/README.md"
3131
if [ -f $doc ]; then
3232
out="output/$mod/$mod.pdf"
@@ -44,7 +44,7 @@ for mod in module-*; do
4444
fi
4545
done
4646

47-
# Generate presentation GitBooks
47+
# Generate presentation GitBook
4848
book="$mod/presentation"
4949
if [ -d $book ]; then
5050
out="output/$mod/presentation"

module-1/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
# 1: What is mesh?
1+
---
2+
layout: page
3+
title: "What is mesh?"
4+
module: "1"
5+
contents:
6+
- _articles/module-1/presentation.md
7+
- _articles/module-1/pdf-assets.md
8+
following: _articles/module-1/presentation.md
9+
---
10+
11+
# Module 1: What is mesh?
212

313
| **Section** | **Length** |
414
|------------------------------------------------------------------------------------|------------|

module-2/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
# 2: Setting up your first node
1+
---
2+
layout: page
3+
title: "Setting up your first node "
4+
module: "2"
5+
contents:
6+
- _articles/module-2/presentation.md
7+
- _articles/module-2/pdf-assets.md
8+
following: _articles/module-2/presentation.md
9+
---
10+
11+
# Module 2: Setting up your first node
212

313
| **Section** | **Length** |
414
|------------------------------------------------------------------------------------|------------|

module-3/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
# 3: Building nodes (hardware)
1+
---
2+
layout: page
3+
title: "Building nodes (hardware)"
4+
module: "3"
5+
contents:
6+
- _articles/module-3/presentation.md
7+
- _articles/module-3/pdf-assets.md
8+
following: _articles/module-3/presentation.md
9+
---
10+
11+
# Module 3: Building nodes (hardware)
212

313
| **Section** | **Length** |
414
|------------------------------------------------------------------------------------|------------|

module-4/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
# 4: Planning a network
1+
---
2+
layout: page
3+
title: "Planning a network"
4+
module: "4"
5+
contents:
6+
- _articles/module-4/presentation.md
7+
- _articles/module-4/pdf-assets.md
8+
following: _articles/module-4/presentation.md
9+
---
10+
11+
# Module 4: Planning a network
212

313
| **Section** | **Length** |
414
|------------------------------------------------------------------------------------------------------|------------|

module-5/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
# 5: Measuring networks
1+
---
2+
layout: page
3+
title: "Measuring networks"
4+
module: "5"
5+
contents:
6+
- _articles/module-5/presentation.md
7+
- _articles/module-5/pdf-assets.md
8+
following: _articles/module-5/presentation.md
9+
---
10+
11+
# Module 5: Measuring networks
212

313
| **Section** | **Length** |
414
|------------------------------------------------------------------------------------|------------|

module-6/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
# 6: Living on a decentralized network
1+
---
2+
layout: page
3+
title: "Living on a decentralized network"
4+
module: "6"
5+
contents:
6+
- _articles/module-6/presentation.md
7+
- _articles/module-6/pdf-assets.md
8+
following: _articles/module-6/presentation.md
9+
---
10+
11+
# Module 6: Living on a decentralized network
212

313
| **Section** | **Length** |
414
|------------------------------------------------------------------------------------|------------|

package.sh

Lines changed: 104 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,113 @@
22

33
RELEASE_VERSION=$1
44

5+
###################################################
6+
# Package archives for releasing to GitHub Release
7+
###################################################
8+
59
# Create directory for release assets ready to be published
6-
rm -rf publish
7-
mkdir publish
10+
#rm -rf publish
11+
#mkdir publish
812

913
# Package assets in tar.gz and zip formats
10-
tar --create --gzip -f "publish/workshop-materials-${RELEASE_VERSION}.tar.gz" -C output .
11-
cd output; zip --recurse-paths "../publish/workshop-materials-${RELEASE_VERSION}.zip" .; cd ..
14+
#tar --create --gzip -f "publish/workshop-materials-${RELEASE_VERSION}.tar.gz" -C output .
15+
#cd output; zip --recurse-paths "../publish/workshop-materials-${RELEASE_VERSION}.zip" .; cd ..
16+
17+
##########################################
18+
# Generate hosted assets for GitHub Pages
19+
##########################################
20+
21+
# Replace home page in site directory with repo README.md
22+
homepage="site/index.md"
23+
rm -f "$homepage"
24+
{
25+
echo "---"
26+
echo "layout: home"
27+
echo "---"
28+
} > "$homepage"
29+
cat "README.md" >> "$homepage"
30+
31+
# Create directory for release assets in site directory
32+
art="site/_articles"
33+
rm -rf "$art"
34+
mkdir "$art"
35+
36+
# Create folder for general assets
37+
dst="$art/general"
38+
mkdir "$dst"
39+
40+
# Create .pdf assets index file
41+
{
42+
echo "---"
43+
echo "layout: page"
44+
echo "title: 'General'"
45+
echo "---"
46+
echo "## General PDF assets" >> "$dst.md"
47+
} > "$dst.md"
48+
49+
# Copy .pdf assets
50+
for doc in output/general/*.pdf; do
51+
if [ -f $doc ]; then
52+
cp "$doc" "$dst"
53+
filename=$(basename $doc)
54+
echo "* [$filename]($filename)" >> "$dst.md"
55+
fi
56+
done
57+
58+
# Go through each module
59+
for mod in module-*; do
60+
# Create folder for module
61+
dst="$art/$mod"
62+
mkdir "$dst"
63+
64+
# Copy .md lesson plan
65+
cp "$mod/README.md" "$dst.md"
66+
67+
# Create presentation index file
68+
{
69+
echo "---"
70+
echo "layout: page"
71+
echo "title: 'Presentation slides'"
72+
echo "module: '$(echo "$mod" | sed 's/module-/Module /')'"
73+
echo "---"
74+
echo "## $(echo "Presentation slides for $mod" | sed 's/module-/Module /')"
75+
} > "$dst/presentation.md"
76+
77+
# Copy presentation
78+
cp -r "output/$mod/presentation" "$dst/presentation"
79+
echo "* [presentation](index.html)" >> "$dst/presentation.md"
80+
81+
# Create .pdf assets index file
82+
{
83+
echo "---"
84+
echo "layout: page"
85+
echo "title: 'PDF assets'"
86+
echo "module: '$(echo "$mod" | sed 's/module-/Module /')'"
87+
echo "---"
88+
echo "## $(echo "PDF assets for $mod" | sed 's/module-/Module /')"
89+
} > "$dst/pdf-assets.md"
90+
91+
# Copy .pdf assets
92+
mkdir "$dst/pdf-assets"
93+
94+
echo "" >> "$dst/pdf-assets.md"
95+
echo "### Lesson plan" >> "$dst/pdf-assets.md"
96+
cp "output/$mod/$mod.pdf" "$dst/pdf-assets"
97+
filename="$mod.pdf"
98+
echo "* [$filename]($filename)" >> "$dst/pdf-assets.md"
1299

13-
# Copy hosted assets to site directory
14-
cp -r output site/materials
100+
if [ -f output/$mod/worksheet/*.pdf ]; then
101+
echo "" >> "$dst/pdf-assets.md"
102+
echo "### Class worksheets" >> "$dst/pdf-assets.md"
103+
for doc in output/$mod/worksheet/*.pdf; do
104+
if [ -f $doc ]; then
105+
cp "$doc" "$dst/pdf-assets"
106+
filename=$(basename $doc)
107+
echo "* [$filename]($filename)" >> "$dst/pdf-assets.md"
108+
fi
109+
done
110+
fi
111+
done
15112

16113
# Build static website
17-
cd site; bundle install; bundle exec jekyll build; cd ..
114+
cd site; bundle install; bundle exec jekyll build; cd ..

site/_layouts/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h2>{{ site.subtitle }}</h2>
1010

1111
<div class="lesson-content">
1212
{{ content }}
13-
<a class="btn btn-lg btn-default btn-next" href="articles/readme">
13+
<a class="btn btn-lg btn-default btn-next" href="articles/module-1">
1414
Get started &nbsp; <i class="fa fa-play" aria-hidden="true"></i>
1515
</a>
1616
</div>

site/contents.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
layout: default
33
contents:
4-
- _articles/general.md
54
- _articles/module-1.md
65
- _articles/module-2.md
76
- _articles/module-3.md
87
- _articles/module-4.md
98
- _articles/module-5.md
109
- _articles/module-6.md
10+
- _articles/general.md
1111
---
1212

1313
{% include contents.html %}

0 commit comments

Comments
 (0)