-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path_preprocessMultiVersion.sh
More file actions
executable file
·47 lines (40 loc) · 1.44 KB
/
_preprocessMultiVersion.sh
File metadata and controls
executable file
·47 lines (40 loc) · 1.44 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
45
46
47
#!/bin/bash
versions=("4.0.1" "5.0.0" )
ig_base="imaging"
for version in "${versions[@]}"; do
if [ "$version" = "4.0.1" ]; then
context_version="R4"
build_dir="igs/${ig_base}-r4"
elif [ "$version" = "5.0.0" ]; then
context_version="R5"
build_dir="igs/${ig_base}-r5"
fi
echo remove all files from $build_dir
# rm -Rf $build_dir/*
echo Setting read-only permissions on $build_dir
chmod -R a+w $build_dir
find $build_dir -maxdepth 1 -type f -exec rm -f {} +
rm -Rf $build_dir/input
rm -Rf $build_dir/output
rm -Rf $build_dir/ig-template
echo copy all files to $build_dir
find ig-src/ -maxdepth 1 -type f -exec cp {} $build_dir \;
cp -R ig-src/input $build_dir
cp -R ig-src/ig-template $build_dir
# Process all liquid files
echo Processing liquid files
find $build_dir -type f -name "*.liquid.*" | while read file; do
if [ -f "$file" ]; then
file_path=${file}
clean_file_path=${file_path/\.liquid\./\.}
echo "- $file_path --> $clean_file_path"
# Process liquid template and inline version tags
content=$(npx --yes liquidjs -t @"$file" --context @"context-${context_version}.json")
echo "$content" > "$clean_file_path"
rm -f $file
fi
done
# # make readonly
# echo Setting read-only permissions on $build_dir
# chmod -R a-w $build_dir
done