visualize_packs 0.5.9 → 0.5.10
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 +2 -1
- data/lib/options.rb +1 -0
- data/lib/visualize_packs.rb +11 -6
- 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: 93422667173f599ef3700a5a98451ea6fc00ae8269544e6b66138034fc743f22
|
4
|
+
data.tar.gz: 9c238ea399cfcd9426f6de268a9b25796ac04995c39bd7ace459961a7e21d502
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 556726fd4072b0426afa6c7e65271dc06d25f159d70c44245b5058bac0543fbfde80e0cfa205046b02428b856c0ecc2926828c85eb4988f9378b2e8dce5c609b
|
7
|
+
data.tar.gz: c4d7c4fc2a64f278e9b5e6fae2afce66c1729eb47617807de29f7b6b7518ec091cb4da8a83ac6b945ecbb45b5bf2b2910e839c39c10d8dee3ab69dc817724605
|
data/bin/visualize_packs
CHANGED
@@ -39,7 +39,8 @@ 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 listed packs from diagram.
|
42
|
+
opt.on('--exclude-packs=pack1,pack2,etc', "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(",") }
|
43
|
+
opt.on('--include-packs=pack1,pack2,etc', "Include only listed packs in diagram. If used with exclude you will get all included that are not excluded. Wildcards support: 'packs/ignores/*'") { |o| options.include_packs = o.to_s.split(",") }
|
43
44
|
|
44
45
|
opt.on('--remote-base-url=PACKAGE', "Link package nodes to an URL (affects graphviz SVG generation)") { |o| options.remote_base_url = o }
|
45
46
|
|
data/lib/options.rb
CHANGED
@@ -20,6 +20,7 @@ class Options < T::Struct
|
|
20
20
|
prop :show_nested_relationships, T::Boolean, default: true
|
21
21
|
|
22
22
|
prop :exclude_packs, T::Array[String], default: []
|
23
|
+
prop :include_packs, T.nilable(T::Array[String]), default: nil
|
23
24
|
|
24
25
|
prop :remote_base_url, T.nilable(String)
|
25
26
|
end
|
data/lib/visualize_packs.rb
CHANGED
@@ -11,7 +11,7 @@ module VisualizePacks
|
|
11
11
|
def self.package_graph!(options, raw_config, packages)
|
12
12
|
raise ArgumentError, "Package #{options.focus_package} does not exist. Found packages #{packages.map(&:name).join(", ")}" if options.focus_package && !packages.map(&:name).include?(options.focus_package)
|
13
13
|
|
14
|
-
all_packages = filtered(packages, options.focus_package, options.focus_folder, options.exclude_packs).sort_by {|x| x.name }
|
14
|
+
all_packages = filtered(packages, options.focus_package, options.focus_folder, options.include_packs, options.exclude_packs).sort_by {|x| x.name }
|
15
15
|
all_package_names = all_packages.map &:name
|
16
16
|
|
17
17
|
all_packages = remove_nested_packs(all_packages) if options.roll_nested_into_parent_packs
|
@@ -67,6 +67,7 @@ module VisualizePacks
|
|
67
67
|
options.show_teams ? nil : "hiding teams",
|
68
68
|
options.roll_nested_into_parent_packs ? "hiding nested packs" : nil,
|
69
69
|
options.show_nested_relationships ? nil : "hiding nested relationships",
|
70
|
+
options.include_packs ? "including only: #{limited_sentence(options.include_packs)}" : nil,
|
70
71
|
options.exclude_packs.empty? ? nil : "excluding pack#{options.exclude_packs.size > 1 ? 's' : ''}: #{limited_sentence(options.exclude_packs)}",
|
71
72
|
].compact.join(', ').strip
|
72
73
|
main_title = "#{app_name}: #{focus_info}#{skipped_info != '' ? ' - ' + skipped_info : ''}"
|
@@ -150,8 +151,8 @@ module VisualizePacks
|
|
150
151
|
edge_width.round(2)
|
151
152
|
end
|
152
153
|
|
153
|
-
def self.filtered(packages, filter_package, filter_folder, exclude_packs)
|
154
|
-
return packages unless filter_package || filter_folder || exclude_packs.any?
|
154
|
+
def self.filtered(packages, filter_package, filter_folder, include_packs, exclude_packs)
|
155
|
+
return packages unless filter_package || filter_folder || include_packs || exclude_packs.any?
|
155
156
|
|
156
157
|
result = packages.map { |pack| pack.name }
|
157
158
|
|
@@ -168,8 +169,12 @@ module VisualizePacks
|
|
168
169
|
result = result.select { |p| p.include? filter_folder }
|
169
170
|
end
|
170
171
|
|
172
|
+
if include_packs
|
173
|
+
result = result.select { |p| match_packs?(p, include_packs) }
|
174
|
+
end
|
175
|
+
|
171
176
|
if exclude_packs.any?
|
172
|
-
result = result.reject { |p|
|
177
|
+
result = result.reject { |p| match_packs?(p, exclude_packs) }
|
173
178
|
end
|
174
179
|
|
175
180
|
result.map { |pack_name| ParsePackwerk.find(pack_name) }
|
@@ -247,7 +252,7 @@ module VisualizePacks
|
|
247
252
|
morphed_packages.reject { |p| nested_packages.keys.include?(p.name) }
|
248
253
|
end
|
249
254
|
|
250
|
-
def self.
|
251
|
-
|
255
|
+
def self.match_packs?(pack, packs)
|
256
|
+
packs.any? {|p| File.fnmatch(p, pack)}
|
252
257
|
end
|
253
258
|
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.10
|
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-
|
11
|
+
date: 2023-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|