-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.sh
38 lines (30 loc) · 975 Bytes
/
compile.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
#!/bin/bash
rm -rf dist
mkdir dist
export NUM_TYPE=$(ls -1q ./src/*/start.sh | wc -l)
for type in ./src/*/; do
type_name=$(basename "$type")
if [[ ${type_name::1} == "_" ]]; then
continue
fi
i=$((i+1))
echo -e "\e[37m[$i/$NUM_TYPE]\e[0m \e[97mNow compiling \e[0;107m\e[30m$type_name\e[0m\e[97m...\e[0m"
cat src/header.sh >> dist/mts-$type_name.sh
echo "" >> dist/mts-$type_name.sh
cat $type/start.sh >> dist/mts-$type_name.sh
echo "" >> dist/mts-$type_name.sh
cat src/tests.sh >> dist/mts-$type_name.sh
echo "" >> dist/mts-$type_name.sh
cat $type/end.sh >> dist/mts-$type_name.sh
done
echo ""
echo -e "\e[97mCleaning...\e[0m"
for type in ./dist/*; do
cat "$type" | sed -r "s/^\n\n/\n/g" > $type.temp && mv $type.temp $type
done
echo -e "\e[97mPackaging...\e[0m"
mkdir ./dist/gh-rel
zip ./dist/gh-rel/premid-mts.zip ./dist/*.sh
cp ./dist/mts-main.sh ./dist/gh-rel/premid-mts.sh
echo ""
echo -e "\e[97mAll done!\e[0m"