-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
110 lines (91 loc) · 2.18 KB
/
bootstrap.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
#!/bin/zsh
ensure_usr_local_bin_is_in_path() {
if [[ ! $PATH =~ "/usr/local/bin" ]]; then
echo "⚠️ '/usr/local/bin' is not included in PATH environment variable."
echo " 👉 Add 'PATH=\$PATH:/usr/local/bin' in your ~/.zshrc or ~/.zprofile file and reload the shell."
return 1
else
return 0
fi
}
ensure_brew_is_installed() {
if ! command -v brew &> /dev/null; then
echo "⚠️ 'brew' is not installed."
echo " 👉 Run '/bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"' to install."
return 1
else
return 0
fi
}
ensure_bundler_is_installed() {
if ! command -v bundle &> /dev/null; then
echo "⚠️ 'bundler' is not installed."
echo " 👉 Run 'gem install bundler' to install."
return 1
else
return 0
fi
}
ensure_ruby_deps_are_installed() {
bundle
}
ensure_npm_is_installed() {
if ! command -v npm &> /dev/null; then
echo "⚠️ 'node' is not installed."
echo " 👉 Run 'brew install node' to install."
return 1
else
return 0
fi
}
ensure_grunt_cli_is_installed() {
if ! command -v grunt &> /dev/null; then
echo "⚠️ 'grunt-cli' is not installed."
echo " 👉 Run 'npm install -g grunt-cli' to install."
return 1
else
return 0
fi
}
ensure_local_grunt_is_installed() {
if [[ ! -d node_modules/grunt ]]; then
echo "⚠️ local 'grunt' npm module is not installed."
echo " 👉 Run 'npm install' to install."
return 1
else
return 0
fi
}
ensure_tuist_is_installed() {
if ! command -v tuist &> /dev/null; then
echo "⚠️ 'tuist' is not installed."
echo " 👉 Run 'curl -Ls https://install.tuist.io | bash' to install."
return 1
else
tuist bundle
return 0
fi
}
configure_git_hooks() {
git config core.hooksPath ./git-hooks
}
ensure_usr_local_bin_is_in_path
e1=$?
ensure_brew_is_installed
e2=$?
ensure_bundler_is_installed
e3=$?
ensure_ruby_deps_are_installed
e4=$?
ensure_npm_is_installed
e5=$?
ensure_grunt_cli_is_installed
e6=$?
ensure_local_grunt_is_installed
e7=$?
ensure_tuist_is_installed
e8=$?
if [[ $(($e1+$e2+$e3+$e4+$e5+$e6+$e7+$e8)) -gt 0 ]]; then
exit 1
fi
configure_git_hooks