-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcheck-system.sh
executable file
·57 lines (52 loc) · 1.74 KB
/
check-system.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
#!/bin/bash
ERROR=""
OUTPUT=""
function printStatus() {
if [ $? -ne 0 ]; then
echo "Error"
ERROR="${ERROR} \n\n${OUTPUT}"
else
echo "Ok"
fi
}
function validateKata() {
echo -n "Validating $1..."
OUTPUT=$($2 2>&1 && $3 2>&1 && $4 2>&1)
printStatus
}
function validateDocker() {
echo -n "Validating docker running..."
(docker ps) > /dev/null
if [ $? -ne 0 ]; then
echo "Error"
echo "Are you sure that you have docker running?"
exit -1
else
echo "Ok"
fi
echo -n "Validating docker mount permissions..."
(docker run --rm -v ${PWD}:/code codiumteam/legacy-training-python ls) > /dev/null
if [ $? -ne 0 ]; then
echo "Error"
echo "Are you sure that you have permissions to mount your volumes?"
exit -1
else
echo "Ok"
fi
}
validateDocker
validateKata web-page-generator-kata "cd web-page-generator-kata" "make"
validateKata tennis-refactoring-kata "cd tennis-refactoring-kata" "make"
validateKata user-registration-refactoring-kata "cd user-registration-refactoring-kata" "make"
validateKata weather-kata "cd weather-kata" "make"
validateKata trip-service-kata "cd trip-service-kata" "make"
validateKata gilded-rose-characterization-testing "cd gilded-rose-characterization-testing" "make" "make docker-mutation"
validateKata gilded-rose-golden-master "cd gilded-rose-golden-master" "make"
validateKata trivia-golden-master "cd trivia-golden-master" "make"
validateKata print-date-kata "cd print-date-kata" "make"
if [ -z "$ERROR" ]; then
echo "Congratulations! You are ready for the training!"
else
echo -e "----------------------------------------------------------\n\n$ERROR"
echo -e "\n\nPlease send an email with the problem you have to info@codium.team\n"
fi