From 67fe23bf0d779d02027f555a0b7a4fbd8c6ec811 Mon Sep 17 00:00:00 2001 From: Benedict Lau Date: Thu, 12 Apr 2018 01:50:56 -0400 Subject: [PATCH] Restructure and add build script for generating class material --- .gitignore | 8 +++ README.md | 14 ++--- build | 57 +++++++++++++++++++ resources.md => general/extra-resources.md | 0 template.md => general/module-template.md | 0 .../post-workshop-survey.md | 0 .../pre-workshop-survey.md | 0 {organization => general}/welcome-email.txt | 0 materials/module-1/presentation/.gitignore | 4 -- .../module-1/presentation/serve-presentation | 4 -- materials/module-1/worksheets/.gitignore | 1 - materials/module-1/worksheets/generate-pdf | 12 ---- module-1.md => module-1/README.md | 0 .../presentation/README.md | 0 .../presentation/SUMMARY.md | 0 .../presentation/part-0/README.md | 0 .../presentation/part-0/introduce-yourself.md | 0 .../presentation/part-0/who-runs-this.md | 0 .../presentation/part-1/README.md | 0 .../presentation/part-1/home-internet.md | 0 .../presentation/part-1/home-internet.svg | 0 .../presentation/part-1/mesh-communities.md | 0 .../presentation/part-1/mesh-topology.md | 0 .../presentation/part-1/mesh-topology.svg | 0 .../part-1/peer-to-peer-applications.md | 0 .../part-1/peer-to-peer-applications.svg | 0 .../presentation/part-2/README.md | 0 .../presentation/part-3/README.md | 0 .../presentation/part-4/README.md | 0 .../presentation/part-4/homework.md | 0 .../presentation/part-4/recap.md | 0 .../2-peer-to-peer-file-sharing-on-a-mesh.md | 0 .../worksheet}/3-community-local-impact.md | 0 .../worksheet}/3-design-access.md | 0 .../worksheet}/3-mission-ownership.md | 0 .../worksheet}/3-profit-sustainability.md | 0 .../worksheet}/3-teaching-learning.md | 0 .../worksheet}/peer-to-peer-applications.svg | 0 module-2.md => module-2/README.md | 0 module-3.md => module-3/README.md | 0 module-4.md => module-4/README.md | 0 module-5.md => module-5/README.md | 0 module-6.md => module-6/README.md | 0 .../module-1/worksheets/pdf.css => pdf.css | 0 44 files changed, 72 insertions(+), 28 deletions(-) create mode 100644 .gitignore create mode 100755 build rename resources.md => general/extra-resources.md (100%) rename template.md => general/module-template.md (100%) rename {organization => general}/post-workshop-survey.md (100%) rename {organization => general}/pre-workshop-survey.md (100%) rename {organization => general}/welcome-email.txt (100%) delete mode 100644 materials/module-1/presentation/.gitignore delete mode 100755 materials/module-1/presentation/serve-presentation delete mode 100644 materials/module-1/worksheets/.gitignore delete mode 100755 materials/module-1/worksheets/generate-pdf rename module-1.md => module-1/README.md (100%) rename {materials/module-1 => module-1}/presentation/README.md (100%) rename {materials/module-1 => module-1}/presentation/SUMMARY.md (100%) rename {materials/module-1 => module-1}/presentation/part-0/README.md (100%) rename {materials/module-1 => module-1}/presentation/part-0/introduce-yourself.md (100%) rename {materials/module-1 => module-1}/presentation/part-0/who-runs-this.md (100%) rename {materials/module-1 => module-1}/presentation/part-1/README.md (100%) rename {materials/module-1 => module-1}/presentation/part-1/home-internet.md (100%) rename {materials/module-1 => module-1}/presentation/part-1/home-internet.svg (100%) rename {materials/module-1 => module-1}/presentation/part-1/mesh-communities.md (100%) rename {materials/module-1 => module-1}/presentation/part-1/mesh-topology.md (100%) rename {materials/module-1 => module-1}/presentation/part-1/mesh-topology.svg (100%) rename {materials/module-1 => module-1}/presentation/part-1/peer-to-peer-applications.md (100%) rename {materials/module-1 => module-1}/presentation/part-1/peer-to-peer-applications.svg (100%) rename {materials/module-1 => module-1}/presentation/part-2/README.md (100%) rename {materials/module-1 => module-1}/presentation/part-3/README.md (100%) rename {materials/module-1 => module-1}/presentation/part-4/README.md (100%) rename {materials/module-1 => module-1}/presentation/part-4/homework.md (100%) rename {materials/module-1 => module-1}/presentation/part-4/recap.md (100%) rename {materials/module-1/worksheets => module-1/worksheet}/2-peer-to-peer-file-sharing-on-a-mesh.md (100%) rename {materials/module-1/worksheets => module-1/worksheet}/3-community-local-impact.md (100%) rename {materials/module-1/worksheets => module-1/worksheet}/3-design-access.md (100%) rename {materials/module-1/worksheets => module-1/worksheet}/3-mission-ownership.md (100%) rename {materials/module-1/worksheets => module-1/worksheet}/3-profit-sustainability.md (100%) rename {materials/module-1/worksheets => module-1/worksheet}/3-teaching-learning.md (100%) rename {materials/module-1/worksheets => module-1/worksheet}/peer-to-peer-applications.svg (100%) rename module-2.md => module-2/README.md (100%) rename module-3.md => module-3/README.md (100%) rename module-4.md => module-4/README.md (100%) rename module-5.md => module-5/README.md (100%) rename module-6.md => module-6/README.md (100%) rename materials/module-1/worksheets/pdf.css => pdf.css (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2e0575e --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +# Generated asset directory +output + +# GitBook +_book +book.pdf +book.epub +book.mobi diff --git a/README.md b/README.md index 974f49c..7374265 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,12 @@ Participants will be expected to bring their own laptop. ## Module Topics -1. [What is mesh?](./module-1.md) -1. [Setting up your first node](./module-2.md) -1. [Building nodes (hardware)](./module-3.md) -1. [Planning a network](./module-4.md) -1. [Measuring networks](./module-5.md) -1. [Living on a decentralized network](./module-6.md) +1. [What is mesh?](./module-1/README.md) +1. [Setting up your first node](./module-2/README.md) +1. [Building nodes (hardware)](./module-3/README.md) +1. [Planning a network](./module-4/README.md) +1. [Measuring networks](./module-5/README.md) +1. [Living on a decentralized network](./module-6/README.md) ## Learning Outcomes @@ -34,7 +34,7 @@ Participants will be expected to bring their own laptop. - TPL will provide Raspberry Pi 2s and 3s - Participants will bring their own laptop -- Participants will receive primer information via a [welcome email](./organization/welcome-email.txt), which includes [laptop setup instructions](./SETUP.md), a Linux shell primer, and a [pre-workshop survey](./organization/pre-workshop-survey.md) +- Participants will receive primer information via a [welcome email](./general/welcome-email.txt), which includes [laptop setup instructions](./SETUP.md), a Linux shell primer, and a [pre-workshop survey](./general/pre-workshop-survey.md) - Participants are comfortable using a computer before, with no assumptions about prior programming or networking knowledge ## Facilitation Guidelines diff --git a/build b/build new file mode 100755 index 0000000..461a59c --- /dev/null +++ b/build @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +# Check for required tools +echo "Checking for markdown-pdf node module" +npm -g list markdown-pdf +S=$? +if [ $S -ne 0 ]; then + echo "markdown-pdf is missing, install by running:" + echo " npm install -g markdown-pdf" + return $S +fi + +echo "Checking for gitbook-cli node module" +npm -g list gitbook-cli +S=$? +if [ $S -ne 0 ]; then + echo "gitbook-cli is missing, install by running:" + echo " npm install -g gitbook-cli" + return $S +fi + +# Delete generated assets +rm -rf output +mkdir output + +# Get absolute path to pdf.css +basedir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +css="$basedir/pdf.css" +echo "Using CSS styles from $css" + +# Go through each module +for mod in module-*; do + # Generate lesson plans .pdf + doc="$mod/README.md" + if [ -f $doc ]; then + out="output/$mod.pdf" + echo "Generating lesson plan from $doc to $out" + markdown-pdf "$doc" --out "$out" --cwd "$mod" --css-path pdf.css + fi + + # Generate worksheets as .pdf + for doc in $mod/worksheet/*.md; do + if [ -f $doc ]; then + out="output/$(echo "$doc" | sed 's|/|-|g' | sed 's|.md|.pdf|')" + echo "Generating worksheet from $doc to $out" + markdown-pdf "$doc" --out "$out" --cwd "$mod/worksheet" --css-path pdf.css + fi + done + + # Generate presentation GitBooks + book="$mod/presentation" + if [ -d $book ]; then + out="output/$(echo "$book" | sed 's|/|-|g')" + echo "Generating presentation from $book to $out" + gitbook build "$book" "$out" + fi +done diff --git a/resources.md b/general/extra-resources.md similarity index 100% rename from resources.md rename to general/extra-resources.md diff --git a/template.md b/general/module-template.md similarity index 100% rename from template.md rename to general/module-template.md diff --git a/organization/post-workshop-survey.md b/general/post-workshop-survey.md similarity index 100% rename from organization/post-workshop-survey.md rename to general/post-workshop-survey.md diff --git a/organization/pre-workshop-survey.md b/general/pre-workshop-survey.md similarity index 100% rename from organization/pre-workshop-survey.md rename to general/pre-workshop-survey.md diff --git a/organization/welcome-email.txt b/general/welcome-email.txt similarity index 100% rename from organization/welcome-email.txt rename to general/welcome-email.txt diff --git a/materials/module-1/presentation/.gitignore b/materials/module-1/presentation/.gitignore deleted file mode 100644 index c0fbe4d..0000000 --- a/materials/module-1/presentation/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -_book -book.pdf -book.epub -book.mobi diff --git a/materials/module-1/presentation/serve-presentation b/materials/module-1/presentation/serve-presentation deleted file mode 100755 index d6ccfda..0000000 --- a/materials/module-1/presentation/serve-presentation +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -# Requires: npm install -g gitbook-cli -gitbook serve diff --git a/materials/module-1/worksheets/.gitignore b/materials/module-1/worksheets/.gitignore deleted file mode 100644 index 53752db..0000000 --- a/materials/module-1/worksheets/.gitignore +++ /dev/null @@ -1 +0,0 @@ -output diff --git a/materials/module-1/worksheets/generate-pdf b/materials/module-1/worksheets/generate-pdf deleted file mode 100755 index bc61a5c..0000000 --- a/materials/module-1/worksheets/generate-pdf +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -rm -rf output -mkdir output - -# Requires: npm install -g markdown-pdf -markdown-pdf 2-peer-to-peer-file-sharing-on-a-mesh.md -o output/2-peer-to-peer-file-sharing-on-a-mesh.pdf -s pdf.css -markdown-pdf 3-mission-ownership.md -o output/3-mission-ownership.pdf -s pdf.css -markdown-pdf 3-design-access.md -o output/3-design-access.pdf -s pdf.css -markdown-pdf 3-community-local-impact.md -o output/3-community-local-impact.pdf -s pdf.css -markdown-pdf 3-profit-sustainability.md -o output/3-profit-sustainability.pdf -s pdf.css -markdown-pdf 3-teaching-learning.md -o output/3-teaching-learning.pdf -s pdf.css diff --git a/module-1.md b/module-1/README.md similarity index 100% rename from module-1.md rename to module-1/README.md diff --git a/materials/module-1/presentation/README.md b/module-1/presentation/README.md similarity index 100% rename from materials/module-1/presentation/README.md rename to module-1/presentation/README.md diff --git a/materials/module-1/presentation/SUMMARY.md b/module-1/presentation/SUMMARY.md similarity index 100% rename from materials/module-1/presentation/SUMMARY.md rename to module-1/presentation/SUMMARY.md diff --git a/materials/module-1/presentation/part-0/README.md b/module-1/presentation/part-0/README.md similarity index 100% rename from materials/module-1/presentation/part-0/README.md rename to module-1/presentation/part-0/README.md diff --git a/materials/module-1/presentation/part-0/introduce-yourself.md b/module-1/presentation/part-0/introduce-yourself.md similarity index 100% rename from materials/module-1/presentation/part-0/introduce-yourself.md rename to module-1/presentation/part-0/introduce-yourself.md diff --git a/materials/module-1/presentation/part-0/who-runs-this.md b/module-1/presentation/part-0/who-runs-this.md similarity index 100% rename from materials/module-1/presentation/part-0/who-runs-this.md rename to module-1/presentation/part-0/who-runs-this.md diff --git a/materials/module-1/presentation/part-1/README.md b/module-1/presentation/part-1/README.md similarity index 100% rename from materials/module-1/presentation/part-1/README.md rename to module-1/presentation/part-1/README.md diff --git a/materials/module-1/presentation/part-1/home-internet.md b/module-1/presentation/part-1/home-internet.md similarity index 100% rename from materials/module-1/presentation/part-1/home-internet.md rename to module-1/presentation/part-1/home-internet.md diff --git a/materials/module-1/presentation/part-1/home-internet.svg b/module-1/presentation/part-1/home-internet.svg similarity index 100% rename from materials/module-1/presentation/part-1/home-internet.svg rename to module-1/presentation/part-1/home-internet.svg diff --git a/materials/module-1/presentation/part-1/mesh-communities.md b/module-1/presentation/part-1/mesh-communities.md similarity index 100% rename from materials/module-1/presentation/part-1/mesh-communities.md rename to module-1/presentation/part-1/mesh-communities.md diff --git a/materials/module-1/presentation/part-1/mesh-topology.md b/module-1/presentation/part-1/mesh-topology.md similarity index 100% rename from materials/module-1/presentation/part-1/mesh-topology.md rename to module-1/presentation/part-1/mesh-topology.md diff --git a/materials/module-1/presentation/part-1/mesh-topology.svg b/module-1/presentation/part-1/mesh-topology.svg similarity index 100% rename from materials/module-1/presentation/part-1/mesh-topology.svg rename to module-1/presentation/part-1/mesh-topology.svg diff --git a/materials/module-1/presentation/part-1/peer-to-peer-applications.md b/module-1/presentation/part-1/peer-to-peer-applications.md similarity index 100% rename from materials/module-1/presentation/part-1/peer-to-peer-applications.md rename to module-1/presentation/part-1/peer-to-peer-applications.md diff --git a/materials/module-1/presentation/part-1/peer-to-peer-applications.svg b/module-1/presentation/part-1/peer-to-peer-applications.svg similarity index 100% rename from materials/module-1/presentation/part-1/peer-to-peer-applications.svg rename to module-1/presentation/part-1/peer-to-peer-applications.svg diff --git a/materials/module-1/presentation/part-2/README.md b/module-1/presentation/part-2/README.md similarity index 100% rename from materials/module-1/presentation/part-2/README.md rename to module-1/presentation/part-2/README.md diff --git a/materials/module-1/presentation/part-3/README.md b/module-1/presentation/part-3/README.md similarity index 100% rename from materials/module-1/presentation/part-3/README.md rename to module-1/presentation/part-3/README.md diff --git a/materials/module-1/presentation/part-4/README.md b/module-1/presentation/part-4/README.md similarity index 100% rename from materials/module-1/presentation/part-4/README.md rename to module-1/presentation/part-4/README.md diff --git a/materials/module-1/presentation/part-4/homework.md b/module-1/presentation/part-4/homework.md similarity index 100% rename from materials/module-1/presentation/part-4/homework.md rename to module-1/presentation/part-4/homework.md diff --git a/materials/module-1/presentation/part-4/recap.md b/module-1/presentation/part-4/recap.md similarity index 100% rename from materials/module-1/presentation/part-4/recap.md rename to module-1/presentation/part-4/recap.md diff --git a/materials/module-1/worksheets/2-peer-to-peer-file-sharing-on-a-mesh.md b/module-1/worksheet/2-peer-to-peer-file-sharing-on-a-mesh.md similarity index 100% rename from materials/module-1/worksheets/2-peer-to-peer-file-sharing-on-a-mesh.md rename to module-1/worksheet/2-peer-to-peer-file-sharing-on-a-mesh.md diff --git a/materials/module-1/worksheets/3-community-local-impact.md b/module-1/worksheet/3-community-local-impact.md similarity index 100% rename from materials/module-1/worksheets/3-community-local-impact.md rename to module-1/worksheet/3-community-local-impact.md diff --git a/materials/module-1/worksheets/3-design-access.md b/module-1/worksheet/3-design-access.md similarity index 100% rename from materials/module-1/worksheets/3-design-access.md rename to module-1/worksheet/3-design-access.md diff --git a/materials/module-1/worksheets/3-mission-ownership.md b/module-1/worksheet/3-mission-ownership.md similarity index 100% rename from materials/module-1/worksheets/3-mission-ownership.md rename to module-1/worksheet/3-mission-ownership.md diff --git a/materials/module-1/worksheets/3-profit-sustainability.md b/module-1/worksheet/3-profit-sustainability.md similarity index 100% rename from materials/module-1/worksheets/3-profit-sustainability.md rename to module-1/worksheet/3-profit-sustainability.md diff --git a/materials/module-1/worksheets/3-teaching-learning.md b/module-1/worksheet/3-teaching-learning.md similarity index 100% rename from materials/module-1/worksheets/3-teaching-learning.md rename to module-1/worksheet/3-teaching-learning.md diff --git a/materials/module-1/worksheets/peer-to-peer-applications.svg b/module-1/worksheet/peer-to-peer-applications.svg similarity index 100% rename from materials/module-1/worksheets/peer-to-peer-applications.svg rename to module-1/worksheet/peer-to-peer-applications.svg diff --git a/module-2.md b/module-2/README.md similarity index 100% rename from module-2.md rename to module-2/README.md diff --git a/module-3.md b/module-3/README.md similarity index 100% rename from module-3.md rename to module-3/README.md diff --git a/module-4.md b/module-4/README.md similarity index 100% rename from module-4.md rename to module-4/README.md diff --git a/module-5.md b/module-5/README.md similarity index 100% rename from module-5.md rename to module-5/README.md diff --git a/module-6.md b/module-6/README.md similarity index 100% rename from module-6.md rename to module-6/README.md diff --git a/materials/module-1/worksheets/pdf.css b/pdf.css similarity index 100% rename from materials/module-1/worksheets/pdf.css rename to pdf.css