forked from jgigault/42FileChecker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path42FileChecker.sh
149 lines (140 loc) · 4.97 KB
/
42FileChecker.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/bin/bash
####################################################################
# _ _ ____ _____ _ _ ____ _ _ #
# | || ||___ \| ___(_) | ___ / ___| |__ ___ ___| | _____ _ __ #
# | || |_ __) | |_ | | |/ _ \ | | '_ \ / _ \/ __| |/ / _ \ '__| #
# |__ _/ __/| _| | | | __/ |___| | | | __/ (__| < __/ | #
# |_||_____|_| |_|_|\___|\____|_| |_|\___|\___|_|\_\___|_| #
# jgigault @ student.42.fr 06 51 15 98 82 #
####################################################################
function check_install_dir
{
local SOURCE="${BASH_SOURCE[0]}"
local DIR
while [ -h "${SOURCE}" ]
do
DIR="$(cd -P "$(dirname "${SOURCE}")" && pwd)"
SOURCE="$(readlink "${SOURCE}")"
[[ "${SOURCE}" != /* ]] && SOURCE="${DIR}/${SOURCE}"
done
printf "%s" "$(cd -P "$(dirname "${SOURCE}")" && pwd)"
}
GLOBAL_ENTRYPATH=$(pwd)
GLOBAL_INSTALLDIR=$(check_install_dir)
GLOBAL_LOCALBRANCH=$(git branch | awk '$0 ~ /^\*/ {print $2; exit}')
cd "${GLOBAL_INSTALLDIR}"
FILECHECKER_SH=1
if [ ! -f .myrev ]; then git shortlog -s | awk 'BEGIN {rev=0} {rev+=$1} END {printf rev}' > .myrev 2>/dev/null; fi
GLOBAL_CVERSION=$(git log --oneline 2>/dev/null | awk 'END {print NR}')
if [ "${GLOBAL_CVERSION}" == "" ]; then GLOBAL_CVERSION="???"; fi
RETURNPATH=$(pwd | sed 's/ /\ /g')
OPT_NO_UPDATE=0
OPT_NO_COLOR=0
OPT_NO_TIMEOUT=0
OPT_NO_NORMINETTE=0
OPT_NO_AUTEUR=0
OPT_NO_MOULITEST=0
OPT_NO_LIBFTUNITTEST=0
OPT_NO_FILLITCHECKER=0
OPT_NO_SPEEDTEST=0
OPT_NO_LEAKS=0
OPT_NO_BASICTESTS=0
OPT_NO_MAKEFILE=0
OPT_NO_FORBIDDEN=0
OPT_NO_STATICDECLARATIONS=0
OPT_NO_LIBFTFILESEXIST=0
OPT_NO_GNLMULTIPLEFD=0
OPT_NO_GNLONESTATIC=0
OPT_NO_GNLMACRO=0
i=1
while (( i <= $# ))
do
case "${!i}" in
"--no-update") OPT_NO_UPDATE=1 ;;
"--no-color") OPT_NO_COLOR=1 ;;
"--no-timeout") OPT_NO_TIMEOUT=1 ;;
"--no-norminette") OPT_NO_NORMINETTE=1 ;;
"--no-auteur") OPT_NO_AUTEUR=1 ;;
"--no-moulitest") OPT_NO_MOULITEST=1 ;;
"--no-libftunittest") OPT_NO_LIBFTUNITTEST=1 ;;
"--no-fillitchecker") OPT_NO_FILLITCHECKER=1 ;;
"--no-speedtest") OPT_NO_SPEEDTEST=1 ;;
"--no-leaks") OPT_NO_LEAKS=1 ;;
"--no-basictests") OPT_NO_BASICTESTS=1 ;;
"--no-makefile") OPT_NO_MAKEFILE=1 ;;
"--no-forbidden") OPT_NO_FORBIDDEN=1 ;;
"--no-staticdeclarations") OPT_NO_STATICDECLARATIONS=1 ;;
"--no-libftfilesexists") OPT_NO_LIBFTFILESEXIST=1 ;;
"--no-gnlmultiplefd") OPT_NO_GNLMULTIPLEFD=1 ;;
"--no-gnlonestatic") OPT_NO_GNLONESTATIC=1 ;;
"--no-gnlmacro") OPT_NO_GNLMACRO=1 ;;
esac
(( i += 1 ))
done
source includes/utils.sh
source includes/fillit.sh
source includes/libft.sh
source includes/libftasm.sh
source includes/get_next_line.sh
source includes/ft_ls.sh
source includes/ft_printf.sh
source includes/fdf.sh
source includes/transition.sh
source includes/update.sh
source includes/credits.sh
source includes/forbidden.sh
source includes/makefile.sh
source includes/leaks.sh
source includes/speedtest.sh
source includes/configure.sh
source includes/moulitest.sh
source includes/fillit_checker.sh
source includes/libftunittest.sh
source includes/exit.sh
source includes/display_spinner.sh
source includes/display_menu.sh
source includes/display_header.sh
source includes/display_leftandright.sh
source includes/signals.sh
function main
{
tput civis
display_header
printf "\n\n"
printf "${C_INVERTRED}"
display_center " "
display_center "Failing tests does not necessary mean you're wrong!"
display_center "42FileChecker does not substitute a corrector"
display_center "and was not made for that at first!"
display_center " "
printf "\n\n"
display_menu\
""\
check_fillit_main "fillit"\
check_libft_main "libft"\
check_libftasm "libftasm"\
check_gnl_main "get_next_line"\
check_ft_ls_main "ft_ls"\
check_ft_printf_main "ft_printf"\
check_fdf "fdf"\
"_"\
"check_option_set OPT_NO_TIMEOUT" "$(if [ "$OPT_NO_TIMEOUT" == 0 ]; then echo "disable timeout (--no-timeout)"; else echo "enable timeout"; fi)"\
"check_option_set OPT_NO_COLOR" "$(if [ "$OPT_NO_COLOR" == 0 ]; then echo "disable color (--no-color)"; else echo "enable color"; fi)"\
"check_option_set OPT_NO_NORMINETTE" "$(if [ "$OPT_NO_NORMINETTE" == 0 ]; then echo "disable norminette (--no-norminette)"; else echo "enable norminette"; fi)"\
"check_option_set OPT_NO_LEAKS" "$(if [ "$OPT_NO_LEAKS" == 0 ]; then echo "disable leaks test (--no-leaks)"; else echo "enable leaks test"; fi)"\
"check_option_set OPT_NO_SPEEDTEST" "$(if [ "$OPT_NO_SPEEDTEST" == 0 ]; then echo "disable speedtest (--no-speedtest)"; else echo "enable speedtest"; fi)"\
"check_option_set OPT_NO_MOULITEST" "$(if [ "$OPT_NO_MOULITEST" == 0 ]; then echo "disable moulitest (--no-moulitest)"; else echo "enable moulitest"; fi)"\
"_"\
"open https://github.com/jgigault/42FileChecker/wiki" "MANUAL"\
display_credits "CREDITS"\
"open https://github.com/jgigault/42FileChecker/issues/new" "REPORT A BUG"\
exit_checker "EXIT"
}
tput civis
tput smcup
check_set_env
check_set_colors
catch_signals
display_header_transition
check_update
exit_checker