-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·620 lines (529 loc) · 18.3 KB
/
build.sh
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
#!/bin/bash
set -euo pipefail
repeat() {
# Output a string consisting of $1 copies of character $2
printf "%${1}s" | tr ' ' "$2"
}
# Binaries from my geom2018 repo live here
GEOMDIR="../geom2018/bin"
# Input & output directories of this script
SITE_INDIR="src"
SITE_OUTDIR="dst"
# Keep a newline around in a variable
NL='
'
# Separator token for "code blocks"
BLOCKSEP='```'
# Command which converts .fus to .html (from geom2018 repo)
LEXERTOOL="$GEOMDIR/lexertool"
fus2html() {
"$LEXERTOOL" -r --html
}
# Directory containing the .fus files used by blocks of type "fusfig"
# (and related directories...)
FUSFIG_DIR="src/figures"
FUSFIG_OUTDIR="fusfig/dst"
FUSFIG_STATIC="figs"
FUSFIG_STATICDIR="$SITE_OUTDIR/$FUSFIG_STATIC"
FUSFIG_EXT="png"
# The minieditor command from geom2018 repo
MINIEDITOR="$GEOMDIR/minieditor"
minieditor() {
"$MINIEDITOR" --pal fusfig/pal.fus --font fusfig/font.fus --fonts fusfig/fonts.fus "$@"
}
MINIEDITOR_SCREENSHOT="screen.bmp"
# Directories/urls of the files generated by blocks of type "bb"
DEFAULT_BB_T1=100000
BB_CHANNELS=2
BB_OUTDIR="bb/dst"
BB_TMPDIR="bb/tmp"
BB_STATIC="bb"
BB_STATICDIR="$SITE_OUTDIR/$BB_STATIC"
BB_HEADERFILE="bb/header.html"
# Name of the website we're building
SITENAME="bayersglassey.com"
# Set up variables so we can easily print horizontal lines
LINEWIDTH=60
THINLINE="$(repeat "$LINEWIDTH" '-')"
THICKLINE="$(repeat "$LINEWIDTH" '#')"
log_depth=0
log() {
repeat "$log_depth" " "
echo "=== $@" >&2
}
do_with_log() {
log "Executing: $@"
"$@"
}
print_thinline() {
echo "$THINLINE" >&2
}
print_thickline() {
echo "$THICKLINE" >&2
}
require_cmd() {
command -v "$1" >/dev/null || {
log "Missing required command: $1"
exit 1
}
}
# Markdown parser command, we feed it Markdown and expect HTML back.
# Currently using `apt install markdown`
require_cmd markdown
# sox for audio format conversion
require_cmd sox
require_cmd "$LEXERTOOL"
require_cmd "$MINIEDITOR"
#############################################################################
copydir() {
# Why rm -rf "$2" first?.. because cp -r "$1" "$2" will behave differently
# depending on whether "$2" already exists.
# If it already exists, cp will put everything *inside* it!..
# Which is not what we want.
do_with_log rm -rf "$2"
do_with_log cp -r "$1" "$2"
}
pageurl() {
# Usage: pageurl OUTFILE
PAGEURL_FILENAME="`echo "$1" | sed "s@/root/@/@"`"
echo "/${PAGEURL_FILENAME#$SITE_OUTDIR/}"
}
htmlescape() {
# Based on: https://stackoverflow.com/a/12873723
sed \
-e 's/&/\&/g' \
-e 's/</\</g' \
-e 's/>/\>/g' \
-e 's/"/\"/g' \
-e 's/'"'"'/\'/g'
}
chop() {
# Usage: chop DATA SEPARATOR
# Chops DATA into two substrings at the first occurrence of SEPARATOR.
# The substrings are returned in HEAD and TAIL.
HEAD="${1%%"$2"*}"
TAIL="${1#*"$2"}"
}
replace() {
# Usage: replace STR1 STR2 STRING
# Replaces first occurrence of STR1 with STR2 in STRING.
# Returns the result in REPLACED.
chop "$3" "$1"
REPLACED="$HEAD$2$TAIL"
}
parseblocks() {
# Usage: parseblocks DATA
# Parses DATA, replacing blocks with "{BLOCKxxx}" where xxx is a nonnegative integer.
# The parsed string is returned in PARSED.
# The data of each block xxx is stored in corresponding variables BLOCKxxx.
# The type of each block xxx is stored in corresponding variables BLOCKTYPExxx.
#
# Example of a block (in this case, the type is "json"):
#
# ```json
# {
# "a": 1,
# "b": 2
# }
# ```
#
# Example of iterating over the blocks:
#
# for i in `seq "$BLOCKNUM"`
# do eval "echo \"Block \$i (\$BLOCKTYPE$i): \$BLOCK$i\""
# done
#
DATA="$1"
PARSED=""
BLOCKNUM=0
while true
do
chop "$DATA" "$BLOCKSEP"
test "$HEAD" != "$DATA" || break
# BLOCKNUM was initialized to 0 outside the loop.
# We increment it here *before* using it, so first blocknum is 1.
# This is so that we can iterate over it using `seq $BLOCKNUM`.
BLOCKNUM="`expr "$BLOCKNUM" + 1`"
HEAD0="$HEAD"
chop "$TAIL" "$NL"
TYPE="$HEAD"
chop "$TAIL" "$NL$BLOCKSEP"
eval "BLOCK$BLOCKNUM=\"\$HEAD\""
eval "BLOCKTYPE$BLOCKNUM=\"\$TYPE\""
PARSED="$PARSED$HEAD0{BLOCK$BLOCKNUM}"
DATA="$TAIL"
done
PARSED="$PARSED$DATA"
}
fusfig() {
# Generate a figure from an rgraph in a .fus file.
# Writes an <img> tag for the resulting image to stdout.
FUSFIG_TYPE="$1"
FUSFIG_FILENAME="$2"
FUSFIG_RGRAPH="$3"
shift 3
FUSFIG_INFILE="$FUSFIG_DIR/$FUSFIG_FILENAME"
FUSFIG_OUTSUBDIR="$FUSFIG_OUTDIR/${FUSFIG_FILENAME%.fus}"
do_with_log mkdir -p "$FUSFIG_OUTSUBDIR"
FUSFIG_OUTFILE="$FUSFIG_OUTSUBDIR/$FUSFIG_RGRAPH.$FUSFIG_EXT"
FUSFIG_STATICFILE="/$FUSFIG_STATIC/${FUSFIG_FILENAME%.fus}/$FUSFIG_RGRAPH.$FUSFIG_EXT"
log "Building fus figure: $FUSFIG_OUTFILE"
do_with_log minieditor -f "$FUSFIG_INFILE" -n "$FUSFIG_RGRAPH" "$@" -q --nocontrols --screenshot
do_with_log convert "$MINIEDITOR_SCREENSHOT" "$FUSFIG_OUTFILE"
FUSFIG_FILENAME_OUTFILE_RAW="$SITE_OUTDIR/${FUSFIG_INFILE#$SITE_INDIR/}"
FUSFIG_FILENAME_OUTFILE="${FUSFIG_FILENAME_OUTFILE_RAW%.*}.html"
FUSFIG_FILENAME_OUTFILE_URL="`pageurl "$FUSFIG_FILENAME_OUTFILE"`"
# Ganky "extensions" to the fusfig block type...
case "$FUSFIG_TYPE" in
*header*)
echo "<h4><i>$FUSFIG_RGRAPH</i> (defined in <a href=\"$FUSFIG_FILENAME_OUTFILE_URL\">$FUSFIG_FILENAME</a>)</h4>"
esac
echo "<img src=\"$FUSFIG_STATICFILE\">"
}
get_projects() {
find "$SITE_INDIR" -mindepth 1 -maxdepth 1 -type d | sed "s@^$SITE_INDIR/@@"
}
SKIP_PROJECTS="${SKIP_PROJECTS-bytebeats}"
if test "$#" = 0
then
BUILD_ALL=true
PROJECTS="$(get_projects)"
for skip_project in $SKIP_PROJECTS
do
PROJECTS="$(printf %s "$PROJECTS" | grep -v "$skip_project")"
done
PROJECTS="$(printf %s "$PROJECTS" | tr '\n' ' ')"
elif test "$1" = "-h" -o "$1" = "--help"
then
log "Usage: build.sh [PROJECT ...]"
log "If no projects supplied, all will be built, except skipped ones."
log "When building all projects in that way, certain directories will be "
log "deleted & recreated from scratch."
log "Here are all projects: $(get_projects | tr '\n' ' ')"
log "Here are projects skipped by default: $SKIP_PROJECTS"
log "In order to build all projects, but not skip any, set the SKIP_PROJECTS"
log "env var to the empty string: SKIP_PROJECTS= ./build.sh"
exit 0
else
BUILD_ALL=false
PROJECTS="$@"
fi
# And so it begins.
print_thickline
log "Building projects: $PROJECTS"
log "Skipped projects: $SKIP_PROJECTS"
log "Source directory: $SITE_INDIR"
log "Output directory: $SITE_OUTDIR"
# Create output directories
if test "$BUILD_ALL" = true
then
do_with_log rm -rf "$SITE_OUTDIR"
do_with_log rm -rf "$FUSFIG_OUTDIR"
do_with_log rm -rf "$BB_OUTDIR"
fi
do_with_log mkdir -p "$SITE_OUTDIR"
do_with_log mkdir -p "$FUSFIG_OUTDIR"
do_with_log mkdir -p "$BB_OUTDIR"
do_with_log rm -rf "$BB_TMPDIR"
do_with_log mkdir -p "$BB_TMPDIR"
# Slurp header & footer HTML
HEADERFILE="$SITE_INDIR/header.html"
FOOTERFILE="$SITE_INDIR/footer.html"
HEADER="`cat $HEADERFILE`"
FOOTER="`cat $FOOTERFILE`"
# (Warning: command expansion removes trailing newlines!.. so $HEADER and
# $FOOTER won't have trailing newlines, even if the contents of $HEADERFILE
# and/or $FOOTERFILE do.)
HEADER="$HEADER$NL`cat "$BB_HEADERFILE"`"
bagcom_builddir() {
ACTION="$1"
INDIR="$2"
OUTDIR="$SITE_OUTDIR/${INDIR#$SITE_INDIR/}"
# $DIRCONFIGFILE: a file containing metadata about the pages in
# $INDIR (for instance, about their "parent" page)
DIRCONFIGFILE="$INDIR/dir.config"
print_thinline
log "Building dir (action=$ACTION): $INDIR -> $OUTDIR"
# Variables which can be set by $DIRCONFIGFILE
PARENTNAME=""
PARENTURL=""
# ...ok, set the variables please
if test -f "$DIRCONFIGFILE"
then
log "Using dirconfig file: $DIRCONFIGFILE"
. "$DIRCONFIGFILE"
else
log "...skipping missing dirconfig file: $DIRCONFIGFILE"
fi
log "PARENTNAME=$PARENTNAME"
log "PARENTURL=$PARENTURL"
if test "$ACTION" = "list"
then
# Create output directory
do_with_log mkdir -p "$OUTDIR"
# Copy static assets (if present)
test ! -d "$INDIR/img" || copydir "$INDIR/img" "$OUTDIR/img"
fi
: $(( log_depth++ ))
for INFILE in "$INDIR"/*
do
BASENAME="`basename -- "$INFILE"`"
EXT="${BASENAME##*.}"
# Only process files with these extensions
test "$EXT" = "txt" -o "$EXT" = "html" -o "$EXT" = "md" -o "$EXT" = "fus" || continue
OUTFILE_RAW="$SITE_OUTDIR/${INFILE#$SITE_INDIR/}"
OUTFILE="${OUTFILE_RAW%.*}.html"
OUTFILE_RAW_URL="`pageurl "$OUTFILE_RAW"`"
print_thinline
log "Processing file (action=$ACTION): $INFILE -> $OUTFILE"
# $CONFIGFILE: a file containing metadata about the page whose
# contents are in $INFILE
CONFIGFILE="$INFILE.config"
# Variables which can be set by $CONFIGFILE
TITLE="${BASENAME/.*}"
CHILDPAGES_DIR=""
# ...ok, set the variables please
if test -f "$CONFIGFILE"
then
log "Using config file: $CONFIGFILE"
. "$CONFIGFILE"
else
log "...skipping missing config file: $CONFIGFILE"
fi
log "TITLE=$TITLE"
log "CHILDPAGES_DIR=$CHILDPAGES_DIR"
case "$ACTION" in
list)
log "Listing: $INFILE"
log "Output: $OUTFILE"
# Touch the file so it can be found when generating
# CHILDPAGES
do_with_log touch "$OUTFILE"
# Store the title somewhere we can find it when
# generating CHILDPAGES
echo "$TITLE" >"$OUTFILE.title"
;;
build)
log "Building: $INFILE"
log "Output: $OUTFILE"
bagcom_buildfile
log "Done!"
;;
*)
log "Unrecognized action: $ACTION"
exit 1
;;
esac
done
: $(( log_depth-- ))
}
bagcom_buildfile() {
log "Building file: $OUTFILE..."
# NOTE: We use "@" as the separator in sed's "s" operator, which means
# we can't use that character in a page's title!
PROCESSED_HEADER="`echo "$HEADER" | sed \
-e "s@{TITLE}@$TITLE@" \
-e "s@{SITENAME}@$SITENAME@" \
-e "s@{PARENTNAME}@$PARENTNAME@" \
-e "s@{PARENTURL}@$PARENTURL@" \
`"
if test "$OUTFILE_RAW" != "$OUTFILE"
then
PROCESSED_HEADER="`echo "$PROCESSED_HEADER" | sed \
-e "s@{RAWFILE}@$OUTFILE_RAW_URL@" \
`"
else
# Remove (with sed's "d" command) lines which contain "{RAWFILE}"
PROCESSED_HEADER="`echo "$PROCESSED_HEADER" | sed '/{RAWFILE}/d'`"
fi
# Remove any unneeded (according to this page's .config file)
# breadcrumbs from header
if test "$PARENTURL" = "/"
then
# Remove (with sed's "d" command) lines which start with "{CRUMB2}"
log "*** REMOVING CRUMB2!"
PROCESSED_HEADER="`echo "$PROCESSED_HEADER" | sed '/^{CRUMB2}/d'`"
fi
if test "$OUTFILE" = "dst/root/index.html"
then
# Remove (with sed's "d" command) lines which start with "{CRUMB1}"
log "*** REMOVING CRUMB1!"
PROCESSED_HEADER="`echo "$PROCESSED_HEADER" | sed '/^{CRUMB1}/d'`"
fi
# Remove "{CRUMB1}", "{CRUMB2}" markers
PROCESSED_HEADER="`echo "$PROCESSED_HEADER" | sed 's/{CRUMB[12]}//'`"
# Slurp page contents
BODY="`cat "$INFILE"`"
# Parse blocks, removing them from BODY.
# We will put them back in after BODY has been otherwise processed.
# This lets us implement e.g. custom syntax highlighting in
# Markdown pages: after BODY is processed as Markdown into HTML, we
# will put the processed blocks back in.
log "Parsing blocks..."
parseblocks "$BODY"
BODY="$PARSED"
log "Parsed $BLOCKNUM blocks!"
# Wrap the contents of .txt files in <pre>
if test "$EXT" = "txt"
then
BODY="<pre>$BODY</pre>"
fi
# Process .md files as markdown
# (Will fail, obviously, if you don't have a markdown parser installed)
if test "$EXT" = "md"
then
BODY="`echo "$BODY" | markdown`"
fi
# Process .fus files
if test "$EXT" = "fus"
then
BODY="<pre class=\"fus\">`echo "$BODY" | fus2html`</pre>"
fi
# Automatically generate lists of child pages (as directed by the
# config file)
if test -n "$CHILDPAGES_DIR"
then
BODY="$BODY$NL<ul>$NL"
for CHILDPAGE_FILE in "$SITE_OUTDIR/$CHILDPAGES_DIR"/*.html
do
CHILDPAGE_BASENAME="`basename -- "$CHILDPAGE_FILE"`"
CHILDPAGE_URL="`pageurl "$CHILDPAGE_FILE"`"
CHILDPAGE_TITLE="`cat "$CHILDPAGE_FILE.title"`"
BODY="$BODY<li><a href=\"$CHILDPAGE_URL\">$CHILDPAGE_TITLE</a>$NL"
done
BODY="$BODY</ul>"
fi
# Put blocks back in, possibly processing them first.
for i in `seq "$BLOCKNUM"`
do
eval "TYPE=\$BLOCKTYPE$i"
eval "BLOCK=\$BLOCK$i"
log "Writing block $i (type=$TYPE)..."
case "$TYPE" in
fus)
BLOCK="<pre class=\"fus\">`echo "$BLOCK" | fus2html`</pre>"
;;
fusfig*)
BLOCK="`fusfig "$TYPE" $BLOCK`"
;;
bb*)
t0=0
t1="$DEFAULT_BB_T1"
chans=2
audio=true
inline_svg=false
read TYPE BB_NAME BB_OPTIONS < <(printf '%s\n' "$TYPE")
for opt in $BB_OPTIONS
do
case "$opt" in
t0=*) t0="${opt##*=}";;
t1=*) t1="${opt##*=}";;
chans=*) chans="${opt##*=}";;
no-audio) audio=false;;
inline-svg) inline_svg=true;;
*) log "Unrecognized bb option: $opt"; exit 1;;
esac
done
BB_CFILE="$BB_OUTDIR/$BB_NAME.c"
BB_WAVFILE="$BB_OUTDIR/$BB_NAME.wav"
BB_SVGHTMLFILE="$BB_OUTDIR/$BB_NAME.svg.html"
BB_SVGHTMLINLINEFILE="$BB_OUTDIR/$BB_NAME.svg-inline.html"
BB_BINFILE="$BB_TMPDIR/$BB_NAME"
BB_RAWFILE="$BB_TMPDIR/$BB_NAME.raw"
! test -f "$BB_BINFILE" || {
log "File $BB_BINFILE already exists... each bb block needs a unique name!"
exit 1
}
log "Generating files for bytebeat: $BB_NAME ($chans channels, sample frames $t0 - $t1)..."
log "...generating $BB_CFILE, $BB_BINFILE"
echo "$BLOCK" | do_with_log bb/compile.sh "$BB_CFILE" "$BB_BINFILE" "$chans"
log "...generating $BB_RAWFILE"
do_with_log "$BB_BINFILE" "t0=$t0" "t1=$t1" >"$BB_RAWFILE"
log "...generating $BB_WAVFILE"
do_with_log sox -t raw -b 8 -r 8000 -c "$chans" -e unsigned-integer "$BB_RAWFILE" "$BB_WAVFILE"
log "...generating $BB_SVGHTMLFILE"
do_with_log "$BB_BINFILE" "t0=$t0" "t1=$t1" "mode=S" >"$BB_SVGHTMLFILE"
log "...OK!"
BB_CODE_BLOCK="<pre class=\"block-$TYPE bb-pre\">`echo "$BLOCK" | htmlescape`</pre>"
BLOCK=""
if test "$audio" = true
then
BLOCK="$BLOCK$NL<div><audio controls src=\"/$BB_STATIC/$BB_NAME.wav\"></audio></div>"
fi
BLOCK="$BLOCK$NL$BB_CODE_BLOCK"
BLOCK="$BLOCK$NL<div class=\"bb-links\">
<a href=\"$BB_STATIC/$BB_NAME.c\">$BB_NAME.c</a>
<a href=\"$BB_STATIC/$BB_NAME.wav\">$BB_NAME.wav</a>
<a href=\"$BB_STATIC/$BB_NAME.svg.html\">$BB_NAME.svg.html</a>
</div>"
if test "$inline_svg" = true
then
BLOCK="$BLOCK$NL`do_with_log "$BB_BINFILE" "t0=$t0" "t1=$t1" "mode=s"`"
fi
;;
*)
BLOCK="<pre class=\"block-$TYPE\">`echo "$BLOCK" | htmlescape`</pre>"
;;
esac
replace "{BLOCK$i}" "$BLOCK" "$BODY"
BODY="$REPLACED"
done
# Copy the raw input file over, so OUTFILE can include a link to it
# (But don't do it if INFILE is already .html, that is, if OUTFILE and
# OUTFILE_RAW are the same.)
if test "$OUTFILE_RAW" != "$OUTFILE"
then
do_with_log cp "$INFILE" "$OUTFILE_RAW"
fi
# Note the $NL (newlines), which we have to add manually, since
# $HEADER/$FOOTER/$BODY all got their contents from commend expansion,
# which removes trailing newlines (which is obnoxious).
log "Writing to $OUTFILE..."
echo -n "$PROCESSED_HEADER$NL$BODY$NL$FOOTER" >"$OUTFILE"
}
# "List" (touch) output files, so we can automatically generate lists
# of them in the HTML content of files which use CHILDPAGES_DIR
print_thickline
log "Listing files..."
for PROJECT in $PROJECTS
do
INDIR="$SITE_INDIR/$PROJECT"
: $(( log_depth++ ))
bagcom_builddir list "${INDIR%/}"
: $(( log_depth-- ))
done
# Actually build (generate the content of) the output files
print_thickline
log "Building files..."
for PROJECT in $PROJECTS
do
INDIR="$SITE_INDIR/$PROJECT"
: $(( log_depth++ ))
bagcom_builddir build "${INDIR%/}"
: $(( log_depth-- ))
done
print_thickline
log "Finishing up..."
# Move files from "root" subdirectory to the actual build output root
do_with_log mv "$SITE_OUTDIR/root"/* "$SITE_OUTDIR/"
do_with_log rmdir "$SITE_OUTDIR/root"
# Copy static assets
copydir img/ "$SITE_OUTDIR/img/"
copydir "$FUSFIG_OUTDIR/" "$FUSFIG_STATICDIR/"
copydir "$BB_OUTDIR/" "$BB_STATICDIR/"
copydir style/ "$SITE_OUTDIR/style/"
copydir scripts/ "$SITE_OUTDIR/scripts/"
# Copy the tape game :O
copy_tape_game() (
src="$1"
dst="$2"
rm -rf "$dst"
mkdir "$dst"
cp -r "$src"/*.html "$src"/*.css "$src"/*.js "$dst"/
)
copy_tape_game ../tape_game/ "$SITE_OUTDIR/tape_game"
# Doooone!
print_thickline
log "Build complete!"
log "Source directory: $SITE_INDIR"
log "Output directory: $SITE_OUTDIR"