visualize_packs 0.5.17 → 0.5.19
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 +7 -4
- data/lib/graph.dot.erb +33 -17
- data/lib/visualize_packs/options.rb +3 -0
- data/lib/visualize_packs.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21c174ca9487c1d11560c585972f1da5ff9b8ddc53148537753af82d1fb66a25
|
4
|
+
data.tar.gz: 2b910b38ad69c3df0631a98b21ec4ca6651190ab973bfc4ba4692e0f1fb7d740
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 883ddfb826a9f9051b0431d289fd98b6a92d41c41a42f4e560c0fae89a9432e741c5d9fddd2802a9eae64c9c1a6073d541f26ca8269c40d7f27b946908881088
|
7
|
+
data.tar.gz: 6136452d922cefa21486b40c18b2df6fda1838f25030d66019edfd291101dcae503777f7ecc9581ccf07d0c894f5800adc44248a18b931359d2ab2e1eb65d727
|
data/bin/visualize_packs
CHANGED
@@ -18,18 +18,21 @@ OptionParser.new do |opt|
|
|
18
18
|
opt.on('--no-visibility-arrows', "Don't show visibility arrows") { |o| options.show_visibility = false }
|
19
19
|
|
20
20
|
opt.on('--no-todo-arrows', "Don't show pack todos") { |o| options.show_todos = false }
|
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) } }
|
21
|
+
opt.on("--only-todo-types=STRING", "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) } }
|
22
|
+
opt.on("--use-todos-for-layout", "Show only the selected types of todos. Comma-separated list of #{EdgeTodoTypes.values.map &:serialize}") { |o| options.use_todos_for_layout = true }
|
22
23
|
|
23
24
|
opt.on('--no-teams', "Don't show team colors") { |o| options.show_teams = false }
|
24
25
|
|
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(",") }
|
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) }
|
26
|
+
opt.on('--focus-pack=STRING', "Focus on a specific pack(s). Comma-separated list of packs. Wildcards supported: 'packs/*'") { |o| options.focus_pack = o.to_s.split(",") }
|
27
|
+
opt.on('--focus-pack-edge-mode=STRING', "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) }
|
27
28
|
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(",") }
|
28
29
|
|
29
30
|
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
31
|
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
|
+
opt.on('--remote-base-url=STRING', "Link pack packs to a URL (affects graphviz SVG generation)") { |o| options.remote_base_url = o }
|
34
|
+
|
35
|
+
opt.on('--title=STRING', "Set a custom diagram title") { |o| options.title = o }
|
33
36
|
|
34
37
|
opt.on_tail("-h", "--help", "Show this message") do
|
35
38
|
puts opt
|
data/lib/graph.dot.erb
CHANGED
@@ -87,19 +87,19 @@ digraph package_diagram {
|
|
87
87
|
<%- todo_types = todos_by_package[todos_to_package].group_by(&:type) -%>
|
88
88
|
<%- todo_types.keys.each do |todo_type| -%>
|
89
89
|
<%- if show_edge.call(package.name, todos_to_package) -%>
|
90
|
-
"<%= package.name -%>" -> "<%= todos_to_package -%>"<%= todo_type == 'privacy' ? ':private' : '' -%> [
|
91
|
-
<%- if options.
|
90
|
+
"<%= package.name -%>" -> "<%= todos_to_package -%>"<%= todo_type == 'privacy' ? ':private' : '' -%> [
|
91
|
+
<%- if !options.use_todos_for_layout -%>
|
92
92
|
constraint=false
|
93
93
|
<%- end -%>
|
94
94
|
# headlabel="<%= todo_type -%>"
|
95
95
|
<%- if todo_type == 'privacy' -%>
|
96
|
-
|
96
|
+
<%= VisualizePacks::ArrowHead::PrivacyTodo.serialize %>
|
97
97
|
<%- elsif todo_type == 'architecture' -%>
|
98
|
-
|
98
|
+
<%= VisualizePacks::ArrowHead::ArchitectureTodo.serialize %>
|
99
99
|
<%- elsif todo_type == 'visibility' -%>
|
100
|
-
|
100
|
+
<%= VisualizePacks::ArrowHead::VisibilityTodo.serialize %>
|
101
101
|
<%- elsif todo_type == 'dependency' -%>
|
102
|
-
|
102
|
+
<%= VisualizePacks::ArrowHead::DependencyTodo.serialize %>
|
103
103
|
<%- end -%>
|
104
104
|
penwidth=<%= todo_edge_width(todo_types[todo_type].count, max_todo_count) -%>
|
105
105
|
]
|
@@ -128,30 +128,46 @@ digraph package_diagram {
|
|
128
128
|
subgraph cluster_legend {
|
129
129
|
fontsize=16
|
130
130
|
label="Edges Styles and Arrow Heads"
|
131
|
+
<%- if options.show_dependencies -%>
|
131
132
|
A [ fontsize=12 shape=box label="package"]
|
132
133
|
B [ fontsize=12 shape=box label="package"]
|
134
|
+
A -> B [label="accepted dependency" <%= VisualizePacks::ArrowHead::ConfiguredDependency.serialize %>]
|
135
|
+
<%- end -%>
|
136
|
+
<%- if options.show_nested_relationships -%>
|
133
137
|
K [ fontsize=12 shape=box label="package"]
|
134
138
|
L [ fontsize=12 shape=box label="package"]
|
139
|
+
K -> L [label="nested package" <%= VisualizePacks::ArrowHead::ConfiguredNested.serialize %>]
|
140
|
+
<%- end -%>
|
141
|
+
<%- if options.show_visibility -%>
|
135
142
|
M [ fontsize=12 shape=box label="package"]
|
136
143
|
N [ fontsize=12 shape=box label="package"]
|
137
|
-
|
144
|
+
M -> N [label="visibile to" <%= VisualizePacks::ArrowHead::ConfiguredVisibileTo.serialize %>]
|
145
|
+
<%- end -%>
|
146
|
+
<%- if options.show_todos -%>
|
147
|
+
<%- if options.only_todo_types.include?(EdgeTodoTypes::Privacy) -%>
|
138
148
|
C [ fontsize=12 shape=box label="package"]
|
139
149
|
D [ fontsize=12 shape=box label="package"]
|
150
|
+
C -> D [label="privacy todo" <%= VisualizePacks::ArrowHead::PrivacyTodo.serialize %>]
|
151
|
+
<%- end -%>
|
152
|
+
<%- if options.only_todo_types.include?(EdgeTodoTypes::Architecture) -%>
|
140
153
|
E [ fontsize=12 shape=box label="package"]
|
141
154
|
F [ fontsize=12 shape=box label="package"]
|
155
|
+
E -> F [label="architecture todo" <%= VisualizePacks::ArrowHead::ArchitectureTodo.serialize %>]
|
156
|
+
<%- end -%>
|
157
|
+
<%- if options.only_todo_types.include?(EdgeTodoTypes::Visibility) -%>
|
142
158
|
G [ fontsize=12 shape=box label="package"]
|
143
159
|
H [ fontsize=12 shape=box label="package"]
|
160
|
+
G -> H [label="visibility todo" <%= VisualizePacks::ArrowHead::VisibilityTodo.serialize %>]
|
161
|
+
<%- end -%>
|
162
|
+
<%- if options.only_todo_types.include?(EdgeTodoTypes::Dependency) -%>
|
144
163
|
I [ fontsize=12 shape=box label="package"]
|
145
164
|
J [ fontsize=12 shape=box label="package"]
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
E -> F [label="architecture todo" color=darkred style=dashed arrowhead=invodot]
|
153
|
-
G -> H [label="visibility todo" color=darkred style=dashed arrowhead=obox]
|
154
|
-
I -> J [label="dependency todo" color=darkred style=dashed arrowhead=odot]
|
165
|
+
I -> J [label="dependency todo" <%= VisualizePacks::ArrowHead::DependencyTodo.serialize %>]
|
166
|
+
<%- end -%>
|
167
|
+
<%- end -%>
|
168
|
+
LEGEND_NODE_1 [ label="" peripheries=0 height=0 width=0 style=invis ]
|
169
|
+
LEGEND_NODE_2 [ label="" peripheries=0 height=0 width=0 style=invis ]
|
170
|
+
LEGEND_NODE_1 -> LEGEND_NODE_2 [ style=invis ]
|
155
171
|
}
|
156
172
|
<%- end -%>
|
157
173
|
<%- if options.show_teams && all_team_names != [] -%>
|
@@ -172,7 +188,7 @@ digraph package_diagram {
|
|
172
188
|
<%- end -%>
|
173
189
|
}
|
174
190
|
<%- if options.show_legend -%>
|
175
|
-
|
191
|
+
LEGEND_NODE_2 -> "<%= all_team_names.last %><%= all_team_names.last %>" [style=invis]
|
176
192
|
<%- end -%>
|
177
193
|
<%- end -%>
|
178
194
|
}
|
@@ -32,6 +32,7 @@ class Options < T::Struct
|
|
32
32
|
|
33
33
|
prop :show_todos, T::Boolean, default: true
|
34
34
|
prop :only_todo_types, T::Array[EdgeTodoTypes], default: EdgeTodoTypes.values
|
35
|
+
prop :use_todos_for_layout, T::Boolean, default: false
|
35
36
|
|
36
37
|
prop :show_teams, T::Boolean, default: true
|
37
38
|
|
@@ -43,4 +44,6 @@ class Options < T::Struct
|
|
43
44
|
prop :show_nested_relationships, T::Boolean, default: true
|
44
45
|
|
45
46
|
prop :remote_base_url, T.nilable(String)
|
47
|
+
|
48
|
+
prop :title, T.nilable(String), default: nil
|
46
49
|
end
|
data/lib/visualize_packs.rb
CHANGED
@@ -11,6 +11,18 @@ require 'visualize_packs/options'
|
|
11
11
|
module VisualizePacks
|
12
12
|
extend T::Sig
|
13
13
|
|
14
|
+
class ArrowHead < T::Enum
|
15
|
+
enums do
|
16
|
+
DependencyTodo = new('color=darkred style=dashed arrowhead=odiamond')
|
17
|
+
PrivacyTodo = new('color=darkred style=dashed arrowhead=crow')
|
18
|
+
ArchitectureTodo = new('color=darkred style=dashed arrowhead=obox')
|
19
|
+
VisibilityTodo = new('color=darkred style=dashed arrowhead=tee')
|
20
|
+
ConfiguredDependency = new('color=darkgreen')
|
21
|
+
ConfiguredVisibileTo = new('color=blue')
|
22
|
+
ConfiguredNested = new('color=purple')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
14
26
|
sig { params(options: Options, raw_config: T::Hash[String, T.untyped], packages: T::Array[ParsePackwerk::Package]).returns(String) }
|
15
27
|
def self.package_graph!(options, raw_config, packages)
|
16
28
|
all_packages = filtered(packages, options).compact.sort_by {|x| x.name }
|
@@ -56,6 +68,8 @@ module VisualizePacks
|
|
56
68
|
|
57
69
|
sig { params(options: Options, max_todo_count: T.nilable(Integer)).returns(String) }
|
58
70
|
def self.diagram_title(options, max_todo_count)
|
71
|
+
return "<<b>#{options.title}</b>>" if options.title
|
72
|
+
|
59
73
|
app_name = File.basename(Dir.pwd)
|
60
74
|
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
75
|
focus_info = options.focus_pack ? "Focus on #{limited_sentence(options.focus_pack)} (#{focus_edge_info})" : "All packs"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: visualize_packs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gusto Engineers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|