ruby-graphviz 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/AUTHORS CHANGED
@@ -1,6 +1,6 @@
1
1
  Gregoire Lejeune <glejeune.lejeune@free.fr>
2
-
3
2
  Brandon Coleman <metrix1978@gmail.com>
3
+ Dave Burt <http://github.com/dburt>
4
4
 
5
5
  Thanks to :
6
6
 
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ 0.9.2 :
2
+ * Escape nodes (by Dave Burt)
3
+ * Handle errors from graphviz command (by Dave Burt)
4
+ * Output as string (if String class is passed as file i.e. output(:pdf => String)) (by Dave Burt)
5
+
1
6
  0.9.1 :
2
7
  * Bugs corrections
3
8
  * Add the ability to create edge like that : node1 << node2 << node3 ...
data/README.rdoc CHANGED
@@ -26,7 +26,7 @@ A basic example
26
26
  g.add_edge( hello, world )
27
27
 
28
28
  # Generate output image
29
- g.output( :output => "png", :file => "hello_world.png" )
29
+ g.output( :png => "hello_world.png" )
30
30
 
31
31
  The same but with a block
32
32
 
@@ -34,7 +34,7 @@ The same but with a block
34
34
 
35
35
  GraphViz::new( :G, :type => :digraph ) { |g|
36
36
  g.world( :label => "World" ) << g.hello( :label => Hello )
37
- }.output( :output => :png, :file => "hello_world.png" )
37
+ }.output( :png => "hello_world.png" )
38
38
 
39
39
  Create a graph from a file
40
40
 
@@ -50,13 +50,13 @@ Create a graph from a file
50
50
  g.get_node("World") { |n|
51
51
  n[:label] = "Le Monde"
52
52
  }
53
- }.output(:output => "png", :file => "sample.png")
53
+ }.output(:png => "sample.png")
54
54
 
55
55
  == INSTALLATION
56
56
 
57
57
  sudo gem install ruby-graphviz
58
58
 
59
- You also need to install GraphViz[http://www.graphviz.org]
59
+ You also need to install GraphViz[http://www.graphviz.org] and Treetop[http://treetop.rubyforge.org/]
60
60
 
61
61
  == LICENCE
62
62
 
@@ -1,7 +1,7 @@
1
1
  $:.unshift( "../lib" );
2
2
  require "graphviz"
3
3
 
4
- g = GraphViz::new( "structs", :output => "png" )
4
+ g = GraphViz::new( "structs" )
5
5
 
6
6
  g.node["shape"] = "plaintext"
7
7
 
@@ -17,4 +17,4 @@ g.add_edge( "struct1:f2", "struct3:here" )
17
17
 
18
18
  g.add_edge( "HTML", "struct1" )
19
19
 
20
- g.output( :path => '/usr/local/bin/', :file => "#{$0}.png" )
20
+ g.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
@@ -5,9 +5,9 @@ require "graphviz"
5
5
 
6
6
  g = nil
7
7
  if ARGV[0]
8
- g = GraphViz::new( "G", "output" => "png", "path" => ARGV[0] )
8
+ g = GraphViz::new( "G", "path" => ARGV[0] )
9
9
  else
10
- g = GraphViz::new( "G", "output" => "png" )
10
+ g = GraphViz::new( "G" )
11
11
  end
12
12
 
13
13
  g["rankdir"] = "LR"
@@ -94,4 +94,4 @@ g.edge["arrowhead"] = "normal"
94
94
  g.add_edge( p, s, "arrowhead" => s )
95
95
  }
96
96
 
97
- g.output( :file => "#{$0}.png" )
97
+ g.output( :png => "#{$0}.png" )
@@ -10,5 +10,5 @@ GraphViz.parse( "hello.dot", :path => "/usr/local/bin" ) { |g|
10
10
  g.get_node("World") { |n|
11
11
  n.label = "Le Monde"
12
12
  }
13
- }.output(:output => "png", :file => "sample.png")
13
+ }.output(:png => "sample.png")
14
14
 
@@ -59,4 +59,4 @@ GraphViz::new( "TrafficLights", :type => :digraph ) { |g|
59
59
  g[:overlap] = :false
60
60
  g[:label] = 'PetriNet Model TrafficLights\nExtracted from ConceptBase and layed out by Graphviz'
61
61
  g[:fontsize] = 12;
62
- }.output( :output => :png, :file => "TrafficLights.png" )
62
+ }.output( :png => "TrafficLights.png" )
@@ -59,4 +59,4 @@ GraphViz.new( :G, :type => :digraph ) { |g|
59
59
  g.start[:shape] = :Mdiamond
60
60
  g._end[:label] = "end"
61
61
  g._end[:shape] = :Mdiamond
62
- }.output( :output => :png, :file => "cluster.png" )
62
+ }.output( :png => "cluster.png" )
@@ -7,4 +7,4 @@ require "graphviz"
7
7
 
8
8
  GraphViz::new( :G, :type => :digraph ) { |g|
9
9
  g.world( :label => "World" ) << g.hello( :label => "Hello" )
10
- }.output( :output => :png, :file => "hello.png" )
10
+ }.output( :png => "hello.png" )
@@ -212,4 +212,4 @@ GraphViz::new( "Ped_Lion_Share", :type => :digraph ) { |g|
212
212
  (g._026 << g.marr0017).set { |e| e[:dir] = :none; e[:weight] = 1 }
213
213
  (g._027 << g.marr0017).set { |e| e[:dir] = :none; e[:weight] = 1 }
214
214
  (g.marr0017 << g._028).set { |e| e[:dir] = :none; e[:weight] = 2 }
215
- }.output( :output => :png, :file => "lion_share.png" )
215
+ }.output( :png => "lion_share.png" )
@@ -34,4 +34,4 @@ GraphViz::new( :G, :type => :graph ) { |g|
34
34
  g.runswap << g.runmem
35
35
  g._new << g.runmem
36
36
  g.sleep << g.runmem
37
- }.output( :output => :png, :file => "process.png", :use => :fdp )
37
+ }.output( :png => "process.png", :use => :fdp )
data/examples/p2p.rb CHANGED
@@ -5,9 +5,9 @@ require "graphviz"
5
5
 
6
6
  g = nil
7
7
  if ARGV[0]
8
- g = GraphViz::new( "G", "output" => "png", "path" => ARGV[0], :use => "circo" )
8
+ g = GraphViz::new( "G", "path" => ARGV[0], :use => "circo" )
9
9
  else
10
- g = GraphViz::new( "G", "output" => "png" )
10
+ g = GraphViz::new( "G" )
11
11
  end
12
12
 
13
13
  c0 = g.add_graph( "cluster0" )
@@ -32,4 +32,4 @@ g.add_edge( bp, jv, :color => "red", :label => "Est le beau fils de" ) # Beau fi
32
32
  g.add_edge( bp, gr )
33
33
  g.add_edge( gr, md )
34
34
 
35
- g.output
35
+ g.output( :png => "p2p.png" )
data/examples/sample07.rb CHANGED
@@ -9,7 +9,7 @@ if ARGV[0]
9
9
  GraphViz::options( :path => ARGV[0] )
10
10
  end
11
11
 
12
- g = GraphViz::new( "structs", "output" => "png" )
12
+ g = GraphViz::new( "structs" )
13
13
 
14
14
  g.node["shape"] = "record"
15
15
 
@@ -20,4 +20,4 @@ g.add_node( "struct3", "shape" => "record", "label" => 'hello\nworld |{ b |{c|<h
20
20
  g.add_edge( "struct1:f1", "struct2:f0" )
21
21
  g.add_edge( "struct1:f2", "struct3:here" )
22
22
 
23
- g.output( :png => "#{$0}.png" )
23
+ g.output( :png => "#{$0}.png", :canon => nil )
data/examples/sample11.rb CHANGED
@@ -5,9 +5,9 @@ require "graphviz"
5
5
 
6
6
  graph = nil
7
7
  if ARGV[0]
8
- graph = GraphViz::new( "G", "output" => "png", "path" => ARGV[0] )
8
+ graph = GraphViz::new( "G", "path" => ARGV[0] )
9
9
  else
10
- graph = GraphViz::new( "G", "output" => "png" )
10
+ graph = GraphViz::new( "G" )
11
11
  end
12
12
 
13
13
  graph["compound"] = "true"
@@ -39,4 +39,4 @@ graph.add_edge( c, g, "ltail" => "cluster0", "lhead" => "cluster1" )
39
39
  graph.add_edge( c, e, "ltail" => "cluster0" )
40
40
  graph.add_edge( d, h )
41
41
 
42
- graph.output( :file => "#{$0}.png" )
42
+ graph.output( :png => "#{$0}.png" )
data/examples/sample12.rb CHANGED
@@ -5,9 +5,9 @@ require "graphviz"
5
5
 
6
6
  g = nil
7
7
  if ARGV[0]
8
- g = GraphViz::new( "G", "output" => "png", "path" => ARGV[0] )
8
+ g = GraphViz::new( "G", "path" => ARGV[0] )
9
9
  else
10
- g = GraphViz::new( "G", "output" => "png" )
10
+ g = GraphViz::new( "G" )
11
11
  end
12
12
 
13
13
  g.node[:shape] = "ellipse"
@@ -52,4 +52,4 @@ g.cluster0.a3 << g.cluster0.a0
52
52
  g.cluster0.a3 << g.endn
53
53
  g.cluster1.b3 << g.endn
54
54
 
55
- g.output( :file => "#{$0}.png" )
55
+ g.output( :png => "#{$0}.png" )
data/examples/sample13.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  $:.unshift( "../lib" );
4
4
  require "graphviz"
5
5
 
6
- GraphViz::new( "G", "output" => "png" ) { |graph|
6
+ GraphViz::new( "G" ) { |graph|
7
7
  graph.node[:shape] = "ellipse"
8
8
  graph.node[:color] = "black"
9
9
 
@@ -45,4 +45,4 @@ GraphViz::new( "G", "output" => "png" ) { |graph|
45
45
  graph.cluster0.a3 << graph.cluster0.a0
46
46
  graph.cluster0.a3 << graph.endn
47
47
  graph.cluster1.b3 << graph.endn
48
- }.output( :path => '/usr/local/bin/', :file => "#{$0}.png" )
48
+ }.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
data/examples/sample14.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  $:.unshift( "../lib" );
4
4
  require "graphviz"
5
5
 
6
- GraphViz::new( "G", "output" => "png" ) { |graph|
6
+ GraphViz::new( "G" ) { |graph|
7
7
  graph.node[:shape] = "ellipse"
8
8
  graph.node[:color] = "black"
9
9
 
@@ -41,4 +41,4 @@ GraphViz::new( "G", "output" => "png" ) { |graph|
41
41
  graph.cluster0.a3 << graph.cluster0.a0
42
42
  graph.cluster0.a3 << graph.endn
43
43
  graph.cluster1.b3 << graph.endn
44
- }.output( :path => '/usr/local/bin/', :file => "#{$0}.png" )
44
+ }.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
data/examples/sample15.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  $:.unshift( "../lib" );
7
7
  require "graphviz"
8
8
 
9
- GraphViz::new( "G", :type => "graph", :output => "png", :use => "fdp" ) { |graph|
9
+ GraphViz::new( "G", :type => "graph", :use => "fdp" ) { |graph|
10
10
  graph.e
11
11
  graph.clusterA { |cA|
12
12
  cA.a << cA.b
@@ -20,4 +20,4 @@ GraphViz::new( "G", :type => "graph", :output => "png", :use => "fdp" ) { |graph
20
20
  graph.clusterB.d << graph.clusterA.clusterC._d
21
21
  graph.e << graph.clusterB
22
22
  graph.clusterA.clusterC << graph.clusterB
23
- }.output( :path => '/usr/local/bin/', :file => "#{$0}.png" )
23
+ }.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
data/examples/sample16.rb CHANGED
@@ -3,6 +3,6 @@
3
3
  $:.unshift( "../lib" );
4
4
  require "graphviz"
5
5
 
6
- GraphViz::new( "G", :type => "graph", :output => "png", :rankdir => "LR" ) { |graph|
6
+ GraphViz::new( "G", :type => "graph", :rankdir => "LR" ) { |graph|
7
7
  graph.add_edge( [graph.a, graph.b, graph.c], [ graph.d, graph.e, graph.f ] )
8
- }.output( :path => '/usr/local/bin/', :file => "#{$0}.png" )
8
+ }.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
data/examples/sample17.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  $:.unshift( "../lib" );
4
4
  require "graphviz"
5
5
 
6
- GraphViz::new( "G", :type => "graph", :output => "png", :rankdir => "LR", :bgcolor => "#808080" ) { |graph|
6
+ GraphViz::new( "G", :type => "graph", :rankdir => "LR", :bgcolor => "#808080" ) { |graph|
7
7
  graph.edge[:dir] = "none"
8
8
 
9
9
  graph.node[:width] = "0.3"
@@ -89,4 +89,4 @@ GraphViz::new( "G", :type => "graph", :output => "png", :rankdir => "LR", :bgcol
89
89
  _["V"] << _["60"]
90
90
  _["W"] << _["70"]
91
91
  _["X"] << _["80"]
92
- }.output( :path => '/usr/local/bin/', :file => "#{$0}.png" )
92
+ }.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
data/examples/sample18.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  $:.unshift( "../lib" );
4
4
  require "graphviz"
5
5
 
6
- GraphViz::new( "G", :output => "png", :rankdir => "LR", :size => "8,5" ) { |graph|
6
+ GraphViz::new( "G", :rankdir => "LR", :size => "8,5" ) { |graph|
7
7
  graph.node[:shape] = "doublecircle"
8
8
  graph._LR_0; graph._LR_3; graph._LR_4; graph._LR_8
9
9
  graph.node[:shape] = "circle"
@@ -21,4 +21,4 @@ GraphViz::new( "G", :output => "png", :rankdir => "LR", :size => "8,5" ) { |grap
21
21
  (graph._LR_7 << graph._LR_5)[:label] = "S(a)"
22
22
  (graph._LR_8 << graph._LR_6)[:label] = "S(b)"
23
23
  (graph._LR_8 << graph._LR_5)[:label] = "S(a)"
24
- }.output( :path => '/usr/local/bin/', :file => "#{$0}.png" )
24
+ }.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
data/examples/sample19.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  $:.unshift( "../lib" );
4
4
  require "graphviz"
5
5
 
6
- GraphViz::new( "ER", :type => "graph", :output => "png", :use => "neato" ) { |graph|
6
+ GraphViz::new( "ER", :type => "graph", :use => "neato" ) { |graph|
7
7
  graph.node[:shape] = "box"
8
8
  graph.course; graph.institute; graph.student
9
9
 
@@ -56,4 +56,4 @@ GraphViz::new( "ER", :type => "graph", :output => "png", :use => "neato" ) { |gr
56
56
 
57
57
  graph[:label] = "\\n\\nEntity Relation Diagram\\ndrawn by NEATO";
58
58
  graph[:fontsize] = "20";
59
- }.output( :path => '/usr/local/bin/', :file => "#{$0}.png" )
59
+ }.output( :path => '/usr/local/bin/', :png => "#{$0}.png" )
data/examples/sample20.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  $:.unshift( "../lib" );
4
4
  require "graphviz"
5
5
 
6
- GraphViz::options( :output => "png", :use => "dot" )
6
+ GraphViz::options( :use => "dot" )
7
7
 
8
8
  if ARGV[0]
9
9
  GraphViz::options( :path => ARGV[0] )
@@ -44,4 +44,4 @@ GraphViz::new( "g", :rankdir => "LR", :type => "digraph" ) { |g|
44
44
  g.add_edge( g.node10(:f1), g.node11(:f0) )
45
45
  g.add_edge( g.node10(:f2), g.node12(:f0) )
46
46
  g.add_edge( g.node11(:f2), g.node1(:f0) )
47
- }.output( :file => "#{$0}.png" )
47
+ }.output( :png => "#{$0}.png" )
data/examples/sample21.rb CHANGED
@@ -4,9 +4,9 @@ $:.unshift( "../lib" );
4
4
  require "graphviz"
5
5
 
6
6
  {"png" => "#{$0}.png", "imap" => "#{$0}.html"}.each do |format, file|
7
- GraphViz::new( "G", :output => format ) { |g|
8
- g.command #(:URL => "http://www.research.att.com/base.html")
9
- g._output(:label => "output") #(:URL => "colors.html")
7
+ GraphViz::new( "G" ) { |g|
8
+ g.command(:URL => "http://www.research.att.com/base.html")
9
+ g._output(:label => "output", :URL => "colors.html")
10
10
  g.command << g._output
11
- }.output( :file => file )
11
+ }.output( format => file )
12
12
  end
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift( "../lib" );
4
+ require "graphviz"
5
+
6
+ r = GraphViz::new( "mainmap" ) { |graph|
7
+ graph[:URL] = "http://www.research.att.com/base.html"
8
+ graph.command( :URL => "http://www.research.att.com/command.html" )
9
+ (graph.command << graph._output( :label => "output" ))[:URL] = "colors.html"
10
+ }
11
+ puts r.output( :cmapx => String, :png => "#{$0}.png" )
data/examples/shapes.rb CHANGED
@@ -5,9 +5,9 @@ require "graphviz"
5
5
 
6
6
  g = nil
7
7
  if ARGV[0]
8
- g = GraphViz::new( "G", "output" => "png", "path" => ARGV[0] )
8
+ g = GraphViz::new( "G", "path" => ARGV[0] )
9
9
  else
10
- g = GraphViz::new( "G", "output" => "png" )
10
+ g = GraphViz::new( "G" )
11
11
  end
12
12
 
13
13
  g.node["shape"] = "ellipse"
@@ -21,4 +21,4 @@ g.node["shape"] = "ellipse"
21
21
  g.add_node( s, "shape" => s )
22
22
  }
23
23
 
24
- g.output( :file => "shapes.png")
24
+ g.output( :png => "shapes.png")
@@ -5,9 +5,9 @@ require "graphviz"
5
5
 
6
6
  g = nil
7
7
  if ARGV[0]
8
- g = GraphViz::new( "G", "output" => "png", "path" => ARGV[0] )
8
+ g = GraphViz::new( "G", "path" => ARGV[0] )
9
9
  else
10
- g = GraphViz::new( "G", "output" => "png" )
10
+ g = GraphViz::new( "G" )
11
11
  end
12
12
 
13
13
  g.node["color"] = "black"
@@ -40,4 +40,4 @@ g.add_edge( init, make_string )
40
40
  g.add_edge( main, printf, "color" => "red", "style" => "bold", "label" => "100 times" )
41
41
  g.add_edge( execute, compare, "color" => "red" )
42
42
 
43
- g.output( :file => "#{$0}.png" )
43
+ g.output( :png => "#{$0}.png" )
data/examples/testxml.rb CHANGED
@@ -4,4 +4,4 @@ $:.unshift( "../lib" )
4
4
  require 'graphviz/xml'
5
5
 
6
6
  gvxml = GraphViz::XML::new( "test.xml", :text => true, :attrs => true )
7
- gvxml.output( :output => "png", :file => "#{$0}.png", :use => "dot", :path => ARGV[0] )
7
+ gvxml.output( :png => "#{$0}.png", :use => "dot", :path => ARGV[0] )
data/lib/graphviz.rb CHANGED
@@ -16,6 +16,7 @@
16
16
 
17
17
  require 'tempfile'
18
18
  require 'mkmf'
19
+ require 'open3'
19
20
 
20
21
  require 'graphviz/node'
21
22
  require 'graphviz/edge'
@@ -235,7 +236,10 @@ class GraphViz
235
236
  # :file : Output file name
236
237
  # :use : Program to use (Constants::PROGRAMS)
237
238
  # :path : Program PATH
238
- # :<format> => :<file>
239
+ # :<format> => <file> : <file> can be
240
+ # * a file name
241
+ # * nil, then the output will be printed to STDOUT
242
+ # * String, then the output will be returned as a String
239
243
  #
240
244
  def output( *hOpt )
241
245
  xDOTScript = ""
@@ -320,7 +324,7 @@ class GraphViz
320
324
  else
321
325
  if hOpt.nil? == false and hOpt[0].nil? == false
322
326
  hOpt[0].each do |xKey, xValue|
323
- xValue = xValue.to_s unless xValue.nil?
327
+ xValue = xValue.to_s unless xValue.nil? or xValue.class == Class
324
328
  case xKey.to_s
325
329
  when "output"
326
330
  warn ":output option is deprecated, please use :<format> => :<file>"
@@ -349,7 +353,8 @@ class GraphViz
349
353
 
350
354
  xDOTScript = "#{@oGraphType} #{@name} {\n" << xDOTScript
351
355
 
352
- if @format != "none"
356
+ xOutputString = false
357
+ xOutput = if @format != "none"
353
358
  ## Act: Save script and send it to dot
354
359
  t = Tempfile::open( File.basename($0) + "." )
355
360
  t.print( xDOTScript )
@@ -367,6 +372,9 @@ class GraphViz
367
372
  unless @format.nil?
368
373
  if @filename.nil?
369
374
  xOutputWithoutFile = "-T#{@format} "
375
+ elsif @filename == String
376
+ xOutputWithoutFile = "-T#{@format} "
377
+ xOutputString = true
370
378
  else
371
379
  xOutputWithFile = "-T#{@format} -o#{@filename} "
372
380
  end
@@ -374,6 +382,9 @@ class GraphViz
374
382
  @output.each do |format, file|
375
383
  if file.nil?
376
384
  xOutputWithoutFile << "-T#{format} "
385
+ elsif file == String
386
+ xOutputWithoutFile << "-T#{format} "
387
+ xOutputString = true
377
388
  else
378
389
  xOutputWithFile << "-T#{format} -o#{file} "
379
390
  end
@@ -381,11 +392,26 @@ class GraphViz
381
392
 
382
393
  xCmd = "#{cmd} #{xOutputWithFile} #{xOutputWithoutFile} #{t.path}"
383
394
 
384
- f = IO.popen( xCmd )
385
- print f.readlines
386
- f.close
395
+ #f = IO.popen( xCmd )
396
+ #print f.readlines
397
+ #f.close
398
+ Open3.popen3( xCmd ) do |_, stdout, stderr|
399
+ errors = stderr.read
400
+ if errors.blank?
401
+ stdout.read
402
+ else
403
+ raise "Error from graphviz (#{xCmd}):\n#{errors}"
404
+ end
405
+ end
406
+ else
407
+ #puts xDOTScript
408
+ xDOTScript
409
+ end
410
+
411
+ if xOutputString
412
+ xOutput
387
413
  else
388
- puts xDOTScript
414
+ print xOutput
389
415
  end
390
416
  end
391
417
  end
@@ -563,6 +589,17 @@ class GraphViz
563
589
  yield( self ) if( block )
564
590
  end
565
591
 
592
+ #
593
+ # Escape a string to be acceptable as a node name in a graphviz input file
594
+ #
595
+ def self.escape(str) #:nodoc:
596
+ if str.match( /^[a-zA-Z_]+[a-zA-Z0-9_:\.]*$/ ).nil?
597
+ '"' + str.gsub('"', '\\"').gsub("\n", '\\\\n') + '"'
598
+ else
599
+ str
600
+ end
601
+ end
602
+
566
603
  def find_executable( ) #:nodoc:
567
604
  cmd = find_executable0( @prog )
568
605
  if cmd == nil and @path != nil
@@ -15,7 +15,7 @@
15
15
  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 
17
17
  module Constants
18
- RGV_VERSION = "0.9.1"
18
+ RGV_VERSION = "0.9.2"
19
19
 
20
20
  ## Const: Output formats
21
21
  FORMATS = [
data/lib/graphviz/edge.rb CHANGED
@@ -100,11 +100,13 @@ class GraphViz
100
100
  xLink = " -- "
101
101
  end
102
102
 
103
- xNodeNameOne = @xNodeOne.clone
104
- xNodeNameOne = '"' << xNodeNameOne << '"' if xNodeNameOne.match( /^[a-zA-Z_]+[a-zA-Z0-9_\.]*$/ ).nil?
103
+ #xNodeNameOne = @xNodeOne.clone
104
+ #xNodeNameOne = '"' << xNodeNameOne << '"' if xNodeNameOne.match( /^[a-zA-Z_]+[a-zA-Z0-9_\.]*$/ ).nil?
105
+ xNodeNameOne = GraphViz.escape(@xNodeOne)
105
106
 
106
- xNodeNameTwo = @xNodeTwo.clone
107
- xNodeNameTwo = '"' << xNodeNameTwo << '"' if xNodeNameTwo.match( /^[a-zA-Z_]+[a-zA-Z0-9_\.]*$/ ).nil?
107
+ #xNodeNameTwo = @xNodeTwo.clone
108
+ #xNodeNameTwo = '"' << xNodeNameTwo << '"' if xNodeNameTwo.match( /^[a-zA-Z_]+[a-zA-Z0-9_\.]*$/ ).nil?
109
+ xNodeNameTwo = GraphViz.escape(@xNodeTwo)
108
110
 
109
111
  xOut = xNodeNameOne + xLink + xNodeNameTwo
110
112
  xAttr = ""
data/lib/graphviz/node.rb CHANGED
@@ -100,8 +100,9 @@ class GraphViz
100
100
  end
101
101
 
102
102
  def output #:nodoc:
103
- xNodeName = @xNodeName.clone
104
- xNodeName = '"' << xNodeName << '"' if xNodeName.match( /^[a-zA-Z_]+[a-zA-Z0-9_\.]*$/ ).nil?
103
+ #xNodeName = @xNodeName.clone
104
+ #xNodeName = '"' << xNodeName << '"' if xNodeName.match( /^[a-zA-Z_]+[a-zA-Z0-9_\.]*$/ ).nil?
105
+ xNodeName = GraphViz.escape(@xNodeName)
105
106
 
106
107
  xOut = "" << xNodeName
107
108
  xAttr = ""
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-graphviz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregoire Lejeune
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-10 00:00:00 +02:00
12
+ date: 2009-10-15 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -83,6 +83,7 @@ files:
83
83
  - examples/sample20.rb
84
84
  - examples/sample21.rb
85
85
  - examples/sample22.rb
86
+ - examples/sample23.rb
86
87
  - examples/shapes.rb
87
88
  - examples/test.xml
88
89
  - examples/testorder.rb
@@ -99,7 +100,10 @@ has_rdoc: true
99
100
  homepage: http://raa.ruby-lang.org/project/ruby-graphviz/
100
101
  licenses: []
101
102
 
102
- post_install_message:
103
+ post_install_message: |+
104
+ Since version 0.9.2, Ruby/GraphViz use Open3.popen3.
105
+ On Windows, you need to install win32-open3
106
+
103
107
  rdoc_options:
104
108
  - --title
105
109
  - Ruby/GraphViz