lib/graphviz/dot2ruby.rb in ruby-graphviz-1.0.9 vs lib/graphviz/dot2ruby.rb in ruby-graphviz-1.1.0

- old
+ new

@@ -22,17 +22,20 @@ include GraphViz::Utils def initialize( xGVPath, xOutFile, xOutFormat = nil ) #:nodoc: paths = (xGVPath.nil?) ? [] : [xGVPath] @xGvprPath = find_executable( 'gvpr', paths ) + if (@xGvprPath.blank?) + raise Exception, "GraphViz is not installed. Please be sure that 'gvpr' is on the search path'" + end @xOutFile = xOutFile @xOutFormat = xOutFormat || "_" @gvprScript = GraphViz::Ext.find( "dot2ruby.g" ) end def run( xFile ) #:nodoc: - xCmd = "#{@xGvprPath} -f #{@gvprScript} -a #{@xOutFormat} #{xFile}" + xCmd = [@xGvprPath, '-f', @gvprScript, '-a', @xOutFormat, xFile] xOutput = output_from_command( xCmd ) if @xOutFile.nil? puts xOutput else File.open( @xOutFile, "w" ) do |io| @@ -40,10 +43,10 @@ end end end def eval( xFile ) #:nodoc: - xCmd = "#{@xGvprPath} -f #{@gvprScript} -a \"-\" #{xFile}" + xCmd = [@xGvprPath, '-f', @gvprScript, '-a', '-', xFile] xOutput = output_from_command( xCmd ) instance_eval(xOutput) return @_graph_eval end