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
|
# File 'lib/depcheck/output/graph_output.rb', line 4
def post(objs, include, dot)
system 'brew install graphviz' unless graphviz_installed?
unless graphviz_installed?
fail "graphviz is not in the user's PATH, or it failed to install"
end
graph = generate_graph_description(objs, include)
file_name = 'graph'
File.open("#{file_name}.dot", 'w') do |f|
f.write(graph)
end
if dot
`dot -T png #{file_name}.dot`
elsif
`dot -T png #{file_name}.dot > #{file_name}.png && open #{file_name}.png`
File.delete("#{file_name}.dot")
end
end
|