visualize_packs 0.5.13 → 0.5.15

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: fd8d04886b359c5fe0ee721ba30aa63a82cf15cbbd49f4f22aae9bb122d746da
4
- data.tar.gz: f3e546e753e571226f782fe8aa2ae9cbee845c3629964cd8eedaf1527fc77f90
3
+ metadata.gz: 2a1fb5d4a88ec1f052663cae4ae4b356fddc90ad34ffef47e241a1b35d13da66
4
+ data.tar.gz: bbc12cc3b7a7fb6bbf015569f38fa7f2ba6928b0c07f6dfbe5d80551674507c8
5
5
  SHA512:
6
- metadata.gz: 23b4d5aeb2ac339bb16a731d66733b47dd4d3583adbd099064a3bcd2c2cd77d56ded62cd64128cf7e992108227f91fa32667622e461e42ed49dcee60cf16fc7d
7
- data.tar.gz: 3c07f47b89313c37d062550289ca28591a0d2a2023c7fb3f23f401a27710cad28eff6df42775108429af7193374088d0ad9c690599c64c2ad8b0352e921c076c
6
+ metadata.gz: 3124d697f0ecedc3dfc8c0d82cf5125c9886dc7691eff89ca75ba2c61ea8af05aa6ee16efe6c4b6e38c927b762cb99d7b8ae00db1f19d55fcfd94d40ede16f8b
7
+ data.tar.gz: 83a3ee2ca08dc704642a48bdf00b05e6b96f108e9c8e9034e6aa46ceb5d2a8dbda757980a65cec3cc3fa041b16fa6742a7ec3cb3034b1e18d0847388c8f1f96d
data/bin/visualize_packs CHANGED
@@ -6,7 +6,6 @@ require "optparse"
6
6
  require "ostruct"
7
7
 
8
8
  require_relative '../lib/visualize_packs'
9
- require_relative '../lib/options'
10
9
 
11
10
  options = Options.new
12
11
 
@@ -6,6 +6,8 @@ require 'packs-specification'
6
6
  require 'parse_packwerk'
7
7
  require 'digest/md5'
8
8
 
9
+ require 'visualize_packs/options'
10
+
9
11
  module VisualizePacks
10
12
  extend T::Sig
11
13
 
@@ -167,6 +169,8 @@ module VisualizePacks
167
169
  count_delta = todo_count - min_count
168
170
 
169
171
  width_delta = count_delta / todo_range.to_f * width_range
172
+ width_delta = 0 if width_delta.nan?
173
+
170
174
  edge_width = min_width + width_delta
171
175
  edge_width.round(2)
172
176
  end
@@ -193,11 +197,27 @@ module VisualizePacks
193
197
  if !focus_pack.empty?
194
198
  result = []
195
199
  result += packages.map { |pack| pack.name }.select { |p| match_packs?(p, focus_pack) }
196
- result += packages.select{ |p| p.dependencies.any? { |d| match_packs?(d, focus_pack) }}.map { |pack| pack.name }
197
- result += packages.select{ |p| p.violations&.map(&:to_package_name)&.any? { |v| match_packs?(v, focus_pack) }}.map { |pack| pack.name }
200
+ if options.show_dependencies
201
+ result += packages.select { |p| p.dependencies.any? { |d| match_packs?(d, focus_pack) }}.map { |pack| pack.name }
202
+ end
203
+ if options.show_todos && [nil, FocusPackEdgeDirection::In, FocusPackEdgeDirection::InOut].include?(options.show_only_edges_to_focus_pack)
204
+ result += packages.select do
205
+ |p| (p.violations || []).inject([]) do |res, todo|
206
+ res << todo.to_package_name if options.only_todo_types.empty? || options.only_todo_types.include?(todo.type)
207
+ res
208
+ end.any? { |v| match_packs?(v, focus_pack) }
209
+ end.map { |pack| pack.name }
210
+ end
198
211
  packages.map { |pack| pack.name }.select { |p| match_packs?(p, focus_pack) }.each do |p|
199
- result += packages_by_name[p].dependencies
200
- result += packages_by_name[p].violations.map(&:to_package_name)
212
+ if options.show_dependencies
213
+ result += packages_by_name[p].dependencies
214
+ end
215
+ if options.show_todos && [nil, FocusPackEdgeDirection::Out, FocusPackEdgeDirection::InOut].include?(options.show_only_edges_to_focus_pack)
216
+ result += (packages_by_name[p].violations || []).inject([]) do |res, todo|
217
+ res << todo.to_package_name if options.only_todo_types.empty? || options.only_todo_types.include?(todo.type)
218
+ res
219
+ end
220
+ end
201
221
  end
202
222
  result = result.uniq
203
223
  parent_packs = result.inject([]) do |res, package_name|
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.13
4
+ version: 0.5.15
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-03 00:00:00.000000000 Z
11
+ date: 2023-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -120,8 +120,8 @@ files:
120
120
  - bin/tapioca
121
121
  - bin/visualize_packs
122
122
  - lib/graph.dot.erb
123
- - lib/options.rb
124
123
  - lib/visualize_packs.rb
124
+ - lib/visualize_packs/options.rb
125
125
  homepage: https://github.com/rubyatscale/visualize_packs
126
126
  licenses:
127
127
  - MIT
File without changes