lib/rgl/dot.rb in rgl-0.5.2 vs lib/rgl/dot.rb in rgl-0.5.3

- old
+ new

@@ -3,10 +3,13 @@ # $Id$ # # Minimal Dot support, based on Dave Thomas's dot module (included in rdoc). # rdot.rb is a modified version which also contains support for undirected # graphs. +# +# You need to have [GraphViz](http://www.graphviz.org) installed, because the +# functions in this modul execute the GraphViz executables _dot_ or _dotty_. require 'rgl/rdot' module RGL @@ -62,11 +65,13 @@ def dotty(params = {}) dotfile = "graph.dot" File.open(dotfile, "w") do |f| print_dotted_on(params, f) end - system("dotty", dotfile) + unless system("dotty", dotfile) + raise "Error executing dotty. Did you install GraphViz?" + end end # Use dot[http://www.graphviz.org] to create a graphical representation of # the graph. Returns the filename of the graphics file. # @@ -76,10 +81,12 @@ File.open(src, 'w') do |f| f << self.to_dot_graph.to_s << "\n" end - system("dot -T#{fmt} #{src} -o #{dot}") + unless system("dot -T#{fmt} #{src} -o #{dot}") + raise "Error executing dot. Did you install GraphViz?" + end dot end end # module Graph