graphvizml 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 36a7038099cbb639aa78351549da5b45740b3d30
4
+ data.tar.gz: e6f574b0b36d33ec604f78defcead9dce5f957ca
5
+ SHA512:
6
+ metadata.gz: 408246236cff345342b399855e83986cbc0590410097942103f5a7f4c21dfd9e2b285d1185c22d404e0673cce9463776458d3a6ab61b0998123ac265cf248da2
7
+ data.tar.gz: f9c3e7ca0ddd3eee35963f18769e01aedc6bf6de71b2b00b91f7829b0a4e77eaa6943b3977fc89fb59a077d28a27d9f985a14e6c254a2c376b7d2d407268a2e9
checksums.yaml.gz.sig ADDED
Binary file
data/lib/graphvizml.rb ADDED
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: graphvizml.rb
4
+
5
+
6
+ require 'rexle'
7
+ require 'graphviz' # this loads the ruby-graphviz gem
8
+
9
+ class GraphVizML
10
+
11
+
12
+ def initialize(filename)
13
+
14
+ @g = GraphViz::new( "structs", "type" => "graph" )
15
+ @g[:rankdir] = "LR"
16
+ @filename = filename
17
+ @doc = Rexle.new(File.read filename)
18
+
19
+ end
20
+
21
+ def to_png(filename=@filename.sub(/\.xml$/,'.png'))
22
+
23
+ e_options = @doc.root.element 'options'
24
+ e_nodes = @doc.root.element 'nodes'
25
+ e_edges = @doc.root.element 'edges'
26
+
27
+
28
+ # set global node options
29
+
30
+ xpath_node = "records/option[summary/type='node']/records/attribute"
31
+ e_options.root.xpath(xpath_node).each do |attribute|
32
+ @g.node[attribute.text('name').to_sym] = attribute.text('value')
33
+ end
34
+
35
+ xpath_edge = "records/option[summary/type='edge']/records/attribute"
36
+ e_options.root.xpath(xpath_edge).each do |attribute|
37
+ @g.edge[attribute.text('name').to_sym] = attribute.text('value')
38
+ end
39
+
40
+ # add the nodes
41
+
42
+ e_nodes.root.xpath('records/node').each do |node|
43
+ @g.add_node(node.attribute('id').to_s).label = node.text('label') + '1'
44
+ end
45
+
46
+ # add the edges
47
+
48
+ e_edges.root.xpath('records/edge').each do |edge|
49
+ a = edge.xpath('records/node')
50
+ @g.add_edge(a[0].attribute('id').to_s,
51
+ a[1].attribute('id').to_s).label = edge.text('summary/label').to_s
52
+ end
53
+
54
+ # output the file
55
+
56
+ out_type = e_edges.root.text('summary/output_type')
57
+ out_file = e_edges.root.text('summary/output_file')
58
+ @g.output( png: filename )
59
+ end
60
+
61
+ end
data.tar.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ �1�|#�?5�D�׆�E�w�!��hcq�o�z���r ܿ������%�-���w�I�gq��"�ss�S��˚d_HbN \}Yma�����Ō���Z�� /�*@�;oɘ�6��IY�jtT�&"���.7�gs�|se|������H[�z�;��!���;�,�-�tҷfśJĆ�>F
2
+ n7�oa��Q�[s�J�3�+������"�
3
+ ����F+
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: graphvizml
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE3MDEwNjEzMjA1MloXDTE4MDEwNjEzMjA1MlowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAOTZDlwcF3nlkpgerB73R+FnQaD/dbGeRqYOfBmeTaPuzHOE2ZqqrojvEIlH
19
+ JhmEs3RP3/nIGjlmUrf6QvCnvGAgPgxnoCWw48LHcwLGefk8+M4SUOvox4T4N7gy
20
+ RQpITK88ZyDwt5mzYaLHwT4pX+LjexWBTjOI1xNhh9aiBgcuq7E32a8xgULMZk+e
21
+ Jy1cYkgf0xDyf70t0bCuxtycDXaZFE2nC1P7oQS5lyYWzltiGigltTmtoBSoblNB
22
+ tKym6PIq+Dy81m//jKffGOkd+oe5U/VNFYCaM4mXJis4VhxrR/rbcrFN75FY32wZ
23
+ Sgarov2CBapH8K6b4FZOJZT0aXECAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUULJuuHOowirVpIUB5xhE27wdZuUwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAJMxkm1N7
27
+ rWL1wFFb9c3Nw9JVsIENcQqCWiV2vv2aC4vuZtXVtz3v0AdF2LHGAWMqwoZPN3yU
28
+ kfn6c32DGznzhE800jEUfJNlHO8X8Zv2PGxrlEzbl/tlp4QdZf+I2OVSh7DHowDW
29
+ G4A0cIY16r9z6bsfKXrp+jxjYBjaeYzOLfY/RrU3TviJZubOd1ZP1y+2dO8SfRFB
30
+ HhE9S4gvHzmSNpDd/9m1HACkvLH5fAd3Cgyp3mMTKiL5p5OlrSF5O3Pc4jRGl+Rx
31
+ 0fBBWVqwHyWs77T9gCuDZmQrw2NmfyhNWhBw0iljBXo7WLDNB3x0nP6mYTzk47O8
32
+ sL5FGYJNgQqFlw==
33
+ -----END CERTIFICATE-----
34
+ date: 2017-01-06 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: rexle
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.4'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 1.4.3
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.4'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.4.3
56
+ - !ruby/object:Gem::Dependency
57
+ name: ruby-graphviz
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '1.2'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 1.2.2
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '1.2'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 1.2.2
76
+ description:
77
+ email: james@jamesrobertson.eu
78
+ executables: []
79
+ extensions: []
80
+ extra_rdoc_files: []
81
+ files:
82
+ - lib/graphvizml.rb
83
+ homepage: https://github.com/jrobertson/graphvizml
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.6.8
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: Generates a PNG file from GraphViz using a GraphViz Markup Language file
107
+ test_files: []
metadata.gz.sig ADDED
Binary file