-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathtools.sh
210 lines (191 loc) · 5.92 KB
/
tools.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#!/bin/bash
source _utils.sh
# ------------------------------------------------------------------------------
e_message "Checking tools"
# ------------------------------------------------------------------------------
if has_command "brew"; then
if ! has_command "watchman"; then
e_pending "Installing watchman"
brew install watchman
test_command "watchman"
fi
fi
if has_command "brew"; then
if ! has_command "trash"; then
e_pending "Installing trash"
brew install trash
test_command "trash"
fi
fi
if has_command "brew"; then
if ! has_command "git"; then
get_consent "Install git"
if has_consent; then
e_pending "Installing git"
brew install git
test_command "git"
fi
fi
fi
if has_command "brew"; then
if ! has_command "zsh"; then
get_consent "Install zsh"
if has_consent; then
e_pending "Installing zsh"
brew install zsh
test_command "zsh"
fi
fi
fi
if has_command "zsh"; then
if ! has_path ".oh-my-zsh"; then
get_consent "Install oh-my-zsh"
if has_consent; then
e_pending "Installing oh-my-zsh"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
test_path ".oh-my-zsh"
fi
fi
fi
if has_command "brew" && has_command "zsh"; then
if ! has_brew "oh-my-posh"; then
get_consent "Install oh-my-posh (CLI theming)"
if has_consent; then
e_pending "Installing oh-my-posh"
brew install jandedobbeleer/oh-my-posh/oh-my-posh
echo '# Theme configuration: Oh My Posh' >> ~/.zshrc
echo 'if [ "$TERM_PROGRAM" != "Apple_Terminal" ]; then' >> ~/.zshrc
echo ' if [ -f ~/.moonlight.omp.json ]; then' >> ~/.zshrc
echo ' eval "$(oh-my-posh init zsh --config ~/.moonlight.omp.json)"' >> ~/.zshrc
echo ' else' >> ~/.zshrc
echo ' eval "$(oh-my-posh init zsh --config $(brew --prefix oh-my-posh)/themes/jandedobbeleer.omp.json)"' >> ~/.zshrc
echo ' fi' >> ~/.zshrc
echo 'fi' >> ~/.zshrc
test_brew "oh-my-posh"
fi
fi
if has_brew "oh-my-posh" && ! has_path ".moonlight.omp.json"; then
get_consent "Install Oh My Posh theme"
if has_consent; then
e_pending "Installing Oh My Posh theme"
cp ~/Downloads/mac-dev-setup/.moonlight.omp.json ~/.moonlight.omp.json
test_path ".moonlight.omp.json"
fi
fi
fi
if has_command "brew" && has_command "zsh"; then
if ! has_brew "powerlevel10k"; then
get_consent "Install powerlevel10k (CLI theming)"
if has_consent; then
e_pending "Installing powerlevel10k"
brew install powerlevel10k
echo '# Theme configuration: PowerLevel10K' >> ~/.zshrc
echo 'source $(brew --prefix)/share/powerlevel10k/powerlevel10k.zsh-theme' >> ~/.zshrc
echo '# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.' >> ~/.zshrc
echo '[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh' >> ~/.zshrc
test_brew "powerlevel10k"
fi
fi
if has_brew "powerlevel10k" && ! has_path ".p10k.zsh"; then
get_consent "Install PowerLevel10K theme"
if has_consent; then
e_pending "Installing PowerLevel10K theme"
cp ~/Downloads/mac-dev-setup/.p10k.zsh ~/.p10k.zsh
test_path ".p10k.zsh"
fi
fi
fi
if has_command "brew" && has_command "zsh"; then
if ! has_brew "zsh-autosuggestions"; then
get_consent "Install zsh-autosuggestions"
if has_consent; then
e_pending "Installing zsh-autosuggestions"
brew install zsh-autosuggestions
echo "# Fish shell-like fast/unobtrusive autosuggestions for Zsh." >> ~/.zshrc
echo "source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc
test_brew "zsh-autosuggestions"
fi
fi
fi
if has_command "brew" && has_command "zsh"; then
if ! has_brew "zsh-syntax-highlighting"; then
get_consent "Install zsh-syntax-highlighting"
if has_consent; then
e_pending "Installing zsh-syntax-highlighting"
brew install zsh-syntax-highlighting
echo "# Fish shell-like syntax highlighting for Zsh." >> ~/.zshrc
echo "# Warning: Must be last sourced!" >> ~/.zshrc
echo "source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc
test_brew "zsh-syntax-highlighting"
fi
fi
fi
if has_command "brew"; then
if ! has_command "node"; then
get_consent "Install node (Node via Homebrew)"
if has_consent; then
e_pending "Installing node"
brew install node
test_command "node"
fi
fi
fi
if has_command "brew"; then
if ! has_command "n"; then
get_consent "Install n (Node via n)"
if has_consent; then
e_pending "Installing n"
brew install n
test_command "n"
fi
fi
fi
if has_command "brew"; then
if ! has_command "nvm"; then
get_consent "Install nvm (Node via nvm)"
if has_consent; then
e_pending "Installing nvm"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
test_command "nvm"
fi
fi
fi
if has_command "brew"; then
if ! has_command "yarn"; then
get_consent "Install yarn"
if has_consent; then
e_pending "Installing yarn"
brew install yarn
test_command "yarn"
fi
fi
fi
if has_command "brew"; then
if ! has_command "pnpm"; then
get_consent "Install pnpm"
if has_consent; then
e_pending "Installing pnpm"
brew install pnpm
test_command "pnpm"
fi
fi
fi
if has_command 'npm'; then
get_consent "Upgrade npm"
if has_consent; then
e_pending "Upgrading npm"
npm install -g npm@latest
test_command "npm"
fi
fi
if has_command "npm"; then
get_consent "Install/Upgrade serve (globally via npm)"
if has_consent; then
e_pending "Installing/Upgrading serve"
npm install -g serve@latest
test_command "serve"
fi
fi
# ------------------------------------------------------------------------------
e_message "Tools complete"
# ------------------------------------------------------------------------------