visualize_packs 0.5.16 → 0.5.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/visualize_packs +7 -7
- data/lib/graph.dot.erb +22 -9
- data/lib/visualize_packs/options.rb +13 -10
- data/lib/visualize_packs.rb +7 -6
- 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: 13042fc696d4570039e5edbb4b1ba1f9ea710b865be44cbf0054739137f21913
|
4
|
+
data.tar.gz: 660624c8afc17b6dabfefc7969c91af2dacd6858346997220c0a0bfac3382288
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7776c8d9a0aeee1aa2bc74e1fb071f1f2e76820883e30785a879b49dc86646701b12e82d9f4cdcfec1e6585f7509ab5a2ab81eb239a12bb1bc934f153ecfce99
|
7
|
+
data.tar.gz: 4a67c4ba2efbb24f5d084d8bf19e47d56a8d08b4faf5a02238eb939987c9fdc56b0055cff10049bd7257473f4015df1d5b8f4bc27ca77c998fa3de913b376395
|
data/bin/visualize_packs
CHANGED
@@ -12,23 +12,23 @@ options = Options.new
|
|
12
12
|
OptionParser.new do |opt|
|
13
13
|
opt.on('--no-legend', "Don't show legend") { |o| options.show_legend = false }
|
14
14
|
|
15
|
+
opt.on('--no-dependency-arrows', "Don't show accepted dependency arrows") { |o| options.show_dependencies = false }
|
16
|
+
opt.on('--no-privacy-boxes', "Don't show privacy enforcement box on a pack") { |o| options.show_privacy = false }
|
15
17
|
opt.on('--no-layers', "Don't show architectural layers") { |o| options.show_layers = false }
|
16
|
-
|
17
|
-
opt.on('--no-teams', "Don't show team colors") { |o| options.show_teams = false }
|
18
|
-
|
19
|
-
opt.on('--no-dependency-arrows', "Don't show accepted dependencies") { |o| options.show_dependencies = false }
|
18
|
+
opt.on('--no-visibility-arrows', "Don't show visibility arrows") { |o| options.show_visibility = false }
|
20
19
|
|
21
20
|
opt.on('--no-todo-arrows', "Don't show pack todos") { |o| options.show_todos = false }
|
22
21
|
opt.on("--only-todo-types=", "Show only the selected types of todos. Comma-separated list of #{EdgeTodoTypes.values.map &:serialize}") { |o| options.only_todo_types = o.to_s.split(",").uniq.map { EdgeTodoTypes.deserialize(_1) } }
|
23
|
-
opt.on('--no-privacy-boxes', "Don't show privacy enforcement box on a pack") { |o| options.show_privacy = false }
|
24
22
|
|
25
|
-
opt.on('--no-
|
26
|
-
opt.on('--roll-nested-into-parent-packs', "Don't show nested packs (not counting root). Connect edges to top-level pack instead") { |o| options.roll_nested_into_parent_packs = true }
|
23
|
+
opt.on('--no-teams', "Don't show team colors") { |o| options.show_teams = false }
|
27
24
|
|
28
25
|
opt.on('--focus-pack=', "Focus on a specific pack(s). Comma-separated list of packs. Wildcards supported: 'packs/*'") { |o| options.focus_pack = o.to_s.split(",") }
|
29
26
|
opt.on('--focus-pack-edge-mode=', "If focus-pack is set, this shows only between focussed packs (when set to none) or the edges into / out of / in and out of the focus packs to non-focus packs (which will be re-added to the graph). One of #{FocusPackEdgeDirection.values.map &:serialize}") { |o| options.show_only_edges_to_focus_pack = FocusPackEdgeDirection.deserialize(o) }
|
30
27
|
opt.on('--exclude-packs=', "Exclude listed packs from diagram. If used with include you will get all included that are not excluded. Wildcards support: 'packs/ignores/*'") { |o| options.exclude_packs = o.to_s.split(",") }
|
31
28
|
|
29
|
+
opt.on('--roll-nested-into-parent-packs', "Don't show nested packs (not counting root). Connect edges to top-level pack instead") { |o| options.roll_nested_into_parent_packs = true }
|
30
|
+
opt.on('--no-nesting-arrows', "Don't draw relationships between parents and nested packs") { |o| options.show_nested_relationships = false }
|
31
|
+
|
32
32
|
opt.on('--remote-base-url=', "Link pack packs to a URL (affects graphviz SVG generation)") { |o| options.remote_base_url = o }
|
33
33
|
|
34
34
|
opt.on_tail("-h", "--help", "Show this message") do
|
data/lib/graph.dot.erb
CHANGED
@@ -33,7 +33,7 @@ digraph package_diagram {
|
|
33
33
|
<%- end -%>
|
34
34
|
<%- grouped_packages[layer_name].each do |package| -%>
|
35
35
|
"<%= package.name -%>" [
|
36
|
-
fontsize=<%= options.focus_pack
|
36
|
+
fontsize=<%= options.focus_pack && options.focus_pack.any? {|p| File.fnmatch(p, package.name)} ? 18.0 : 12.0 -%>
|
37
37
|
<%- if options.remote_base_url %>
|
38
38
|
URL="<%= options.remote_base_url %>/<%= package.name == '.' ? '' : package.name -%>"
|
39
39
|
<%- end %>
|
@@ -109,20 +109,32 @@ digraph package_diagram {
|
|
109
109
|
<%- end -%>
|
110
110
|
<%- end -%>
|
111
111
|
<%- if options.show_nested_relationships -%>
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
112
|
+
<%- all_packages.each do |package| -%>
|
113
|
+
<%- all_packages.each do |nested_package| -%>
|
114
|
+
<%- if nested_package.name.include?("#{package.name}/") && !(nested_package.name == package.name) -%>
|
115
|
+
"<%= package.name -%>" -> "<%= nested_package.name -%>" [ color=purple ]
|
116
|
+
<%- end -%>
|
117
|
+
<%- end -%>
|
118
|
+
<%- end -%>
|
119
|
+
<%- end -%>
|
120
|
+
<%- if options.show_visibility -%>
|
121
|
+
<%- all_packages.each do |package| -%>
|
122
|
+
<%- (package.config['visible_to'] || []).each do |other_package_name| -%>
|
123
|
+
"<%= package.name -%>" -> "<%= other_package_name -%>" [ color=blue constraint=false ]
|
116
124
|
<%- end -%>
|
117
125
|
<%- end -%>
|
118
126
|
<%- end -%>
|
119
|
-
<%- end -%>
|
120
127
|
<%- if options.show_legend -%>
|
121
128
|
subgraph cluster_legend {
|
122
129
|
fontsize=16
|
123
130
|
label="Edges Styles and Arrow Heads"
|
124
131
|
A [ fontsize=12 shape=box label="package"]
|
125
132
|
B [ fontsize=12 shape=box label="package"]
|
133
|
+
K [ fontsize=12 shape=box label="package"]
|
134
|
+
L [ fontsize=12 shape=box label="package"]
|
135
|
+
M [ fontsize=12 shape=box label="package"]
|
136
|
+
N [ fontsize=12 shape=box label="package"]
|
137
|
+
|
126
138
|
C [ fontsize=12 shape=box label="package"]
|
127
139
|
D [ fontsize=12 shape=box label="package"]
|
128
140
|
E [ fontsize=12 shape=box label="package"]
|
@@ -131,14 +143,15 @@ digraph package_diagram {
|
|
131
143
|
H [ fontsize=12 shape=box label="package"]
|
132
144
|
I [ fontsize=12 shape=box label="package"]
|
133
145
|
J [ fontsize=12 shape=box label="package"]
|
134
|
-
|
135
|
-
L [ fontsize=12 shape=box label="package"]
|
146
|
+
|
136
147
|
A -> B [label="accepted dependency" color=darkgreen]
|
148
|
+
K -> L [label="nested package" color=purple]
|
149
|
+
M -> N [label="visibile to" color=darkgreen]
|
150
|
+
|
137
151
|
C -> D [label="privacy todo" color=darkred style=dashed arrowhead=crow]
|
138
152
|
E -> F [label="architecture todo" color=darkred style=dashed arrowhead=invodot]
|
139
153
|
G -> H [label="visibility todo" color=darkred style=dashed arrowhead=obox]
|
140
154
|
I -> J [label="dependency todo" color=darkred style=dashed arrowhead=odot]
|
141
|
-
K -> L [label="nested package" color=purple penwidth=3]
|
142
155
|
}
|
143
156
|
<%- end -%>
|
144
157
|
<%- if options.show_teams && all_team_names != [] -%>
|
@@ -12,11 +12,11 @@ end
|
|
12
12
|
|
13
13
|
class FocusPackEdgeDirection < T::Enum
|
14
14
|
enums do
|
15
|
-
None = new
|
16
|
-
All = new
|
17
|
-
In = new
|
18
|
-
Out = new
|
19
|
-
InOut = new
|
15
|
+
None = new # don't include non-focus packs and thus show no edges to/from them
|
16
|
+
All = new # include non-focus packs and show all edges between all visible nodes
|
17
|
+
In = new # include non-focus packs and show edges that go towards focus packs (and show all edges between focus packs)
|
18
|
+
Out = new # include non-focus packs and show edges that go away from focus packs (and show all edges between focus packs)
|
19
|
+
InOut = new # include non-focus packs and show edges that go towards or away from focus packs (and show all edges between focus packs)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -24,20 +24,23 @@ class Options < T::Struct
|
|
24
24
|
extend T::Sig
|
25
25
|
|
26
26
|
prop :show_legend, T::Boolean, default: true
|
27
|
-
|
27
|
+
|
28
28
|
prop :show_dependencies, T::Boolean, default: true
|
29
|
+
prop :show_privacy, T::Boolean, default: true
|
30
|
+
prop :show_layers, T::Boolean, default: true
|
31
|
+
prop :show_visibility, T::Boolean, default: true
|
32
|
+
|
29
33
|
prop :show_todos, T::Boolean, default: true
|
30
34
|
prop :only_todo_types, T::Array[EdgeTodoTypes], default: EdgeTodoTypes.values
|
31
|
-
|
35
|
+
|
32
36
|
prop :show_teams, T::Boolean, default: true
|
33
37
|
|
34
|
-
prop :focus_pack, T::Array[String], default:
|
38
|
+
prop :focus_pack, T.nilable(T::Array[String]), default: nil
|
35
39
|
prop :show_only_edges_to_focus_pack, FocusPackEdgeDirection, default: FocusPackEdgeDirection::All
|
40
|
+
prop :exclude_packs, T::Array[String], default: []
|
36
41
|
|
37
42
|
prop :roll_nested_into_parent_packs, T::Boolean, default: false
|
38
43
|
prop :show_nested_relationships, T::Boolean, default: true
|
39
44
|
|
40
|
-
prop :exclude_packs, T::Array[String], default: []
|
41
|
-
|
42
45
|
prop :remote_base_url, T.nilable(String)
|
43
46
|
end
|
data/lib/visualize_packs.rb
CHANGED
@@ -57,8 +57,8 @@ module VisualizePacks
|
|
57
57
|
sig { params(options: Options, max_todo_count: T.nilable(Integer)).returns(String) }
|
58
58
|
def self.diagram_title(options, max_todo_count)
|
59
59
|
app_name = File.basename(Dir.pwd)
|
60
|
-
focus_edge_info = options.focus_pack
|
61
|
-
focus_info = options.focus_pack
|
60
|
+
focus_edge_info = options.focus_pack && options.show_only_edges_to_focus_pack != FocusPackEdgeDirection::All ? "showing only edges to/from focus pack" : "showing all edges between visible packs"
|
61
|
+
focus_info = options.focus_pack ? "Focus on #{limited_sentence(options.focus_pack)} (#{focus_edge_info})" : "All packs"
|
62
62
|
skipped_info =
|
63
63
|
[
|
64
64
|
options.show_legend ? nil : "hiding legend",
|
@@ -68,6 +68,7 @@ module VisualizePacks
|
|
68
68
|
EdgeTodoTypes.values.size == options.only_todo_types.size ? nil : "only #{limited_sentence(options.only_todo_types.map &:serialize)} todos",
|
69
69
|
options.show_privacy ? nil : "hiding privacy",
|
70
70
|
options.show_teams ? nil : "hiding teams",
|
71
|
+
options.show_visibility ? nil : "hiding visibility",
|
71
72
|
options.roll_nested_into_parent_packs ? "hiding nested packs" : nil,
|
72
73
|
options.show_nested_relationships ? nil : "hiding nested relationships",
|
73
74
|
options.exclude_packs.empty? ? nil : "excluding pack#{options.exclude_packs.size > 1 ? 's' : ''}: #{limited_sentence(options.exclude_packs)}",
|
@@ -173,7 +174,7 @@ module VisualizePacks
|
|
173
174
|
focus_pack = options.focus_pack
|
174
175
|
exclude_packs = options.exclude_packs
|
175
176
|
|
176
|
-
return packages unless focus_pack
|
177
|
+
return packages unless focus_pack || exclude_packs.any?
|
177
178
|
|
178
179
|
nested_packages = all_nested_packages(packages.map { |p| p.name })
|
179
180
|
|
@@ -185,7 +186,7 @@ module VisualizePacks
|
|
185
186
|
result = T.let([], T::Array[T.nilable(String)])
|
186
187
|
result = packages.map { |pack| pack.name }
|
187
188
|
|
188
|
-
if !focus_pack.empty?
|
189
|
+
if focus_pack && !focus_pack.empty?
|
189
190
|
result = []
|
190
191
|
result += packages.map { |pack| pack.name }.select { |p| match_packs?(p, focus_pack) }
|
191
192
|
if options.show_dependencies
|
@@ -299,8 +300,8 @@ module VisualizePacks
|
|
299
300
|
morphed_packages.reject { |p| nested_packages.keys.include?(p.name) }
|
300
301
|
end
|
301
302
|
|
302
|
-
sig { params(pack: String, packs_name_with_wildcards: T::Array[String]).returns(T::Boolean) }
|
303
|
+
sig { params(pack: String, packs_name_with_wildcards: T.nilable(T::Array[String])).returns(T::Boolean) }
|
303
304
|
def self.match_packs?(pack, packs_name_with_wildcards)
|
304
|
-
packs_name_with_wildcards.any? {|p| File.fnmatch(p, pack)}
|
305
|
+
!packs_name_with_wildcards || packs_name_with_wildcards.any? {|p| File.fnmatch(p, pack)}
|
305
306
|
end
|
306
307
|
end
|