-
Notifications
You must be signed in to change notification settings - Fork 0
/
clean.rb
executable file
·69 lines (57 loc) · 1.05 KB
/
clean.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
#!/usr/bin/env ruby
require 'fileutils'
def remove_folder(path)
if Dir.exists?(path)
p = Dir.glob(path)
puts "Removing #{p}"
FileUtils.rm_rf(p)
else
puts "Folder #{path} does not exist"
end
end
def remove_app_junk(app)
logs = "#{Dir.home}/Library/Logs/#{app}"
cache = "#{Dir.home}/Library/Cache/#{app}"
remove_folder logs
remove_folder cache
end
# ##### #
# Other #
# ##### #
dirs = [
"#{Dir.home}/Library/Caches/com.apple.helpd",
"#{Dir.home}/Library/Caches/com.getdropbox.DropboxMetaInstaller",
]
dirs.each { |d|
remove_folder d
}
# ############ #
# Applications #
# ############ #
apps = [
'Electron',
'Homebrew',
'VisualStudio',
]
apps.each { |app|
remove_app_junk app
}
# ################################# #
# Remove old JetBrains product data #
# ################################# #
jetbrains = [
'PhpStorm',
'WebStorm',
]
jetbrains_old_versions = [
'2017.1',
'2017.2',
'2017.3',
'2018.1',
'2018.2',
]
jetbrains.each { |j|
jetbrains_old_versions.each { |v|
remove_app_junk("#{j}#{v}")
}
}