graphviz 0.2.0 → 1.2.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 +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 +71 -147
- data/lib/graphviz/node.rb +111 -0
- data/lib/graphviz/version.rb +1 -2
- metadata +53 -35
- 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: e82beddf000e7e1bfd1fd5e9a3eeb026e02fdba7aceda468b5ec12c26e474bbf
|
4
|
+
data.tar.gz: c7da9110ff71e4b9ffb02370e9a280baf43edeba0e7aa45bb61e66343a0e70ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5849efcc73015c689cfe3ac51b0e6df16900688b2b843e94a23f9fd9cf064f5d58512aa46e66c77b023958145bf360287819f7ced932c3c7c6ce00e7e46ccda5
|
7
|
+
data.tar.gz: de31e3956f41ab68056af940fcfb032c7669caa59e8eaaf61f003cc3e1f5fd2d29e5bbcfa18201629f17ceacef2c0c890a4890f8b907c35dc0cfd581bd1afa6f
|
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,196 +20,120 @@
|
|
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(graph, name, attributes = {})
|
29
|
-
@graph = graph
|
30
|
-
@graph.nodes[name] = self
|
31
|
-
|
32
|
-
@name = name
|
33
|
-
@attributes = attributes
|
34
|
-
|
35
|
-
@edges = []
|
36
|
-
end
|
37
|
-
|
38
|
-
# @return [String] The unique name of the node.
|
39
|
-
attr :name
|
40
|
-
|
41
|
-
# @return [Array<Edge>] Any edges connecting to other nodes.
|
42
|
-
attr :edges
|
43
|
-
|
44
|
-
# @return [Hash] Any attributes specified for this node.
|
45
|
-
attr_accessor :attributes
|
46
|
-
|
47
|
-
# Create an edge between this node and the destination with the specified options.
|
48
|
-
# @param attributes [Hash] The associated graphviz attributes for the edge.
|
49
|
-
def connect(destination, attributes = {})
|
50
|
-
edge = Edge.new(@graph, self, destination, attributes)
|
51
|
-
|
52
|
-
@edges << edge
|
53
|
-
|
54
|
-
return edge
|
55
|
-
end
|
56
|
-
|
57
|
-
# Calculate if this node is connected to another. +O(N)+ search required.
|
58
|
-
def connected?(node)
|
59
|
-
return @edges.find{|edge| edge.destination == node}
|
60
|
-
end
|
61
|
-
|
62
|
-
# Add a node and #connect to it.
|
63
|
-
# @param attributes [Hash] The associated graphviz attributes for the new node.
|
64
|
-
def add_node(name, attributes = {})
|
65
|
-
node = Node.new(@graph, name, attributes)
|
66
|
-
|
67
|
-
connect(node)
|
68
|
-
|
69
|
-
return node
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# Represents a visual edge between two nodes.
|
74
|
-
class Edge
|
75
|
-
# Initialize the edge in the given graph, with a source and destination node.
|
76
|
-
# @param attributes [Hash] The associated graphviz attributes for this edge.
|
77
|
-
def initialize(graph, source, destination, attributes = {})
|
78
|
-
@graph = graph
|
79
|
-
@graph.edges << self
|
80
|
-
|
81
|
-
@source = source
|
82
|
-
@destination = destination
|
83
|
-
|
84
|
-
@attributes = attributes
|
85
|
-
end
|
86
|
-
|
87
|
-
# @return [Node] The source node.
|
88
|
-
attr :source
|
89
|
-
|
90
|
-
# @return [Node] The destination node.
|
91
|
-
attr :destination
|
92
|
-
|
93
|
-
# @return [Hash] Any attributes specified for this edge.
|
94
|
-
attr_accessor :attributes
|
95
|
-
|
96
|
-
# @return [String] A convenient ASCII arrow.
|
97
|
-
def to_s
|
98
|
-
'->'
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
26
|
# Contains a set of nodes, edges and subgraphs.
|
103
|
-
class Graph
|
27
|
+
class Graph < Node
|
104
28
|
# Initialize the graph with the specified unique name.
|
105
|
-
def initialize(name = 'G',
|
106
|
-
|
29
|
+
def initialize(name = 'G', parent = nil, **attributes)
|
30
|
+
super
|
107
31
|
|
108
|
-
@nodes = {}
|
109
32
|
@edges = []
|
110
|
-
@
|
111
|
-
|
112
|
-
@parent = nil
|
113
|
-
|
114
|
-
@attributes = attributes
|
33
|
+
@nodes = {}
|
115
34
|
end
|
116
35
|
|
117
|
-
#
|
118
|
-
attr :
|
36
|
+
# All edges in the graph
|
37
|
+
attr :edges
|
119
38
|
|
120
39
|
# @return [Array<Node>] All nodes in the graph.
|
121
40
|
attr :nodes
|
122
41
|
|
123
|
-
# @return [Array<Edge>] All edges in the graph.
|
124
|
-
attr :edges
|
125
|
-
|
126
|
-
# @return [Array<Graph>] Any subgraphs.
|
127
|
-
attr :graphs
|
128
|
-
|
129
42
|
# @return [Hash] Any associated graphviz attributes.
|
130
43
|
attr_accessor :attributes
|
131
44
|
|
132
45
|
# @return [Node] Add a node to this graph.
|
133
|
-
def add_node(name, attributes
|
134
|
-
|
46
|
+
def add_node(name = nil, **attributes)
|
47
|
+
name ||= "#{@name}N#{@nodes.count}"
|
48
|
+
|
49
|
+
Node.new(name, self, **attributes)
|
135
50
|
end
|
136
51
|
|
137
52
|
# Add a subgraph with a given name and attributes.
|
138
53
|
# @return [Graph] the new graph.
|
139
|
-
def add_subgraph(name, attributes
|
140
|
-
|
54
|
+
def add_subgraph(name = nil, **attributes)
|
55
|
+
name ||= "#{@name}S#{@nodes.count}"
|
56
|
+
|
57
|
+
subgraph = Graph.new(name, self, attributes)
|
141
58
|
|
142
|
-
|
143
|
-
@graphs[name] = graph
|
59
|
+
self << subgraph
|
144
60
|
|
145
|
-
return
|
61
|
+
return subgraph
|
146
62
|
end
|
147
63
|
|
148
|
-
#
|
149
|
-
|
150
|
-
|
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
|
+
|
81
|
+
def << node
|
82
|
+
@nodes[node.name] = node
|
83
|
+
|
84
|
+
node.attach(self)
|
151
85
|
end
|
152
86
|
|
153
87
|
# @return [String] Output the graph using the dot format.
|
154
|
-
def to_dot(options
|
88
|
+
def to_dot(**options)
|
155
89
|
buffer = StringIO.new
|
156
90
|
|
157
|
-
dump_graph(buffer,
|
91
|
+
dump_graph(buffer, **options)
|
158
92
|
|
159
93
|
return buffer.string
|
160
94
|
end
|
161
95
|
|
162
|
-
|
96
|
+
def graph_format(options)
|
97
|
+
if @graph
|
98
|
+
'subgraph'
|
99
|
+
else
|
100
|
+
options[:format] || 'digraph'
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def identifier
|
105
|
+
if @attributes[:cluster]
|
106
|
+
"cluster_#{@name}"
|
107
|
+
else
|
108
|
+
super
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def dump_edges(buffer, indent, **options)
|
113
|
+
@edges.each do |edge|
|
114
|
+
edge_attributes_text = dump_attributes(edge.attributes)
|
115
|
+
|
116
|
+
buffer.puts "#{indent}#{edge}#{edge_attributes_text};"
|
117
|
+
end
|
118
|
+
end
|
163
119
|
|
164
120
|
# Dump the entire graph and all subgraphs to dot text format.
|
165
|
-
def dump_graph(buffer, indent, options)
|
166
|
-
format = options
|
121
|
+
def dump_graph(buffer, indent = "", **options)
|
122
|
+
format = graph_format(options)
|
167
123
|
|
168
|
-
buffer.puts "#{indent}#{format} #{dump_value(
|
124
|
+
buffer.puts "#{indent}#{format} #{dump_value(self.identifier)} {"
|
169
125
|
|
170
|
-
@attributes.each do |
|
126
|
+
@attributes.each do |name, value|
|
171
127
|
buffer.puts "#{indent}\t#{name}=#{dump_value(value)};"
|
172
128
|
end
|
173
129
|
|
174
|
-
@nodes.each do |
|
175
|
-
|
176
|
-
node_name = dump_value(node.name)
|
177
|
-
buffer.puts "#{indent}\t#{node_name}#{node_attributes_text};"
|
178
|
-
|
179
|
-
if node.edges.size > 0
|
180
|
-
node.edges.each do |edge|
|
181
|
-
from_name = dump_value(edge.source.name)
|
182
|
-
to_name = dump_value(edge.destination.name)
|
183
|
-
edge_attributes_text = dump_attributes(edge.attributes)
|
184
|
-
|
185
|
-
buffer.puts "#{indent}\t#{from_name} #{edge} #{to_name}#{edge_attributes_text};"
|
186
|
-
end
|
187
|
-
end
|
130
|
+
@nodes.each do |name, node|
|
131
|
+
node.dump_graph(buffer, indent + "\t", options)
|
188
132
|
end
|
189
133
|
|
190
|
-
|
191
|
-
graph.dump_graph(buffer, indent + "\t", options.merge(:format => 'subgraph'))
|
192
|
-
end
|
134
|
+
dump_edges(buffer, indent + "\t", **options)
|
193
135
|
|
194
136
|
buffer.puts "#{indent}}"
|
195
137
|
end
|
196
|
-
|
197
|
-
# Dump the value to dot text format.
|
198
|
-
def dump_value(value)
|
199
|
-
if Symbol === value
|
200
|
-
value.to_s
|
201
|
-
else
|
202
|
-
value.inspect
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
# Dump the attributes to dot text format.
|
207
|
-
def dump_attributes(attributes)
|
208
|
-
if attributes.size > 0
|
209
|
-
"[" + attributes.collect{|(name, value)| "#{name}=#{dump_value(value)}"}.join(", ") + "]"
|
210
|
-
else
|
211
|
-
""
|
212
|
-
end
|
213
|
-
end
|
214
138
|
end
|
215
139
|
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,17 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphviz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.0
|
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: 2020-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: process-pipeline
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bake-bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - ">="
|
@@ -25,35 +39,35 @@ dependencies:
|
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
42
|
+
name: bake-modernize
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- - "
|
45
|
+
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
47
|
+
version: '0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- - "
|
52
|
+
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
61
|
+
version: '0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: covered
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - ">="
|
@@ -66,30 +80,37 @@ dependencies:
|
|
66
80
|
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
|
-
|
70
|
-
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.6'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.6'
|
97
|
+
description:
|
71
98
|
email:
|
72
|
-
- samuel.williams@oriontransfer.co.nz
|
73
99
|
executables: []
|
74
100
|
extensions: []
|
75
101
|
extra_rdoc_files: []
|
76
102
|
files:
|
77
|
-
- ".gitignore"
|
78
|
-
- ".rspec"
|
79
|
-
- ".travis.yml"
|
80
|
-
- Gemfile
|
81
|
-
- README.md
|
82
|
-
- Rakefile
|
83
|
-
- graphviz.gemspec
|
84
103
|
- lib/graphviz.rb
|
104
|
+
- lib/graphviz/edge.rb
|
85
105
|
- lib/graphviz/graph.rb
|
106
|
+
- lib/graphviz/node.rb
|
86
107
|
- lib/graphviz/version.rb
|
87
|
-
|
88
|
-
homepage: ''
|
108
|
+
homepage: https://github.com/ioquatix/graphviz
|
89
109
|
licenses:
|
90
110
|
- MIT
|
91
|
-
metadata:
|
92
|
-
|
111
|
+
metadata:
|
112
|
+
funding_uri: https://github.com/sponsors/ioquatix/
|
113
|
+
post_install_message:
|
93
114
|
rdoc_options: []
|
94
115
|
require_paths:
|
95
116
|
- lib
|
@@ -104,11 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
125
|
- !ruby/object:Gem::Version
|
105
126
|
version: '0'
|
106
127
|
requirements: []
|
107
|
-
|
108
|
-
|
109
|
-
signing_key:
|
128
|
+
rubygems_version: 3.1.2
|
129
|
+
signing_key:
|
110
130
|
specification_version: 4
|
111
131
|
summary: A lightweight interface for generating graphs with Graphviz.
|
112
|
-
test_files:
|
113
|
-
- spec/graphviz/graph_spec.rb
|
114
|
-
has_rdoc: yard
|
132
|
+
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
|
-
[](https://travis-ci.org/ioquatix/graphviz)
|
6
|
-
[](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
|