Class: HomebrewAnalyzer
Overview
Constant Summary
collapse
- SHH =
"2> /dev/null"
Instance Attribute Summary collapse
Attributes inherited from DepAnalyzer
#g
Instance Method Summary
collapse
Methods inherited from DepAnalyzer
#decorate, #initialize, #run, #setup
Methods inherited from Cache
#cache, #initialize
Constructor Details
This class inherits a constructor from DepAnalyzer
Instance Attribute Details
Returns the value of attribute casks.
8
9
10
|
# File 'lib/homebrew_analyzer.rb', line 8
def casks
@casks
end
|
Instance Method Details
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/homebrew_analyzer.rb', line 28
def alldeps
@alldeps ||= begin
full_names = `brew list --full-name`.split
`brew deps -n1 --for-each #{full_names.join " "}`
.lines
.map { |l| k, *v = l.delete(":").split; [clean(k), v] }
.to_h
end
end
|
#clean(name) ⇒ Object
55
56
57
|
# File 'lib/homebrew_analyzer.rb', line 55
def clean name
name.split("/").last
end
|
#deps(port) ⇒ Object
46
47
48
49
|
# File 'lib/homebrew_analyzer.rb', line 46
def deps port
return [] if @casks.include? port
alldeps[port] ||= `brew deps #{port}`.scan(/\S+/)
end
|
#installed ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/homebrew_analyzer.rb', line 10
def installed
puts "scanning installed ports"
ports = normal `brew list #{SHH}`
puts "scanning installed casks"
self.casks = normal `brew list --cask #{SHH}`
ports + casks
end
|
#normal(lines) ⇒ Object
51
52
53
|
# File 'lib/homebrew_analyzer.rb', line 51
def normal lines
lines.split(/\n/).map { |s| clean s }
end
|
19
20
21
22
23
24
25
26
|
# File 'lib/homebrew_analyzer.rb', line 19
def outdated
puts "scanning outdated ports"
ports = normal `brew outdated #{SHH}`
puts "scanning outdated casks"
casks = normal `brew outdated --cask #{SHH}`
ports + casks
end
|