visualize_packs 0.5.8 → 0.5.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a06b4d017a98eb6559d32111145f3e54eb06480591b5cbd15bea539e45dbc502
4
- data.tar.gz: 0f462f35f53ed0c34263539ebf2bac51a97299df0cfeefaa925576d8f9e809a7
3
+ metadata.gz: 93422667173f599ef3700a5a98451ea6fc00ae8269544e6b66138034fc743f22
4
+ data.tar.gz: 9c238ea399cfcd9426f6de268a9b25796ac04995c39bd7ace459961a7e21d502
5
5
  SHA512:
6
- metadata.gz: 456f70ee594efe28a8628a836dc53e6a032ade6bcbdf5f86dd46b4b6a03f4574f6345b8f1510380c479243bbc428c43af5964dc542288db091e0b53686aa990c
7
- data.tar.gz: c0fdb54da8673bb39bd63deb76b89bc72051c1a81e0bc8c7b87488bc2ac054c95ec2d961936302cc856583f23c5a435b6865ebed14b4dc00ad2b17a47a2fcd07
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. Allows filname matching style wildcards like 'packs/ignores/*'") { |o| options.exclude_packs = o.to_s.split(",") }
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/graph.dot.erb CHANGED
@@ -91,7 +91,9 @@ digraph package_diagram {
91
91
  <%- todo_types.keys.each do |todo_type| -%>
92
92
  <%- if show_edge.call(package.name, todos_to_package) -%>
93
93
  "<%= package.name -%>" -> "<%= todos_to_package -%>"<%= todo_type == 'privacy' ? ':private' : '' -%> [ color=darkred style=dashed
94
- constraint=false
94
+ <%- if options.show_dependencies -%>
95
+ constraint=false
96
+ <%- end -%>
95
97
  # headlabel="<%= todo_type -%>"
96
98
  <%- if todo_type == 'privacy' -%>
97
99
  arrowhead=crow
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
@@ -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| exclude_pack?(p, exclude_packs) }
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.exclude_pack?(pack, exclude_packs)
251
- exclude_packs.any? {|p| File.fnmatch(p, pack)}
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.8
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-08-29 00:00:00.000000000 Z
11
+ date: 2023-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler