-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.rb
331 lines (275 loc) · 10.5 KB
/
logger.rb
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
class Logger
def format message
return message
.gsub('[clear]', "\e[0m")
.gsub('[bold]', "\e[1m")
.gsub('[black]', "\e[30m")
.gsub('[red]', "\e[31m")
.gsub('[green]', "\e[32m")
.gsub('[yellow]', "\e[33m")
.gsub('[blue]', "\e[34m")
.gsub('[magenta]', "\e[35m")
.gsub('[cyan]', "\e[36m")
.gsub('[light_gray]', "\e[37m")
.gsub('[dark_gray]', "\e[90m")
.gsub('[light_blue]', "\e[94m")
.gsub('[light_cyan]', "\e[96m")
.gsub('[white]', "\e[97m")
.gsub('[b:blue]', "\e[44m")
.gsub('[check]', "✓")
.gsub('[cross]', "✘")
.gsub('[dot]', "•")
end
def write message
puts self.format message
end
def step step, description
self.blank_line
self.write "[b:blue] [black]#{step} [clear] #{description}"
end
#####################################################################
# Format helpers
#####################################################################
def highlight word, color = ""
return self.format "[bold]#{color}#{word}[clear]"
end
def highlight_y word
return self.highlight word, '[yellow]'
end
def highlight_r word
return self.highlight word, '[red]'
end
def highlight_b word
return self.highlight word, '[blue]'
end
def highlight_lb word
return self.highlight word, '[light_blue]'
end
def check
return self.format "[green][check][clear]"
end
def cross
return self.format "[red][cross][clear]"
end
def dot
return self.format "[light_gray][dot][clear]"
end
def vizion_started version
self.write "Vizion #{self.highlight_b version} started"
end
def vizion_ended
self.write 'Done'
end
def blank_line
self.write ''
end
#####################################################################
# Base
#####################################################################
def xcode_tools_installed
self.write " #{self.check} #{self.highlight_y "XCode command line tools"}" +
" #{self.highlight "installed"}"
end
def xcode_tools_skipped
self.write " #{self.dot} #{self.highlight_y "XCode command line tools"}" +
" #{self.highlight "found"} and #{self.highlight "skipped"}"
end
def xcode_tools_not_installed
self.write " #{self.cross} #{self.highlight_y "XCode command line tools"}" +
" install #{self.highlight "failed"}"
end
def oh_my_zsh_installed
self.write " #{self.check} #{self.highlight_y "oh-my-zsh"}" +
" #{self.highlight "installed"}"
end
def oh_my_zsh_skipped
self.write " #{self.dot} #{self.highlight_y "oh-my-zsh"}" +
" #{self.highlight "found"} and #{self.highlight "skipped"}"
end
def oh_my_zsh_not_installed
self.write " #{self.cross} #{self.highlight_y "oh-my-zsh"} install" +
" #{self.highlight "failed"}"
end
def brew_installed
self.write " #{self.check} #{self.highlight_y "brew"}" +
" #{self.highlight "installed"}"
end
def brew_skipped
self.write " #{self.dot} #{self.highlight_y "brew"}" +
" #{self.highlight "found"} and #{self.highlight "skipped"}"
end
def brew_not_installed
self.write " #{self.cross} #{self.highlight_y "brew"} install" +
" #{self.highlight "failed"}"
end
#####################################################################
# Brew
#####################################################################
def brew_tap_skipped tap
self.write " #{self.dot} #{self.highlight_y tap}" +
" #{self.highlight "found"} and #{self.highlight "skipped"}"
end
def brew_tap_success tap
self.write " #{self.check} #{self.highlight_y tap}" +
" #{self.highlight "tapped"}"
end
def brew_tap_failed tap
self.write " #{self.cross} #{self.highlight_y tap} tap" +
" #{self.highlight "failed"}"
end
#####################################################################
# Brew
#####################################################################
def brew_formula_skipped formula
self.write " #{self.dot} #{self.highlight_y formula}" +
" #{self.highlight "found"} and #{self.highlight "skipped"}"
end
def brew_formula_installed formula, version
self.write " #{self.check} #{self.highlight_y formula} at version" +
" #{self.highlight_lb version} #{self.highlight "installed"}"
end
def brew_formula_up_to_date formula, version
self.write " #{self.dot} #{self.highlight_y formula} at version" +
" #{self.highlight_lb version} #{self.highlight "up-to-date"}"
end
def brew_formula_update_available formula, current_version, new_version
self.write " #{self.dot} #{self.highlight_y formula} at version" +
" #{self.highlight_lb current_version} #{self.highlight "found"}." +
" Version #{self.highlight_lb new_version} #{self.highlight "available"}"
end
def brew_formula_does_not_exist formula
self.write " #{self.cross} #{self.highlight_y formula}" +
" #{self.highlight "not found"}"
end
def brew_formula_not_installed formula
self.write " #{self.cross} #{self.highlight_y formula} install"
+ " #{self.highlight "failed"}"
end
#####################################################################
# Brew Cask
#####################################################################
def brew_cask_formula_skipped formula
self.write " #{self.dot} #{self.highlight_y formula}" +
" #{self.highlight "found"} and #{self.highlight "skipped"}"
end
def brew_cask_formula_already_installed formula
self.write " #{self.dot} #{self.highlight_y formula} already" +
" #{self.highlight "installed"}"
end
def brew_cask_formula_installed formula, version
self.write " #{self.check} #{self.highlight_y formula} at version" +
" #{self.highlight_lb version} #{self.highlight "installed"}"
end
def brew_cask_formula_not_found formula
self.write " #{self.cross} #{self.highlight_y formula}" +
" #{self.highlight "not found. Perhaps a `brew tap` is needed?"}"
end
def brew_cask_formula_not_found formula
self.write " #{self.cross} #{self.highlight_y formula}" +
" #{self.highlight "not found"}. Perhaps a `brew tap` is needed?"
end
def brew_cask_formula_app_existing_already formula
self.write " #{self.dot} #{self.highlight_y formula}" +
" #{self.highlight "already exists"} at /Applications"
end
def brew_cask_formula_failed formula
self.write " #{self.cross} #{self.highlight_y formula} install"
+ " #{self.highlight "failed"}"
end
#####################################################################
# Yarn Packages
#####################################################################
def yarn_package_installed package
self.write " #{self.check} #{self.highlight_y package}" +
" #{self.highlight "installed"}"
end
def yarn_package_skipped package
self.write " #{self.dot} #{self.highlight_y package}" +
" #{self.highlight "found"} and #{self.highlight "skipped"}"
end
def yarn_package_not_installed package
self.write " #{self.cross} #{self.highlight_y package} install" +
" #{self.highlight "failed"}"
end
#####################################################################
# TPM
#####################################################################
def tmux_plugin_manager_installed
self.write " #{self.check} #{self.highlight_y "Tmux Plugin Manager"}" +
" #{self.highlight "installed"}"
end
def tmux_plugin_manager_skipped
self.write " #{self.dot} #{self.highlight_y "Tmux Plugin Manager"}" +
" #{self.highlight "found"} and #{self.highlight "skipped"}"
end
#####################################################################
# Tmux plugins
#####################################################################
def tmux_plugins_installed
self.write " #{self.check} #{self.highlight_y "Tmux plugins"}" +
" #{self.highlight "installed"}"
end
#####################################################################
# Vim plugs
#####################################################################
def nvim_plugs_installed
self.write " #{self.check} #{self.highlight_y "Vim plugs"}" +
" #{self.highlight "installed"}"
end
#####################################################################
# Dotfiles
#####################################################################
def dotfile_count count
self.write "There are #{self.highlight_b count} dotfiles to be linked"
end
def dotfile_linked dotfile
self.write " #{self.check} #{self.highlight_y dotfile}" +
" #{self.highlight "linked"}"
end
def dotfile_not_linked dotfile
self.write " #{self.dot} #{self.highlight_y dotfile}" +
" #{self.highlight "not linked. A file, directory or symlink already exist"}"
end
#####################################################################
# Directories
#####################################################################
def directory_count count
self.write "There are #{self.highlight_b count} directories to be linked"
end
def directory_linked directory
self.write " #{self.check} #{self.highlight_y directory}" +
" #{self.highlight "linked"}"
end
def directory_not_linked directory
self.write " #{self.dot} #{self.highlight_y directory}" +
" #{self.highlight "not linked. A file, directory or symlink already exist"}"
end
#####################################################################
# Oh My Zsh Themes
#####################################################################
def oh_my_zsh_theme_count count
self.write "There are #{self.highlight_b count} oh_my_zsh_themes to be linked"
end
def oh_my_zsh_theme_linked theme
self.write " #{self.check} #{self.highlight_y theme}" +
" #{self.highlight "linked"}"
end
def oh_my_zsh_theme_not_linked theme
self.write " #{self.dot} #{self.highlight_y theme}" +
" #{self.highlight "not linked. A file, directory or symlink already exist"}"
end
#####################################################################
# iTerm2
#####################################################################
def iterm2_configured
self.write " #{self.check} #{self.highlight_y "iTerm2"}" +
" #{self.highlight "configured"}"
end
#####################################################################
# Visuals
#####################################################################
def true_colors_and_italics_configured
self.write " #{self.check} #{self.highlight_y "true color and itallics"}" +
" #{self.highlight "configured"}"
end
end