-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathinit.sh
More file actions
executable file
·62 lines (48 loc) · 1.77 KB
/
init.sh
File metadata and controls
executable file
·62 lines (48 loc) · 1.77 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
# self delete this script after execution
rm -- "$0"
clear
echo "What is the name of your app: "
APP_NAME=$(gum input --placeholder "" | tr '[:upper:]' '[:lower:]')
clear
echo "Choose your backend: "
BACKEND=$(gum choose "spring-boot")
clear
echo "Choose your frontend: "
FRONTEND=$(gum choose "svelte-kit")
# delete all other frameworks except the chosen ones
find ./backend -mindepth 1 ! -regex "^./backend/$BACKEND\(/.*\)?" -delete
find ./frontend -mindepth 1 ! -regex "^./frontend/$FRONTEND\(/.*\)?" -delete
# delete all workflows except the chosen frameworks
find .github/workflows -type f ! -name "${BACKEND}.yml" ! -name "${FRONTEND}.yml" -exec rm -f {} +
sed -i "s/\/${BACKEND}//g" .github/workflows/${BACKEND}.yml
sed -i "s/\/${FRONTEND}//g" .github/workflows/${FRONTEND}.yml
sed -i "s/\/${BACKEND}//g" docker-compose.yml
sed -i "s/\/${FRONTEND}//g" docker-compose.yml
cp -r ./backend/$BACKEND/. ./backend
cp -r ./frontend/$FRONTEND/. ./frontend
rm -rf ./backend/$BACKEND
rm -rf ./frontend/$FRONTEND
if [ "$BACKEND" == "spring-boot" ]; then
mv ./backend/src/main/java/org/bugzkit ./backend/src/main/java/org/$APP_NAME
mv ./backend/src/test/java/org/bugzkit ./backend/src/test/java/org/$APP_NAME
fi
clear
if ! gum confirm "Do you want to keep the docs?"; then
rm -rf ./docs
rm -rf .github/workflows/docs.yml
sed -i '5d' README.md
fi
# replace all occurrences of the bugzkit in all files
find . \
-type f \
-not -path "./node_modules/*" \
-not -path "./target/*" \
-not -path "./.git/*" \
-not -path "./build/*" \
-not -path "./init.sh" \
-not -path "./.svelte-kit/*" \
-exec sed -i "s/bugzkit/${APP_NAME}/Ig" {} + > /dev/null 2>&1
clear
echo "Name of your app is: $APP_NAME"
echo "You picked $BACKEND for the backend, and $FRONTEND for the frontend."