graphviz 0.3.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/graphviz.rb +21 -32
- data/{spec/graphviz/graph_spec.rb → lib/graphviz/edge.rb} +26 -22
- data/lib/graphviz/graph.rb +29 -126
- data/lib/graphviz/node.rb +111 -0
- data/lib/graphviz/version.rb +1 -2
- metadata +29 -39
- data/.gitignore +0 -17
- data/.rspec +0 -2
- data/.travis.yml +0 -17
- data/Gemfile +0 -4
- data/README.md +0 -72
- data/Rakefile +0 -6
- data/graphviz.gemspec +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 30f9b04b7b92d57ff9e1e4f68ae81c01366983bc036f672b0010ad59b7eab6f2
|
4
|
+
data.tar.gz: f7a50152baff26bd21462607ce6e79c402554b431ee8b7ed9dd73bfc1e23550c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfeb350f6a1f2f8875b9b16f7c85172a6aec3628c6fc361a405946a9faf166de55649e1d8ea31cfd4ccc12c968748354ded9815a2ef2d2c960f549612455622b
|
7
|
+
data.tar.gz: 3c5e94544debcae56ac98d17d8cc3883006fba432f912d1d3b5259f77bbd4443993720ad1e831d57ecaca8ab03864fc24ec3f70f11ff303c1255bcce89416d06
|
data/lib/graphviz.rb
CHANGED
@@ -18,54 +18,43 @@
|
|
18
18
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
require_relative "graphviz/version"
|
22
|
+
require_relative "graphviz/graph"
|
23
|
+
|
24
|
+
require 'process/pipeline'
|
23
25
|
|
24
26
|
module Graphviz
|
25
|
-
# Signals that the process exited with a non-zero status.
|
26
|
-
class OutputError < StandardError
|
27
|
-
end
|
28
|
-
|
29
27
|
# Outputs the graph using the +dot+ executable.
|
30
28
|
# @return [String] any data generated by the command unless an output path is specified.
|
31
29
|
#
|
32
|
-
# @option options [String] :
|
30
|
+
# @option options [String] :format ('pdf') The output format (e.g. pdf).
|
33
31
|
# @option options [String] :path The output path, if not specified data is returned.
|
34
32
|
# @option options [String] :dot ('dot') The +dot+ executable to use.
|
35
|
-
def self.output(graph,
|
36
|
-
|
37
|
-
|
38
|
-
output_format = options[:format]
|
33
|
+
def self.output(graph, path: nil, format: 'pdf', dot: 'dot')
|
34
|
+
output_format = format
|
39
35
|
|
40
|
-
if
|
36
|
+
if path
|
41
37
|
# Grab the output format from the file name:
|
42
|
-
if
|
38
|
+
if path =~ /\.(.*?)$/
|
43
39
|
output_format ||= $1
|
44
40
|
end
|
45
|
-
|
46
|
-
output_file = File.open(options[:path], "w")
|
47
|
-
else
|
48
|
-
output_file = IO.pipe
|
49
41
|
end
|
50
42
|
|
51
43
|
output, input = IO.pipe
|
52
|
-
|
53
|
-
|
54
|
-
output.close
|
44
|
+
pipeline = Process::Pipeline.(dot, "-T#{output_format}")
|
55
45
|
|
56
|
-
|
57
|
-
|
58
|
-
input.close
|
59
|
-
|
60
|
-
_, status = Process.wait2(pid)
|
61
|
-
|
62
|
-
if status != 0
|
63
|
-
raise OutputError.new("dot exited with status #{status}")
|
64
|
-
end
|
46
|
+
writer = Thread.new do
|
47
|
+
graph.dump_graph(input)
|
65
48
|
|
66
|
-
|
67
|
-
|
68
|
-
|
49
|
+
input.close
|
50
|
+
end
|
51
|
+
|
52
|
+
if path
|
53
|
+
pipeline.write(path, input: output)
|
54
|
+
else
|
55
|
+
return pipeline.read(input: output)
|
69
56
|
end
|
57
|
+
ensure
|
58
|
+
writer.join
|
70
59
|
end
|
71
60
|
end
|
@@ -18,31 +18,35 @@
|
|
18
18
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
|
-
require '
|
21
|
+
require 'stringio'
|
22
22
|
|
23
|
-
module Graphviz
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
describe Graphviz::Graph do
|
33
|
-
it "should construct a simple graph" do
|
34
|
-
foo = subject.add_node("Foo")
|
35
|
-
foo.add_node("Bar")
|
23
|
+
module Graphviz
|
24
|
+
# Represents a visual edge between two nodes.
|
25
|
+
class Edge
|
26
|
+
# Initialize the edge in the given graph, with a source and destination node.
|
27
|
+
# @param attributes [Hash] The associated graphviz attributes for this edge.
|
28
|
+
def initialize(graph, source, destination, attributes = {})
|
29
|
+
@graph = graph
|
30
|
+
@graph.edges << self
|
36
31
|
|
37
|
-
|
38
|
-
|
32
|
+
@source = source
|
33
|
+
@destination = destination
|
39
34
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
35
|
+
@attributes = attributes
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [Node] The source node.
|
39
|
+
attr :source
|
40
|
+
|
41
|
+
# @return [Node] The destination node.
|
42
|
+
attr :destination
|
43
|
+
|
44
|
+
# @return [Hash] Any attributes specified for this edge.
|
45
|
+
attr_accessor :attributes
|
46
|
+
|
47
|
+
# @return [String] A convenient ASCII arrow.
|
48
|
+
def to_s
|
49
|
+
"#{@source} -> #{@destination}"
|
46
50
|
end
|
47
51
|
end
|
48
52
|
end
|
data/lib/graphviz/graph.rb
CHANGED
@@ -20,118 +20,9 @@
|
|
20
20
|
|
21
21
|
require 'stringio'
|
22
22
|
|
23
|
+
require_relative 'node'
|
24
|
+
|
23
25
|
module Graphviz
|
24
|
-
# Represents a visual node in the graph, which can be connected to other nodes.
|
25
|
-
class Node
|
26
|
-
# Initialize the node in the graph with the unique name.
|
27
|
-
# @param attributes [Hash] The associated graphviz attributes for this node.
|
28
|
-
def initialize(name, graph = nil, **attributes)
|
29
|
-
@name = name
|
30
|
-
@attributes = attributes
|
31
|
-
|
32
|
-
@connections = []
|
33
|
-
|
34
|
-
graph << self if graph
|
35
|
-
end
|
36
|
-
|
37
|
-
# Attach this node to the given graph:
|
38
|
-
def attach(parent)
|
39
|
-
@graph = parent
|
40
|
-
end
|
41
|
-
|
42
|
-
# @return [String] The unique name of the node.
|
43
|
-
attr :name
|
44
|
-
|
45
|
-
# @return [Array<Edge>] Any edges connecting to other nodes.
|
46
|
-
attr :connections
|
47
|
-
|
48
|
-
# @return [Hash] Any attributes specified for this node.
|
49
|
-
attr_accessor :attributes
|
50
|
-
|
51
|
-
# Create an edge between this node and the destination with the specified options.
|
52
|
-
# @param attributes [Hash] The associated graphviz attributes for the edge.
|
53
|
-
def connect(destination, attributes = {})
|
54
|
-
edge = Edge.new(@graph, self, destination, attributes)
|
55
|
-
|
56
|
-
@connections << edge
|
57
|
-
|
58
|
-
return edge
|
59
|
-
end
|
60
|
-
|
61
|
-
# Calculate if this node is connected to another. +O(N)+ search required.
|
62
|
-
def connected?(node)
|
63
|
-
return @connections.find{|edge| edge.destination == node}
|
64
|
-
end
|
65
|
-
|
66
|
-
# Add a node and #connect to it.
|
67
|
-
# @param attributes [Hash] The associated graphviz attributes for the new node.
|
68
|
-
def add_node(name = nil, **attributes)
|
69
|
-
node = @graph.add_node(name, **attributes)
|
70
|
-
|
71
|
-
connect(node)
|
72
|
-
|
73
|
-
return node
|
74
|
-
end
|
75
|
-
|
76
|
-
def identifier
|
77
|
-
@name
|
78
|
-
end
|
79
|
-
|
80
|
-
def dump_graph(buffer, indent, options)
|
81
|
-
node_attributes_text = dump_attributes(@attributes)
|
82
|
-
node_name = dump_value(self.identifier)
|
83
|
-
|
84
|
-
buffer.puts "#{indent}#{node_name}#{node_attributes_text};"
|
85
|
-
end
|
86
|
-
|
87
|
-
# Dump the value to dot text format.
|
88
|
-
def dump_value(value)
|
89
|
-
if Symbol === value
|
90
|
-
value.to_s
|
91
|
-
else
|
92
|
-
value.inspect
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
# Dump the attributes to dot text format.
|
97
|
-
def dump_attributes(attributes)
|
98
|
-
if attributes.size > 0
|
99
|
-
"[" + attributes.collect{|(name, value)| "#{name}=#{dump_value(value)}"}.join(", ") + "]"
|
100
|
-
else
|
101
|
-
""
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
# Represents a visual edge between two nodes.
|
107
|
-
class Edge
|
108
|
-
# Initialize the edge in the given graph, with a source and destination node.
|
109
|
-
# @param attributes [Hash] The associated graphviz attributes for this edge.
|
110
|
-
def initialize(graph, source, destination, attributes = {})
|
111
|
-
@graph = graph
|
112
|
-
@graph.edges << self
|
113
|
-
|
114
|
-
@source = source
|
115
|
-
@destination = destination
|
116
|
-
|
117
|
-
@attributes = attributes
|
118
|
-
end
|
119
|
-
|
120
|
-
# @return [Node] The source node.
|
121
|
-
attr :source
|
122
|
-
|
123
|
-
# @return [Node] The destination node.
|
124
|
-
attr :destination
|
125
|
-
|
126
|
-
# @return [Hash] Any attributes specified for this edge.
|
127
|
-
attr_accessor :attributes
|
128
|
-
|
129
|
-
# @return [String] A convenient ASCII arrow.
|
130
|
-
def to_s
|
131
|
-
'->'
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
26
|
# Contains a set of nodes, edges and subgraphs.
|
136
27
|
class Graph < Node
|
137
28
|
# Initialize the graph with the specified unique name.
|
@@ -148,9 +39,6 @@ module Graphviz
|
|
148
39
|
# @return [Array<Node>] All nodes in the graph.
|
149
40
|
attr :nodes
|
150
41
|
|
151
|
-
# @return [Array<Graph>] Any subgraphs.
|
152
|
-
attr :graphs
|
153
|
-
|
154
42
|
# @return [Hash] Any associated graphviz attributes.
|
155
43
|
attr_accessor :attributes
|
156
44
|
|
@@ -158,7 +46,7 @@ module Graphviz
|
|
158
46
|
def add_node(name = nil, **attributes)
|
159
47
|
name ||= "#{@name}N#{@nodes.count}"
|
160
48
|
|
161
|
-
Node.new(name, self, attributes)
|
49
|
+
Node.new(name, self, **attributes)
|
162
50
|
end
|
163
51
|
|
164
52
|
# Add a subgraph with a given name and attributes.
|
@@ -173,6 +61,23 @@ module Graphviz
|
|
173
61
|
return subgraph
|
174
62
|
end
|
175
63
|
|
64
|
+
# Finds all nodes with a given name
|
65
|
+
#
|
66
|
+
# @param [String] node_name the name to look for
|
67
|
+
# @return [Array<Graphviz::Node>, nil] list of all found nodes or nil
|
68
|
+
def get_node(node_name)
|
69
|
+
@nodes.select{ |k, v| v.name == node_name}.values
|
70
|
+
end
|
71
|
+
|
72
|
+
# Determines if a node with a given name exists in the graph
|
73
|
+
#
|
74
|
+
# @param [String] node_name the name to look for
|
75
|
+
# @return [Boolean] if node exists in graph
|
76
|
+
def node_exists?(node_name)
|
77
|
+
@nodes.select{ |k, v| v.name == node_name}.any?
|
78
|
+
end
|
79
|
+
|
80
|
+
|
176
81
|
def << node
|
177
82
|
@nodes[node.name] = node
|
178
83
|
|
@@ -180,10 +85,10 @@ module Graphviz
|
|
180
85
|
end
|
181
86
|
|
182
87
|
# @return [String] Output the graph using the dot format.
|
183
|
-
def to_dot(options
|
88
|
+
def to_dot(**options)
|
184
89
|
buffer = StringIO.new
|
185
90
|
|
186
|
-
dump_graph(buffer,
|
91
|
+
dump_graph(buffer, **options)
|
187
92
|
|
188
93
|
return buffer.string
|
189
94
|
end
|
@@ -204,31 +109,29 @@ module Graphviz
|
|
204
109
|
end
|
205
110
|
end
|
206
111
|
|
207
|
-
def dump_edges(buffer, indent, options)
|
112
|
+
def dump_edges(buffer, indent, **options)
|
208
113
|
@edges.each do |edge|
|
209
|
-
from_name = dump_value(edge.source.identifier)
|
210
|
-
to_name = dump_value(edge.destination.identifier)
|
211
114
|
edge_attributes_text = dump_attributes(edge.attributes)
|
212
115
|
|
213
|
-
buffer.puts "#{indent}#{
|
116
|
+
buffer.puts "#{indent}#{edge}#{edge_attributes_text};"
|
214
117
|
end
|
215
118
|
end
|
216
119
|
|
217
120
|
# Dump the entire graph and all subgraphs to dot text format.
|
218
|
-
def dump_graph(buffer, indent, options)
|
121
|
+
def dump_graph(buffer, indent = "", **options)
|
219
122
|
format = graph_format(options)
|
220
123
|
|
221
124
|
buffer.puts "#{indent}#{format} #{dump_value(self.identifier)} {"
|
222
125
|
|
223
|
-
@attributes.each do |
|
126
|
+
@attributes.each do |name, value|
|
224
127
|
buffer.puts "#{indent}\t#{name}=#{dump_value(value)};"
|
225
128
|
end
|
226
129
|
|
227
|
-
@nodes.each do |
|
228
|
-
node.dump_graph(buffer, indent + "\t", options)
|
130
|
+
@nodes.each do |_name, node|
|
131
|
+
node.dump_graph(buffer, indent + "\t", **options)
|
229
132
|
end
|
230
133
|
|
231
|
-
dump_edges(buffer, indent + "\t", options)
|
134
|
+
dump_edges(buffer, indent + "\t", **options)
|
232
135
|
|
233
136
|
buffer.puts "#{indent}}"
|
234
137
|
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require_relative 'edge'
|
22
|
+
|
23
|
+
module Graphviz
|
24
|
+
# Represents a visual node in the graph, which can be connected to other nodes.
|
25
|
+
class Node
|
26
|
+
# Initialize the node in the graph with the unique name.
|
27
|
+
# @param attributes [Hash] The associated graphviz attributes for this node.
|
28
|
+
def initialize(name, graph = nil, **attributes)
|
29
|
+
@name = name
|
30
|
+
@attributes = attributes
|
31
|
+
|
32
|
+
@connections = []
|
33
|
+
|
34
|
+
# This sets up the connection between the node and the parent.
|
35
|
+
@graph = nil
|
36
|
+
graph << self if graph
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attach this node to the given graph:
|
40
|
+
def attach(parent)
|
41
|
+
@graph = parent
|
42
|
+
end
|
43
|
+
|
44
|
+
# @return [String] The unique name of the node.
|
45
|
+
attr :name
|
46
|
+
|
47
|
+
# @return [Array<Edge>] Any edges connecting to other nodes.
|
48
|
+
attr :connections
|
49
|
+
|
50
|
+
# @return [Hash] Any attributes specified for this node.
|
51
|
+
attr_accessor :attributes
|
52
|
+
|
53
|
+
# Create an edge between this node and the destination with the specified options.
|
54
|
+
# @param attributes [Hash] The associated graphviz attributes for the edge.
|
55
|
+
def connect(destination, attributes = {})
|
56
|
+
edge = Edge.new(@graph, self, destination, attributes)
|
57
|
+
|
58
|
+
@connections << edge
|
59
|
+
|
60
|
+
return edge
|
61
|
+
end
|
62
|
+
|
63
|
+
# Calculate if this node is connected to another. +O(N)+ search required.
|
64
|
+
def connected?(node)
|
65
|
+
return @connections.find{|edge| edge.destination == node}
|
66
|
+
end
|
67
|
+
|
68
|
+
# Add a node and #connect to it.
|
69
|
+
# @param attributes [Hash] The associated graphviz attributes for the new node.
|
70
|
+
def add_node(name = nil, **attributes)
|
71
|
+
node = @graph.add_node(name, **attributes)
|
72
|
+
|
73
|
+
connect(node)
|
74
|
+
|
75
|
+
return node
|
76
|
+
end
|
77
|
+
|
78
|
+
def identifier
|
79
|
+
@name
|
80
|
+
end
|
81
|
+
|
82
|
+
def dump_graph(buffer, indent, **options)
|
83
|
+
node_attributes_text = dump_attributes(@attributes)
|
84
|
+
node_name = dump_value(self.identifier)
|
85
|
+
|
86
|
+
buffer.puts "#{indent}#{node_name}#{node_attributes_text};"
|
87
|
+
end
|
88
|
+
|
89
|
+
def to_s
|
90
|
+
dump_value(@name)
|
91
|
+
end
|
92
|
+
|
93
|
+
# Dump the value to dot text format.
|
94
|
+
def dump_value(value)
|
95
|
+
if Symbol === value
|
96
|
+
value.to_s
|
97
|
+
else
|
98
|
+
value.inspect
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# Dump the attributes to dot text format.
|
103
|
+
def dump_attributes(attributes)
|
104
|
+
if attributes.size > 0
|
105
|
+
"[" + attributes.collect{|name, value| "#{name}=#{dump_value(value)}"}.join(", ") + "]"
|
106
|
+
else
|
107
|
+
""
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
data/lib/graphviz/version.rb
CHANGED
metadata
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphviz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: process-pipeline
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
|
-
type: :
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
@@ -28,68 +28,61 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: covered
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '3.6'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
69
|
-
description:
|
70
|
-
interface for generating graphs with Graphviz.\n"
|
68
|
+
version: '3.6'
|
69
|
+
description:
|
71
70
|
email:
|
72
|
-
- samuel.williams@oriontransfer.co.nz
|
73
71
|
executables: []
|
74
72
|
extensions: []
|
75
73
|
extra_rdoc_files: []
|
76
74
|
files:
|
77
|
-
- ".gitignore"
|
78
|
-
- ".rspec"
|
79
|
-
- ".travis.yml"
|
80
|
-
- Gemfile
|
81
|
-
- README.md
|
82
|
-
- Rakefile
|
83
|
-
- graphviz.gemspec
|
84
75
|
- lib/graphviz.rb
|
76
|
+
- lib/graphviz/edge.rb
|
85
77
|
- lib/graphviz/graph.rb
|
78
|
+
- lib/graphviz/node.rb
|
86
79
|
- lib/graphviz/version.rb
|
87
|
-
|
88
|
-
homepage: ''
|
80
|
+
homepage: https://github.com/ioquatix/graphviz
|
89
81
|
licenses:
|
90
82
|
- MIT
|
91
|
-
metadata:
|
92
|
-
|
83
|
+
metadata:
|
84
|
+
funding_uri: https://github.com/sponsors/ioquatix/
|
85
|
+
post_install_message:
|
93
86
|
rdoc_options: []
|
94
87
|
require_paths:
|
95
88
|
- lib
|
@@ -104,11 +97,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
97
|
- !ruby/object:Gem::Version
|
105
98
|
version: '0'
|
106
99
|
requirements: []
|
107
|
-
|
108
|
-
|
109
|
-
signing_key:
|
100
|
+
rubygems_version: 3.1.2
|
101
|
+
signing_key:
|
110
102
|
specification_version: 4
|
111
103
|
summary: A lightweight interface for generating graphs with Graphviz.
|
112
|
-
test_files:
|
113
|
-
- spec/graphviz/graph_spec.rb
|
114
|
-
has_rdoc: yard
|
104
|
+
test_files: []
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: required
|
3
|
-
before_install:
|
4
|
-
# We need GraphViz for testing:
|
5
|
-
- sudo apt-get install graphviz
|
6
|
-
rvm:
|
7
|
-
- 2.0.0
|
8
|
-
- 2.1.8
|
9
|
-
- 2.2.4
|
10
|
-
- 2.3.0
|
11
|
-
- ruby-head
|
12
|
-
- rbx-2
|
13
|
-
env: COVERAGE=true
|
14
|
-
matrix:
|
15
|
-
allow_failures:
|
16
|
-
- rvm: "rbx-2"
|
17
|
-
|
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
# Graphviz
|
2
|
-
|
3
|
-
Graphviz is a graph visualisation system. This gem is a lightweight interface for generating graphs with Graphviz.
|
4
|
-
|
5
|
-
[![Build Status](https://travis-ci.org/ioquatix/graphviz.svg)](https://travis-ci.org/ioquatix/graphviz)
|
6
|
-
[![Code Climate](https://codeclimate.com/github/ioquatix/graphviz.png)](https://codeclimate.com/github/ioquatix/graphviz)
|
7
|
-
|
8
|
-
## Installation
|
9
|
-
|
10
|
-
Add this line to your application's Gemfile:
|
11
|
-
|
12
|
-
gem 'graphviz'
|
13
|
-
|
14
|
-
And then execute:
|
15
|
-
|
16
|
-
$ bundle
|
17
|
-
|
18
|
-
Or install it yourself as:
|
19
|
-
|
20
|
-
$ gem install graphviz
|
21
|
-
|
22
|
-
## Usage
|
23
|
-
|
24
|
-
Some example code:
|
25
|
-
|
26
|
-
require 'graphviz';
|
27
|
-
|
28
|
-
g = Graphviz::Graph.new
|
29
|
-
|
30
|
-
foo = g.add_node("Foo")
|
31
|
-
foo.add_node("Bar")
|
32
|
-
|
33
|
-
foo.attributes[:shape] = 'box3d'
|
34
|
-
foo.attributes[:color] = 'red'
|
35
|
-
|
36
|
-
# Dup the dot data:
|
37
|
-
puts g.to_dot
|
38
|
-
|
39
|
-
# Process the graph to output:
|
40
|
-
Graphviz::output(g, :path => "test.pdf")
|
41
|
-
|
42
|
-
## Contributing
|
43
|
-
|
44
|
-
1. Fork it
|
45
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
46
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
47
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
48
|
-
5. Create new Pull Request
|
49
|
-
|
50
|
-
## License
|
51
|
-
|
52
|
-
Released under the MIT license.
|
53
|
-
|
54
|
-
Copyright, 2013, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
55
|
-
|
56
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
57
|
-
of this software and associated documentation files (the "Software"), to deal
|
58
|
-
in the Software without restriction, including without limitation the rights
|
59
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
60
|
-
copies of the Software, and to permit persons to whom the Software is
|
61
|
-
furnished to do so, subject to the following conditions:
|
62
|
-
|
63
|
-
The above copyright notice and this permission notice shall be included in
|
64
|
-
all copies or substantial portions of the Software.
|
65
|
-
|
66
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
67
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
68
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
69
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
70
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
71
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
72
|
-
THE SOFTWARE.
|
data/Rakefile
DELETED
data/graphviz.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'graphviz/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "graphviz"
|
8
|
-
spec.version = Graphviz::VERSION
|
9
|
-
spec.authors = ["Samuel Williams"]
|
10
|
-
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
11
|
-
spec.description = <<-EOF
|
12
|
-
Graphviz is a graph visualisation system. This gem is a lightweight interface for generating graphs with Graphviz.
|
13
|
-
EOF
|
14
|
-
spec.summary = "A lightweight interface for generating graphs with Graphviz."
|
15
|
-
spec.homepage = ""
|
16
|
-
spec.license = "MIT"
|
17
|
-
|
18
|
-
spec.files = `git ls-files`.split($/)
|
19
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
-
spec.require_paths = ["lib"]
|
22
|
-
|
23
|
-
spec.has_rdoc = 'yard'
|
24
|
-
|
25
|
-
spec.add_development_dependency "yard"
|
26
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
27
|
-
spec.add_development_dependency "rspec", "~> 3.4.0"
|
28
|
-
spec.add_development_dependency "rake"
|
29
|
-
end
|