-
Notifications
You must be signed in to change notification settings - Fork 2
/
project.sh
executable file
·77 lines (55 loc) · 1.86 KB
/
project.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
source "system/lib.sh"
##########################################
#
# STEP HELPER
#
##########################################
PROJECT=""
MAIN_SERVICE=""
EXTRA_SERVICES=""
stepChooseGeneralEnv() {
PROJECT_ENV="$1"
PROJECT="$2"
editEnv "applications/system-services/general/template.env" "$PROJECT_ENV" "interactive" "general" "general" "$PROJECT"
MAIN_SERVICE=$(configGetValueByFile MAIN_SERVICE "$PROJECT_ENV")
HAS_MAIN_SERVICE=$(has_service "$MAIN_SERVICE" "$PROJECT" "main")
if [[ "$HAS_MAIN_SERVICE" = "0" ]]; then
echo "
MAIN SERVICE \"$MAIN_SERVICE\" DOES NOT EXIST! TRY AGAIN."
stepChooseGeneralEnv "$PROJECT_ENV"
fi
EXTRA_SERVICES=$(configGetValueByFile EXTRA_SERVICES "$PROJECT_ENV")
for service in $EXTRA_SERVICES; do
HAS_EXTRA_SERVICE=$(has_service "$service" "$PROJECT" "extra")
if [[ "$HAS_EXTRA_SERVICE" = "0" ]]; then
echo "
EXTRA SERVICE \"$service\" DOES NOT EXIST. PLEASE CHOOSE EXISTING SERVICES!"
stepChooseGeneralEnv "$PROJECT_ENV"
fi
done
}
##########################################
#
# APP FLOW
#
##########################################
stepChooseProjectName "$@"
PROJECT_ENV="applications/docker-data/$PROJECT/.env"
if [ ! -f "$PROJECT_ENV" ]; then
touchFile $PROJECT_ENV
echo "#+++++++++++++++++++++++++++++++++
# [HIDDEN] Main services to activate.
# Is set on project setup. Needs to be the same as the folder name of the project.
#---------------------------------
PROJECT_NAME=$PROJECT" >> $PROJECT_ENV
fi
stepChooseGeneralEnv "$PROJECT_ENV" "$PROJECT"
stepRunEnv "$PROJECT_ENV" "$PROJECT"
stepRunScripts "$PROJECT_ENV" "Setup" "$PROJECT"
echo -e "$TEXT_BOLD $TEXT_WHITE $TEXT_BG_GREEN
NOTES:"
stepRunScripts "$PROJECT_ENV" "Instructions" "$PROJECT"
echo -e "-------------
Enjoy!
$TEXT_CLEAR"