visualize_packs 0.5.11 → 0.5.12
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/README.md +2 -0
- data/bin/visualize_packs +2 -2
- data/lib/graph.dot.erb +1 -1
- data/lib/options.rb +11 -3
- data/lib/visualize_packs.rb +19 -13
- 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: 8017d316d5d179efe32200f2152bb0abb1c8a3b3299ba8f777a604c07165660e
|
|
4
|
+
data.tar.gz: 5f306bd08bdc5cb70eee69ea23a9233ba03ad8d13bd7c6c75c92a39a18f3f1f6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9c0773394b6f17466e75e00c825dfcca7a1d359922988b257a08e59fb1ce76e2c373cfe968783d87f3ec8da5b9f500d53d64dcfc74946a3ac804376e22bdeb3
|
|
7
|
+
data.tar.gz: aff8ae19a21ca89a91331c2c2679fc64e15c5151e5f59a72a7dc35b7d5df72680e0627d6462ec6b5cc519098263210c60994445a563fc6aa95149be7a4d4c684
|
data/README.md
CHANGED
data/bin/visualize_packs
CHANGED
|
@@ -33,8 +33,8 @@ OptionParser.new do |opt|
|
|
|
33
33
|
opt.on('--no-teams', "Don't show team colors") { |o| options.show_teams = false }
|
|
34
34
|
|
|
35
35
|
opt.on('--focus-folder=FOLDER', "Draw package diagram only for packages in FOLDER. Matches with 'include' for partial matches") { |o| options.focus_folder = o.empty? ? nil : o }
|
|
36
|
-
opt.on('--focus-pack=pack1,pack2', "Focus on a specific package(s). Wildcards support: 'packs/*'") { |o| options.
|
|
37
|
-
opt.on('--only-edges-to-focus', "If focus is set, this shows only the edges
|
|
36
|
+
opt.on('--focus-pack=pack1,pack2', "Focus on a specific package(s). Wildcards support: 'packs/*'") { |o| options.focus_pack = o.to_s.split(",") }
|
|
37
|
+
opt.on('--only-edges-to-focus=[in,out,inout]', "If focus-pack is set, this shows only the edges into / out of / in and out of the focus node instead of all edges in the focussed graph.") { |o| options.show_only_edges_to_focus_pack = FocusPackEdgeDirection.deserialize(o) }
|
|
38
38
|
|
|
39
39
|
opt.on('--roll-nested-into-parent-packs', "Don't show nested packages (not counting root). Connect edges to top-level package instead") { |o| options.roll_nested_into_parent_packs = true }
|
|
40
40
|
opt.on('--no-nested-relationships', "Don't draw relationships between parents and nested packs") { |o| options.show_nested_relationships = false }
|
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.
|
|
36
|
+
fontsize=<%= options.focus_pack.any? && 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 %>
|
data/lib/options.rb
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
# typed: strict
|
|
3
3
|
|
|
4
|
+
class FocusPackEdgeDirection < T::Enum
|
|
5
|
+
enums do
|
|
6
|
+
In = new
|
|
7
|
+
Out = new
|
|
8
|
+
InOut = new
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
4
12
|
class Options < T::Struct
|
|
5
13
|
extend T::Sig
|
|
6
14
|
|
|
@@ -12,11 +20,11 @@ class Options < T::Struct
|
|
|
12
20
|
prop :show_privacy, T::Boolean, default: true
|
|
13
21
|
prop :show_teams, T::Boolean, default: true
|
|
14
22
|
|
|
15
|
-
prop :
|
|
16
|
-
prop :
|
|
23
|
+
prop :focus_folder, T.nilable(String)
|
|
24
|
+
prop :focus_pack, T::Array[String], default: []
|
|
25
|
+
prop :show_only_edges_to_focus_pack, T.nilable(FocusPackEdgeDirection), default: nil
|
|
17
26
|
|
|
18
27
|
prop :roll_nested_into_parent_packs, T::Boolean, default: false
|
|
19
|
-
prop :focus_folder, T.nilable(String)
|
|
20
28
|
prop :show_nested_relationships, T::Boolean, default: true
|
|
21
29
|
|
|
22
30
|
prop :exclude_packs, T::Array[String], default: []
|
data/lib/visualize_packs.rb
CHANGED
|
@@ -56,8 +56,8 @@ module VisualizePacks
|
|
|
56
56
|
sig { params(options: Options, max_todo_count: T.nilable(Integer)).returns(String) }
|
|
57
57
|
def self.diagram_title(options, max_todo_count)
|
|
58
58
|
app_name = File.basename(Dir.pwd)
|
|
59
|
-
focus_edge_info = options.
|
|
60
|
-
focus_info = options.
|
|
59
|
+
focus_edge_info = options.focus_pack.any? && options.show_only_edges_to_focus_pack ? "showing only edges to/from focus pack" : "showing all edges between visible packs"
|
|
60
|
+
focus_info = options.focus_pack.any? || options.focus_folder ? "Focus on #{[limited_sentence(options.focus_pack), options.focus_folder].compact.join(' and ')} (#{focus_edge_info})" : "All packs"
|
|
61
61
|
skipped_info =
|
|
62
62
|
[
|
|
63
63
|
options.show_legend ? nil : "hiding legend",
|
|
@@ -95,17 +95,23 @@ module VisualizePacks
|
|
|
95
95
|
def self.show_edge_builder(options, all_package_names)
|
|
96
96
|
return lambda do |start_node, end_node|
|
|
97
97
|
(
|
|
98
|
-
!options.
|
|
98
|
+
!options.show_only_edges_to_focus_pack &&
|
|
99
99
|
all_package_names.include?(start_node) &&
|
|
100
100
|
all_package_names.include?(end_node)
|
|
101
101
|
) ||
|
|
102
102
|
(
|
|
103
|
-
options.
|
|
103
|
+
options.show_only_edges_to_focus_pack &&
|
|
104
104
|
all_package_names.include?(start_node) &&
|
|
105
105
|
all_package_names.include?(end_node) &&
|
|
106
106
|
(
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
case options.show_only_edges_to_focus_pack
|
|
108
|
+
when FocusPackEdgeDirection::InOut then
|
|
109
|
+
match_packs?(start_node, options.focus_pack) || match_packs?(end_node, options.focus_pack)
|
|
110
|
+
when FocusPackEdgeDirection::In then
|
|
111
|
+
match_packs?(end_node, options.focus_pack)
|
|
112
|
+
when FocusPackEdgeDirection::Out then
|
|
113
|
+
match_packs?(start_node, options.focus_pack)
|
|
114
|
+
end
|
|
109
115
|
)
|
|
110
116
|
)
|
|
111
117
|
end
|
|
@@ -164,12 +170,12 @@ module VisualizePacks
|
|
|
164
170
|
|
|
165
171
|
sig { params(packages: T::Array[ParsePackwerk::Package], options: Options).returns(T::Array[ParsePackwerk::Package]) }
|
|
166
172
|
def self.filtered(packages, options)
|
|
167
|
-
|
|
173
|
+
focus_pack = options.focus_pack
|
|
168
174
|
focus_folder = options.focus_folder
|
|
169
175
|
include_packs = options.include_packs
|
|
170
176
|
exclude_packs = options.exclude_packs
|
|
171
177
|
|
|
172
|
-
return packages unless
|
|
178
|
+
return packages unless focus_pack.any? || focus_folder || include_packs || exclude_packs.any?
|
|
173
179
|
|
|
174
180
|
nested_packages = all_nested_packages(packages.map { |p| p.name })
|
|
175
181
|
|
|
@@ -181,12 +187,12 @@ module VisualizePacks
|
|
|
181
187
|
result = T.let([], T::Array[T.nilable(String)])
|
|
182
188
|
result = packages.map { |pack| pack.name }
|
|
183
189
|
|
|
184
|
-
if !
|
|
190
|
+
if !focus_pack.empty?
|
|
185
191
|
result = []
|
|
186
|
-
result += packages.map { |pack| pack.name }.select { |p| match_packs?(p,
|
|
187
|
-
result += packages.select{ |p| p.dependencies.any? { |d| match_packs?(d,
|
|
188
|
-
result += packages.select{ |p| p.violations&.map(&:to_package_name)&.any? { |v| match_packs?(v,
|
|
189
|
-
packages.map { |pack| pack.name }.select { |p| match_packs?(p,
|
|
192
|
+
result += packages.map { |pack| pack.name }.select { |p| match_packs?(p, focus_pack) }
|
|
193
|
+
result += packages.select{ |p| p.dependencies.any? { |d| match_packs?(d, focus_pack) }}.map { |pack| pack.name }
|
|
194
|
+
result += packages.select{ |p| p.violations&.map(&:to_package_name)&.any? { |v| match_packs?(v, focus_pack) }}.map { |pack| pack.name }
|
|
195
|
+
packages.map { |pack| pack.name }.select { |p| match_packs?(p, focus_pack) }.each do |p|
|
|
190
196
|
result += packages_by_name[p].dependencies
|
|
191
197
|
result += packages_by_name[p].violations.map(&:to_package_name)
|
|
192
198
|
end
|
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.12
|
|
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-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|