forked from JakeWharton/mosaic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-example-svgs.sh
executable file
·39 lines (30 loc) · 1.01 KB
/
update-example-svgs.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
#!/usr/bin/env bash
if ! command -v asciinema &> /dev/null; then
echo "Command 'asciinema' not found. Please install and put on path."
exit
fi
if ! command -v agg &> /dev/null; then
echo "Command 'agg' not found. Please install and put on path."
exit
fi
set -e
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Ensure sample binaries are available
"$REPO_DIR/gradlew" -q --console plain -p "$REPO_DIR" installDist
for sample in $REPO_DIR/samples/*; do
sample_name=$(basename "$sample")
sample_bin="$sample/build/install/$sample_name/bin/$sample_name"
if test -f "$sample_bin"; then
echo "Capturing $sample_name..."
command="'$sample_bin' 2>/dev/null && sleep 2 && printf ' \e[D'"
if [ -f "$sample/input.sh" ]; then
command="'$sample/input.sh' | $command"
fi
echo "Running $command..."
rm -f $sample/demo.cast
asciinema rec -c "$command" $sample/demo.cast
agg --cols 60 --rows 18 $sample/demo.cast $sample/demo.gif
rm $sample/demo.cast
fi
done
echo "Done"