visualize_packs 0.5.6 → 0.5.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.
- checksums.yaml +4 -4
- data/bin/visualize_packs +1 -1
- data/lib/graph.dot.erb +1 -5
- data/lib/visualize_packs.rb +24 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a06b4d017a98eb6559d32111145f3e54eb06480591b5cbd15bea539e45dbc502
|
4
|
+
data.tar.gz: 0f462f35f53ed0c34263539ebf2bac51a97299df0cfeefaa925576d8f9e809a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 456f70ee594efe28a8628a836dc53e6a032ade6bcbdf5f86dd46b4b6a03f4574f6345b8f1510380c479243bbc428c43af5964dc542288db091e0b53686aa990c
|
7
|
+
data.tar.gz: c0fdb54da8673bb39bd63deb76b89bc72051c1a81e0bc8c7b87488bc2ac054c95ec2d961936302cc856583f23c5a435b6865ebed14b4dc00ad2b17a47a2fcd07
|
data/bin/visualize_packs
CHANGED
@@ -39,7 +39,7 @@ OptionParser.new do |opt|
|
|
39
39
|
opt.on('--focus_folder=FOLDER', "Draw package diagram only for packages in FOLDER") { |o| options.focus_folder = o }
|
40
40
|
opt.on('--no_nested_relationships', "Don't draw relationships between parents and nested packs") { |o| options.show_nested_relationships = false }
|
41
41
|
|
42
|
-
opt.on('--exclude-packs=pack1,pack2,etc', "Exclude
|
42
|
+
opt.on('--exclude-packs=pack1,pack2,etc', "Exclude listed packs from diagram. Allows filname matching style wildcards like 'packs/ignores/*'") { |o| options.exclude_packs = o.to_s.split(",") }
|
43
43
|
|
44
44
|
opt.on('--remote-base-url=PACKAGE', "Link package nodes to an URL (affects graphviz SVG generation)") { |o| options.remote_base_url = o }
|
45
45
|
|
data/lib/graph.dot.erb
CHANGED
@@ -102,11 +102,7 @@ digraph package_diagram {
|
|
102
102
|
<%- elsif todo_type == 'dependency' -%>
|
103
103
|
arrowhead=odot
|
104
104
|
<%- end -%>
|
105
|
-
|
106
|
-
max_edge_width = 10
|
107
|
-
edge_width = (todo_types[todo_type].count / max_todo_count.to_f * max_edge_width).to_i
|
108
|
-
-%>
|
109
|
-
penwidth=<%= edge_width -%>
|
105
|
+
penwidth=<%= todo_edge_width(todo_types[todo_type].count, max_todo_count) -%>
|
110
106
|
]
|
111
107
|
<%- end -%>
|
112
108
|
<%- end -%>
|
data/lib/visualize_packs.rb
CHANGED
@@ -131,6 +131,25 @@ module VisualizePacks
|
|
131
131
|
todo_counts.values.max
|
132
132
|
end
|
133
133
|
|
134
|
+
def self.todo_edge_width(todo_count, max_count)
|
135
|
+
# Limits
|
136
|
+
min_width = 1
|
137
|
+
max_width = 10
|
138
|
+
min_count = 1 # Number of todos equivalent to min_width
|
139
|
+
|
140
|
+
# Ensure safe values
|
141
|
+
return 0 if todo_count < min_count
|
142
|
+
return max_width if todo_count > max_count
|
143
|
+
|
144
|
+
todo_range = max_count - min_count
|
145
|
+
width_range = max_width - min_width
|
146
|
+
count_delta = todo_count - min_count
|
147
|
+
|
148
|
+
width_delta = count_delta / todo_range.to_f * width_range
|
149
|
+
edge_width = min_width + width_delta
|
150
|
+
edge_width.round(2)
|
151
|
+
end
|
152
|
+
|
134
153
|
def self.filtered(packages, filter_package, filter_folder, exclude_packs)
|
135
154
|
return packages unless filter_package || filter_folder || exclude_packs.any?
|
136
155
|
|
@@ -150,7 +169,7 @@ module VisualizePacks
|
|
150
169
|
end
|
151
170
|
|
152
171
|
if exclude_packs.any?
|
153
|
-
result = result.reject { |p|
|
172
|
+
result = result.reject { |p| exclude_pack?(p, exclude_packs) }
|
154
173
|
end
|
155
174
|
|
156
175
|
result.map { |pack_name| ParsePackwerk.find(pack_name) }
|
@@ -227,4 +246,8 @@ module VisualizePacks
|
|
227
246
|
|
228
247
|
morphed_packages.reject { |p| nested_packages.keys.include?(p.name) }
|
229
248
|
end
|
249
|
+
|
250
|
+
def self.exclude_pack?(pack, exclude_packs)
|
251
|
+
exclude_packs.any? {|p| File.fnmatch(p, pack)}
|
252
|
+
end
|
230
253
|
end
|