ruby-graphviz 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +4 -0
- data/bin/dot2ruby +5 -5
- data/bin/gem2gv +18 -18
- data/bin/git2gv +20 -20
- data/bin/ruby2gv +26 -26
- data/bin/xml2gv +5 -5
- data/examples/sample06.rb +5 -5
- data/examples/sample12.rb +3 -3
- data/examples/sample13.rb +8 -8
- data/examples/sample14.rb +8 -8
- data/examples/sample15.rb +1 -1
- data/examples/sample17.rb +7 -7
- data/examples/sample19.rb +10 -10
- data/examples/sample20.rb +2 -2
- data/examples/sample21.rb +1 -1
- data/examples/sample28.rb +1 -1
- data/examples/sample31.rb +1 -1
- data/examples/sample33.rb +10 -10
- data/examples/sample34.rb +1 -1
- data/examples/sample35.rb +7 -7
- data/examples/sample36.rb +2 -2
- data/examples/sample40.rb +4 -4
- data/examples/sample44.rb +72 -72
- data/examples/sample45.rb +4 -4
- data/examples/sample48.rb +7 -7
- data/examples/sample50.rb +1 -1
- data/examples/sample52.rb +2 -2
- data/examples/sample53.rb +2 -2
- data/examples/sample54.rb +3 -3
- data/examples/sample60.rb +2 -2
- data/examples/sample61.rb +2 -2
- data/examples/sample62.rb +2 -2
- data/examples/sample99.rb +15 -15
- data/examples/theory/pert.rb +2 -2
- data/examples/theory/tests.rb +2 -2
- data/lib/graphviz.rb +140 -140
- data/lib/graphviz/attrs.rb +6 -11
- data/lib/graphviz/constants.rb +35 -35
- data/lib/graphviz/core_ext.rb +1 -1
- data/lib/graphviz/dot2ruby.rb +7 -7
- data/lib/graphviz/dsl.rb +5 -5
- data/lib/graphviz/edge.rb +13 -13
- data/lib/graphviz/elements.rb +5 -5
- data/lib/graphviz/ext.rb +1 -1
- data/lib/graphviz/family_tree.rb +15 -15
- data/lib/graphviz/family_tree/couple.rb +11 -11
- data/lib/graphviz/family_tree/generation.rb +6 -6
- data/lib/graphviz/family_tree/person.rb +13 -13
- data/lib/graphviz/graphml.rb +39 -39
- data/lib/graphviz/math/matrix.rb +23 -23
- data/lib/graphviz/node.rb +8 -8
- data/lib/graphviz/nothugly.rb +3 -3
- data/lib/graphviz/theory.rb +8 -8
- data/lib/graphviz/types.rb +3 -3
- data/lib/graphviz/types/arrow_type.rb +3 -3
- data/lib/graphviz/types/color.rb +2 -2
- data/lib/graphviz/types/color_list.rb +2 -2
- data/lib/graphviz/types/esc_string.rb +2 -2
- data/lib/graphviz/types/gv_bool.rb +3 -3
- data/lib/graphviz/types/gv_double.rb +3 -3
- data/lib/graphviz/types/html_string.rb +2 -2
- data/lib/graphviz/types/lbl_string.rb +2 -2
- data/lib/graphviz/types/rect.rb +2 -2
- data/lib/graphviz/types/spline_type.rb +9 -9
- data/lib/graphviz/utils.rb +13 -13
- data/lib/graphviz/utils/colors.rb +35 -35
- data/lib/graphviz/xml.rb +24 -24
- data/setup.rb +4 -4
- data/test/test_graph.rb +9 -9
- data/test/test_subgraph.rb +1 -1
- data/test/test_theory.rb +4 -4
- data/test/test_utils_colors.rb +4 -4
- metadata +2 -2
data/lib/graphviz/xml.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Copyright (C) 2004 - 2012 Gregoire Lejeune <gregoire.lejeune@free.fr>
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# This program is free software; you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU General Public License as published by
|
5
5
|
# the Free Software Foundation; either version 2 of the License, or
|
6
6
|
# (at your option) any later version.
|
7
|
-
#
|
7
|
+
#
|
8
8
|
# This program is distributed in the hope that it will be useful,
|
9
9
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
10
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
11
|
# GNU General Public License for more details.
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# You should have received a copy of the GNU General Public License
|
14
14
|
# along with this program; if not, write to the Free Software
|
15
15
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
@@ -19,37 +19,37 @@ require 'rexml/document'
|
|
19
19
|
|
20
20
|
class GraphViz
|
21
21
|
class XML
|
22
|
-
|
22
|
+
|
23
23
|
# The GraphViz object
|
24
24
|
attr_accessor :graph
|
25
|
-
|
26
|
-
#
|
25
|
+
|
26
|
+
#
|
27
27
|
# Generate the graph
|
28
|
-
#
|
28
|
+
#
|
29
29
|
# THIS METHOD IS DEPRECATED, PLEASE USE GraphViz::XML.graph.output
|
30
|
-
#
|
30
|
+
#
|
31
31
|
def output( *options )
|
32
32
|
warn "GraphViz::XML.output is deprecated, use GraphViz::XML.graph.output"
|
33
33
|
@graph.output( *options )
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
private
|
37
|
-
|
38
|
-
#
|
37
|
+
|
38
|
+
#
|
39
39
|
# Create a graph from a XML file
|
40
|
-
#
|
40
|
+
#
|
41
41
|
# In:
|
42
42
|
# * xml_file : XML File
|
43
43
|
# * *options : Graph options:
|
44
44
|
# * :text : show text nodes (default true)
|
45
45
|
# * :attrs : show XML attributes (default true)
|
46
|
-
#
|
46
|
+
#
|
47
47
|
def initialize( xml_file, *options )
|
48
48
|
@node_name = "00000"
|
49
49
|
@show_text = true
|
50
50
|
@show_attributes = true
|
51
51
|
|
52
|
-
if options
|
52
|
+
if options and options[0]
|
53
53
|
options[0].each do |xKey, xValue|
|
54
54
|
case xKey.to_s
|
55
55
|
when "text"
|
@@ -63,31 +63,31 @@ class GraphViz
|
|
63
63
|
end
|
64
64
|
|
65
65
|
@rexml_document = REXML::Document::new( File::new( xml_file ) )
|
66
|
-
@graph = GraphViz::new( "XML", *options )
|
66
|
+
@graph = GraphViz::new( "XML", *options )
|
67
67
|
parse_xml_node( @rexml_document.root() )
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
def parse_xml_node( xml_node ) #:nodoc:
|
71
71
|
local_node_name = @node_name.clone
|
72
72
|
@node_name.succ!
|
73
|
-
|
73
|
+
|
74
74
|
label = xml_node.name
|
75
|
-
if xml_node.has_attributes?
|
76
|
-
label = "{ " + xml_node.name
|
77
|
-
|
75
|
+
if xml_node.has_attributes? and @show_attributes
|
76
|
+
label = "{ " + xml_node.name
|
77
|
+
|
78
78
|
xml_node.attributes.each do |xName, xValue|
|
79
|
-
label << "| { #{xName} | #{xValue} } "
|
79
|
+
label << "| { #{xName} | #{xValue} } "
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
label << "}"
|
83
83
|
end
|
84
84
|
@graph.add_nodes( local_node_name, "label" => label, "color" => "blue", "shape" => "record" )
|
85
85
|
|
86
86
|
## Act: Search and add Text nodes
|
87
|
-
if xml_node.has_text?
|
87
|
+
if xml_node.has_text? and @show_text
|
88
88
|
text_node_name = local_node_name.clone
|
89
89
|
text_node_name << "111"
|
90
|
-
|
90
|
+
|
91
91
|
xText = ""
|
92
92
|
xSep = ""
|
93
93
|
xml_node.texts().each do |l|
|
data/setup.rb
CHANGED
@@ -659,7 +659,7 @@ module FileOperations
|
|
659
659
|
def ruby(*args)
|
660
660
|
command config('rubyprog'), *args
|
661
661
|
end
|
662
|
-
|
662
|
+
|
663
663
|
def make(task = nil)
|
664
664
|
command(*[config('makeprog'), task].compact)
|
665
665
|
end
|
@@ -722,7 +722,7 @@ module HookScriptAPI
|
|
722
722
|
def srcdirectory?(path)
|
723
723
|
File.dir?(srcfile(path))
|
724
724
|
end
|
725
|
-
|
725
|
+
|
726
726
|
def srcfile?(path)
|
727
727
|
File.file?(srcfile(path))
|
728
728
|
end
|
@@ -826,7 +826,7 @@ class ToplevelInstaller
|
|
826
826
|
__send__ "exec_#{task}"
|
827
827
|
end
|
828
828
|
end
|
829
|
-
|
829
|
+
|
830
830
|
def run_metaconfigs
|
831
831
|
@config.load_script "#{@ardir}/metaconfig"
|
832
832
|
end
|
@@ -1404,7 +1404,7 @@ class Installer
|
|
1404
1404
|
end
|
1405
1405
|
|
1406
1406
|
# picked up many entries from cvs-1.11.1/src/ignore.c
|
1407
|
-
JUNK_FILES = %w(
|
1407
|
+
JUNK_FILES = %w(
|
1408
1408
|
core RCSLOG tags TAGS .make.state
|
1409
1409
|
.nse_depinfo #* .#* cvslog.* ,* .del-* *.olb
|
1410
1410
|
*~ *.old *.bak *.BAK *.orig *.rej _$* *$
|
data/test/test_graph.rb
CHANGED
@@ -4,40 +4,40 @@ require 'graphviz'
|
|
4
4
|
|
5
5
|
class GraphVizTest < Test::Unit::TestCase
|
6
6
|
def setup
|
7
|
-
@graph = GraphViz::new( :G )
|
7
|
+
@graph = GraphViz::new( :G )
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_graph
|
11
11
|
assert(@graph, 'Create graph faild.')
|
12
|
-
|
12
|
+
|
13
13
|
assert_block 'Set attribut for graph faild.' do
|
14
14
|
@graph['size'] = "10,10"
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
assert_equal( "\"10,10\"", @graph['size'].to_s, 'Get attribut for graph faild.' )
|
18
|
-
|
18
|
+
|
19
19
|
assert_equal( "G", @graph.name, "Wrong graph name." )
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_node
|
23
23
|
n, m = nil, nil
|
24
|
-
|
24
|
+
|
25
25
|
assert_block 'Create node failed.' do
|
26
26
|
n = @graph.add_nodes( "n1" )
|
27
27
|
end
|
28
28
|
|
29
|
-
assert_block 'Get node failed.' do
|
29
|
+
assert_block 'Get node failed.' do
|
30
30
|
m = @graph.get_node( "n1" )
|
31
31
|
end
|
32
32
|
|
33
33
|
assert_equal( m, n, "Node corrupted when get." )
|
34
|
-
|
34
|
+
|
35
35
|
assert_equal( @graph.node_count, 1, "Wrong number of nodes" )
|
36
|
-
|
36
|
+
|
37
37
|
assert_block 'Set attribut for node faild.' do
|
38
38
|
n['label'] = "Hello\n\"world\"\\l"
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
assert_equal( "\"Hello\\n\\\"world\\\"\\l\"", n['label'].to_s, 'Get attribut for node faild.' )
|
42
42
|
end
|
43
43
|
|
data/test/test_subgraph.rb
CHANGED
data/test/test_theory.rb
CHANGED
@@ -24,7 +24,7 @@ class GraphVizTheoryTest < Test::Unit::TestCase
|
|
24
24
|
(g.c << g.f)[:weight => 2, :label => "2"]
|
25
25
|
g.d << g.e
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
@t = GraphViz::Theory.new( @g )
|
29
29
|
end
|
30
30
|
|
@@ -35,7 +35,7 @@ class GraphVizTheoryTest < Test::Unit::TestCase
|
|
35
35
|
|
36
36
|
def test_adgency_matrix
|
37
37
|
adgency = GraphViz::Math::Matrix.new([
|
38
|
-
[0,1,0,1,0,1],
|
38
|
+
[0,1,0,1,0,1],
|
39
39
|
[0,0,1,1,1,0],
|
40
40
|
[0,0,0,1,0,1],
|
41
41
|
[0,0,0,0,1,0],
|
@@ -51,7 +51,7 @@ class GraphVizTheoryTest < Test::Unit::TestCase
|
|
51
51
|
|
52
52
|
def test_incidence_matrix
|
53
53
|
incidence = GraphViz::Math::Matrix.new([
|
54
|
-
[ 1, 1, 1, 0, 0, 0, 0, 0, 0],
|
54
|
+
[ 1, 1, 1, 0, 0, 0, 0, 0, 0],
|
55
55
|
[-1, 0, 0, 1, 1, 1, 0, 0, 0],
|
56
56
|
[ 0, 0, 0,-1, 0, 0, 1, 1, 0],
|
57
57
|
[ 0,-1, 0, 0,-1, 0,-1, 0, 1],
|
@@ -73,7 +73,7 @@ class GraphVizTheoryTest < Test::Unit::TestCase
|
|
73
73
|
def test_laplacian_matrix
|
74
74
|
laplacian = GraphViz::Math::Matrix.new([
|
75
75
|
[3,-1, 0,-1, 0,-1],
|
76
|
-
[0, 4,-1,-1,-1, 0],
|
76
|
+
[0, 4,-1,-1,-1, 0],
|
77
77
|
[0, 0, 3,-1, 0,-1],
|
78
78
|
[0, 0, 0, 4,-1, 0],
|
79
79
|
[0, 0, 0, 0, 2, 0],
|
data/test/test_utils_colors.rb
CHANGED
@@ -6,7 +6,7 @@ class TypesTest < Test::Unit::TestCase
|
|
6
6
|
def setup
|
7
7
|
@brown_txt = GraphViz::Utils::Colors.name("brown")
|
8
8
|
@brown_hsv = GraphViz::Utils::Colors.hsv(0.0, 0.745454545454545, 0.647058823529412)
|
9
|
-
@brown_rgb = GraphViz::Utils::Colors.rgb("a5", "2a", "2a")
|
9
|
+
@brown_rgb = GraphViz::Utils::Colors.rgb("a5", "2a", "2a")
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_color
|
@@ -22,17 +22,17 @@ class TypesTest < Test::Unit::TestCase
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_color_by_rgb
|
25
|
-
assert_equal "a5", @brown_txt.r
|
25
|
+
assert_equal "a5", @brown_txt.r
|
26
26
|
assert_equal "2a", @brown_txt.g
|
27
27
|
assert_equal "2a", @brown_txt.b
|
28
28
|
assert_equal "#a52a2a", @brown_txt.rgba_string("#")
|
29
29
|
|
30
|
-
assert_equal "a5", @brown_hsv.r
|
30
|
+
assert_equal "a5", @brown_hsv.r
|
31
31
|
assert_equal "2a", @brown_hsv.g
|
32
32
|
assert_equal "2a", @brown_hsv.b
|
33
33
|
assert_equal "#a52a2a", @brown_hsv.rgba_string("#")
|
34
34
|
|
35
|
-
assert_equal "a5", @brown_rgb.r
|
35
|
+
assert_equal "a5", @brown_rgb.r
|
36
36
|
assert_equal "2a", @brown_rgb.g
|
37
37
|
assert_equal "2a", @brown_rgb.b
|
38
38
|
assert_equal "#a52a2a", @brown_rgb.rgba_string("#")
|
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: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|