dogviz 0.0.5 → 0.0.7
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 +4 -4
- data/lib/dogviz/version.rb +1 -1
- data/lib/dogviz.rb +21 -5
- data/tests/test_dogviz_graph.rb +7 -0
- data/tests/test_dogviz_graphviz_rendering.rb +41 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de9bdc91bf4606db04bb41206d705bf4f0678f62
|
4
|
+
data.tar.gz: 5053fa5daed24691e67713a7905d22a2aeac89b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89ce43e8d53a1a867ea4c82f319fe4a9d1fc4ce4bcf759fc182837f53c02734109788906f48b45072d08bb8242964df6c66396f9ff0d5ee1be1db0e8a7c3a3f1
|
7
|
+
data.tar.gz: 8f86cf0063de7a63ddf332f8e0988817b519d5362934bc37c022da966659199df62c073b060c5b6bfdc887f45f531d43228f63ce9650eae2b240dea2a797f68d
|
data/lib/dogviz/version.rb
CHANGED
data/lib/dogviz.rb
CHANGED
@@ -42,6 +42,14 @@ module Dogviz
|
|
42
42
|
@skip
|
43
43
|
end
|
44
44
|
|
45
|
+
def in_skip?
|
46
|
+
skip? || under_skip?
|
47
|
+
end
|
48
|
+
|
49
|
+
def under_skip?
|
50
|
+
ancestors.any? &:skip?
|
51
|
+
end
|
52
|
+
|
45
53
|
def under_rollup?
|
46
54
|
ancestors.any? &:rollup?
|
47
55
|
end
|
@@ -124,7 +132,7 @@ module Dogviz
|
|
124
132
|
end
|
125
133
|
|
126
134
|
def render(renderer)
|
127
|
-
do_render_node(renderer) unless in_rollup? ||
|
135
|
+
do_render_node(renderer) unless in_rollup? || in_skip?
|
128
136
|
end
|
129
137
|
|
130
138
|
def render_edges(renderer)
|
@@ -157,13 +165,13 @@ module Dogviz
|
|
157
165
|
from = from.parent
|
158
166
|
end
|
159
167
|
|
160
|
-
return if from.
|
168
|
+
return if from.in_skip?
|
161
169
|
|
162
170
|
return if from == self && from.in_rollup?
|
163
171
|
return if from == other
|
164
172
|
return if already_added_connection?(other)
|
165
173
|
|
166
|
-
if other.
|
174
|
+
if other.in_skip?
|
167
175
|
others = resolve_skipped_others other
|
168
176
|
else
|
169
177
|
others = [other]
|
@@ -184,7 +192,7 @@ module Dogviz
|
|
184
192
|
resolved = []
|
185
193
|
skipped.pointers.each {|pointer|
|
186
194
|
next_in_line = pointer[:other]
|
187
|
-
if next_in_line.
|
195
|
+
if next_in_line.in_skip?
|
188
196
|
resolved += resolve_skipped_others next_in_line
|
189
197
|
else
|
190
198
|
resolved << next_in_line
|
@@ -357,7 +365,7 @@ module Dogviz
|
|
357
365
|
def output(*args)
|
358
366
|
render
|
359
367
|
out = graph.output *args
|
360
|
-
puts "Created output: #{args.join ' '}"
|
368
|
+
puts "Created output: #{args.join ' '}" if run_from_command_line?
|
361
369
|
out
|
362
370
|
end
|
363
371
|
|
@@ -381,6 +389,10 @@ module Dogviz
|
|
381
389
|
false
|
382
390
|
end
|
383
391
|
|
392
|
+
def skip?
|
393
|
+
false
|
394
|
+
end
|
395
|
+
|
384
396
|
def register(name, thing)
|
385
397
|
@by_name.register name, thing
|
386
398
|
end
|
@@ -391,6 +403,10 @@ module Dogviz
|
|
391
403
|
now = DateTime.now
|
392
404
|
"#{now.strftime '%H:%M'} #{name} #{now.strftime '%F'}"
|
393
405
|
end
|
406
|
+
|
407
|
+
def run_from_command_line?
|
408
|
+
!ARGV.empty?
|
409
|
+
end
|
394
410
|
end
|
395
411
|
|
396
412
|
class LookupError < StandardError
|
data/tests/test_dogviz_graph.rb
CHANGED
@@ -52,6 +52,13 @@ class TestDogvizGraph < Test::Unit::TestCase
|
|
52
52
|
assert_equal(true, a.in_rollup?)
|
53
53
|
end
|
54
54
|
|
55
|
+
def test_nested_things_are_in_skip_if_under_one
|
56
|
+
g = sys.group('g').skip!
|
57
|
+
a = g.thing('a')
|
58
|
+
|
59
|
+
assert_equal(true, a.in_skip?)
|
60
|
+
end
|
61
|
+
|
55
62
|
def test_nested_things_are_in_rollup_if_rolled_up_themselves
|
56
63
|
a = sys.thing('a').rollup!
|
57
64
|
assert_equal(true, a.in_rollup?)
|
@@ -255,8 +255,8 @@ class TestDogvizGraphvizRendering < Test::Unit::TestCase
|
|
255
255
|
finish2 = sys.thing('finish2')
|
256
256
|
|
257
257
|
start.points_to(skip1).points_to(skip2)
|
258
|
-
|
259
|
-
|
258
|
+
skip2.points_to(skip3).points_to(skipX).points_to finish1
|
259
|
+
skip2.points_to(skipY).points_to finish2
|
260
260
|
|
261
261
|
skip1.skip!
|
262
262
|
skip2.skip!
|
@@ -267,12 +267,51 @@ class TestDogvizGraphvizRendering < Test::Unit::TestCase
|
|
267
267
|
assert_equal('start->finish1 start->finish2', connections)
|
268
268
|
end
|
269
269
|
|
270
|
+
def test_skip_thing_in_skipped_container
|
271
|
+
start = sys.thing('start')
|
272
|
+
g = sys.group('g')
|
273
|
+
a = g.thing('a')
|
274
|
+
finish = sys.thing('finish')
|
275
|
+
|
276
|
+
start.points_to(a).points_to(finish)
|
277
|
+
|
278
|
+
g.skip!
|
279
|
+
|
280
|
+
assert_equal('start->finish', connections)
|
281
|
+
end
|
282
|
+
|
283
|
+
def test_skip_things_in_multiple_skipped_containers
|
284
|
+
start = sys.thing('start')
|
285
|
+
g1 = sys.group('g1')
|
286
|
+
a1 = g1.thing('a1')
|
287
|
+
g2 = sys.group('g2')
|
288
|
+
a2 = g2.thing('a2')
|
289
|
+
|
290
|
+
finish = sys.thing('finish')
|
291
|
+
|
292
|
+
start.points_to(a1).points_to(a2).points_to(finish)
|
293
|
+
|
294
|
+
g1.skip!
|
295
|
+
g2.skip!
|
296
|
+
|
297
|
+
assert_equal('start->finish', connections)
|
298
|
+
end
|
299
|
+
|
270
300
|
def test_skipped_thing_will_not_be_rendered
|
271
301
|
sys.thing('a').skip!
|
272
302
|
|
273
303
|
assert_nil find('a')
|
274
304
|
end
|
275
305
|
|
306
|
+
def test_skipped_group_of_things_will_not_be_rendered
|
307
|
+
g = sys.group('g').skip!
|
308
|
+
g.thing('a')
|
309
|
+
g.thing('b')
|
310
|
+
|
311
|
+
assert_nil find('g_a')
|
312
|
+
assert_nil find('g_b')
|
313
|
+
end
|
314
|
+
|
276
315
|
def test_find_thing
|
277
316
|
sys.group('top').thing('needle')
|
278
317
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dogviz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- damned
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|