glejeune / Ruby-Graphviz

[MIRROR] Ruby interface to the GraphViz graphing tool
https://gitlab.com/glejeune/ruby-graphviz
Other
608 stars 116 forks source link

Drawing a graph fails when a node is called "node" #90

Closed xb closed 10 years ago

xb commented 10 years ago

Testcase

Consider this graphviz_gem_testcase.rb file:


#!/usr/bin/ruby
#

require 'graphviz'

g = GraphViz.new( :G, :type => :digraph )

hello = g.add_nodes( "graph" )
world = g.add_nodes( "node" )

g.add_edges( hello, world )

g.output( :png => "hello_world.png" )

Expected result

The code runs flawlessly

Actual result

Such an error occurs:

/home/user/.rvm/gems/ruby-2.1.1/gems/ruby-graphviz-1.0.9/lib/graphviz/utils.rb:77:in `output_from_command': Error from "/usr/bin/dot" -q1   -Tpng -ohello_world.png   /tmp/graphviz.rb20140426-8204-r5x61h: (RuntimeError)
Error: /tmp/graphviz.rb20140426-8204-r5x61h:4: syntax error near line 4
context:   graph >>>  -> <<<  node;
        from /home/user/.rvm/gems/ruby-2.1.1/gems/ruby-graphviz-1.0.9/lib/graphviz.rb:589:in `output'
        from ./graphviz_gem_testcase.rb:15:in `<main>'
joaozeni commented 10 years ago

Actually the problem is with both, called node and graph. I did't find any instructions in how to contribute, but i will do a fork, add a new branch and a do a pull request, this is ok with the developers?

glejeune commented 10 years ago

@joaozeni thanks