forked from JakeWharton/mosaic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-example-images.sh
More file actions
executable file
·44 lines (35 loc) · 1.17 KB
/
update-example-images.sh
File metadata and controls
executable file
·44 lines (35 loc) · 1.17 KB
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
#!/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 installJvmDist
for sample in $REPO_DIR/samples/*; do
sample_name=$(basename "$sample")
sample_bin="$sample/build/install/$sample_name/bin/$sample_name"
if [ ! -f "$sample_bin" ]; then
sample_bin="$sample/build/install/$sample_name-jvm/bin/$sample_name"
fi
if [ ! -f "$sample_bin" ]; then
echo "Skipping $sample_name…"
continue
fi
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
done
echo "Done"