Permalink
Browse files

Always generate dot once, independantly of the number of specified ou…

…tput formats.
  • Loading branch information...
1 parent 53aa1dd commit 786dce4e4133193487c5417eadb65b1f59fe0ac2 @glaville committed Mar 1, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 topology.rb
View
@@ -250,9 +250,15 @@ def port_label(i, ports)
e.attributes << "penwidth = 2" if link.speed == 40
end
+ output = settings[:output]
+
+ # Always generate dot output
+ save output
+
+ # Export output do selected formats by calling graphviz directly,
+ # without regenerating the dot file each time (contrary to Graph#save)
settings[:formats].each do |format|
- output = settings[:output]
puts "Exporting to #{output}.#{format}..."
- save output, format
+ system "dot -T#{type} #{output}.dot > #{output}.#{type}" if type
end
end

0 comments on commit 786dce4

Please sign in to comment.