-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcheck-system.sh
executable file
·78 lines (71 loc) · 2.11 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/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?"
echo "If you don't want to install docker, you can open tennis-refactoring-kata and run the tests using your IDE."
exit 1
else
echo "Ok"
fi
echo -n "Downloading the docker image..."
(docker pull codiumteam/tdd-training-js) > /dev/null
if [ $? -ne 0 ]; then
echo "Error"
echo "There is a problem downloading the docker image"
exit 1
else
echo "Ok"
fi
echo -n "Validating docker mount permissions..."
(docker run --rm -v ${PWD}:/code codiumteam/tdd-training-js 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
}
function validateMake() {
echo -n "Validating make installed..."
(make -h) > /dev/null
if [ $? -ne 0 ]; then
echo "Error"
echo "Do you have make installed?"
echo "If you don't want to install make, you can run read how to run the tests opening the Makefile."
exit 1
else
echo "Ok"
fi
}
validateDocker
validateMake
validateKata fizz-buzz "cd fizz-buzz" "make docker-test"
validateKata roman-numerals "cd roman-numerals" "make docker-test"
validateKata password-validator "cd password-validator" "make docker-test"
validateKata user-registration "cd user-registration" "make docker-test"
validateKata coffee-machine "cd coffee-machine" "make docker-test"
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