-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopy_assets.sh
48 lines (43 loc) · 1.76 KB
/
copy_assets.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
copy_assets.sh
# This is a convenience script to copy the code examples and corresponding SVG
# visualizations from the rustviz repository. See README.md for more details.
# RV='../rustviz'
RV='rustviz'
# printf "copying helper.js and book.js..."
cp "$RV/rustviz_mdbook/mdbook_plugin/helpers.js" "./helpers.js"
cp "$RV/rustviz_mdbook/mdbook_plugin/book.js" "./theme/book.js"
# printf "done\n"
printf "copying files into code_examples..."
EX=$RV/src/examples
for DIR in $EX/*/; do
BASENAME=`basename $DIR`
echo $BASENAME
printf "basename is $BASENAME\n"
printf "dir is $DIR\n"
if [ -f "$DIR/source.rs" ] && [ -f "$DIR/vis_code.svg" ] && [ -f "$DIR/vis_timeline.svg" ];
then
mkdir -p "./src/assets/code_examples/$BASENAME" && \
cp "$DIR/source.rs" "./src/assets/code_examples/$BASENAME/source.rs" && \
cp "$DIR/vis_code.svg" "./src/assets/code_examples/$BASENAME/vis_code.svg" && \
cp "$DIR/vis_timeline.svg" "./src/assets/code_examples/$BASENAME/vis_timeline.svg"
else
echo "$BASENAME does not have the required files, skipping."
fi
done
printf "${green}done${END}\n"
# Copy new files to modified_examples
printf "Copying files into modified_examples..."
for DIR in ./src/assets/modified_examples/*; do
BASENAME=`basename $DIR`
echo $BASENAME
if [ -f "$EX/$BASENAME/source.rs" ] && [ -f "$EX/$BASENAME/vis_code.svg" ] && [ -f "$EX/$BASENAME/vis_timeline.svg" ];
then
cp "$EX/$BASENAME/source.rs" "$DIR/source.rs" && \
cp "$EX/$BASENAME/vis_code.svg" "$DIR/vis_code.svg" && \
cp "$EX/$BASENAME/vis_timeline.svg" "$DIR/vis_timeline.svg"
else
echo "$BASENAME does not have the required files, skipping."
fi
done
printf "${green}done${END}\n"
# mdbook build