pocky 2.6.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de11dcff9a0765101df1f14137880873958a8049
4
- data.tar.gz: 17ee8cd45457cf323bc2edc65fa97863798825ca
3
+ metadata.gz: b57fd82dd4f61236c2f397da42b99fcc7c846781
4
+ data.tar.gz: ab8764520751d80799f31e119511d48ff551b718
5
5
  SHA512:
6
- metadata.gz: 36777289020339a7899b4d830e7dea1b3d2b4c693df77c9419c9468e358cf068343a83d872ab99d41d6989c1961041c27e05d7cb8d7a25d591f0aa26fcc99f7a
7
- data.tar.gz: d68f933f49969f5c375614aea01c8f40d7802a9a90cd2fac8d8f4c789bbacf217a98c547400883baaed98f0a971b83e3bc2cf83693d23c382b76b45be5a25e93
6
+ metadata.gz: 788b55b8b0aa45b6416966024c755fd8eea2fa92be58b4fd9425ad20e2c37c4532b250f582f229247d0ee668447324d073a1fc416d3a5693f952cc37d479833b
7
+ data.tar.gz: 77bc52a31421d5aad82f2e90aff37a93ebe6c03d5869f78deca5d7611fd2b873f2dbfd37ce98ceefd87e0bf00baba6c7c7d874cb20a55b9a39048870da3bec66
data/README.md CHANGED
@@ -28,6 +28,7 @@ Pocky::Packwerk.generate(
28
28
  analyze_sizes: false, # Calculate and display package according to the size of ruby source code
29
29
  dpi: 100, # Output file resolution
30
30
  package_color: '#5CC8FF', # color name or hex color, see https://graphviz.org/doc/info/colors.html for more details
31
+ secondary_package_color: '#AAAAAA', # secondary package color when visualizing partial system.
31
32
  dependency_edge: 'darkgreen',
32
33
  deprecated_reference_edge: 'black',
33
34
  deprecated_reference_ranking: true, # Set ranking for deprecated references. Set to false to organize nodes on the same vertical level.
@@ -21,6 +21,7 @@ module Pocky
21
21
  analyze_sizes: false,
22
22
  dpi: 100,
23
23
  package_color: '#5CC8FF',
24
+ secondary_package_color: '#AAAAAA',
24
25
  dependency_edge: 'darkgreen',
25
26
  deprecated_reference_edge: 'black',
26
27
  deprecated_reference_ranking: true
@@ -32,6 +33,7 @@ module Pocky
32
33
  @filename = filename
33
34
  @analyze_sizes = analyze_sizes
34
35
  @dpi = dpi.to_i
36
+ @secondary_package_color = secondary_package_color
35
37
 
36
38
  @packages = {}
37
39
  @nodes = {}
@@ -59,6 +61,7 @@ module Pocky
59
61
  def generate
60
62
  load_dependencies
61
63
  load_deprecated_references
64
+ load_uninitialized_dependencies
62
65
  build_directed_graph
63
66
  end
64
67
 
@@ -84,13 +87,16 @@ module Pocky
84
87
  file_size = @analyze_sizes ? RubyFileSize.compute(path.to_s) : 1
85
88
  node_label = "#{package_name}#{' (Þ)' if package.enforce_privacy}"
86
89
 
87
- @graph.add_nodes(
88
- package_name,
89
- **@node_options.merge(
90
- **node_overrides(file_size),
91
- label: node_label
92
- )
90
+ node_styles = @node_options.merge(
91
+ **node_overrides(file_size),
92
+ label: node_label
93
93
  )
94
+
95
+ if @package_paths.present? && @package_paths.exclude?(package.name)
96
+ node_styles.merge!(fillcolor: @secondary_package_color)
97
+ end
98
+
99
+ @graph.add_nodes(package_name, **node_styles)
94
100
  end
95
101
 
96
102
  def build_directed_graph
@@ -178,6 +184,22 @@ module Pocky
178
184
  end
179
185
  end
180
186
 
187
+ # This must be run as the very last step of packages graph building because these won't have
188
+ # dependency filename reference.
189
+ def load_uninitialized_dependencies
190
+ return if dependencies_files.empty?
191
+
192
+ # When analyzing partial system, some packages may not be initialized as part of
193
+ # dependencies/deprecated references walk. So we take care of initializing them here
194
+ # before drawing.
195
+ dependencies_files.each do |filename|
196
+ package_name = parse_package_name(filename)
197
+ @packages[package_name].dependencies.each do |dependency|
198
+ @packages[dependency] ||= Pocky::Package.new(name: dependency)
199
+ end
200
+ end
201
+ end
202
+
181
203
  def parse_package_name(filename)
182
204
  name = File.dirname(filename).gsub(@root_path.to_s, '')
183
205
  name == '' ? '.' : name.gsub(/^\//, '')
@@ -2,7 +2,7 @@ require 'pocky'
2
2
 
3
3
  namespace :pocky do
4
4
  desc 'Generate dependency graph for packwerk packages'
5
- task :generate, [:package_path, :default_package, :filename, :analyze_sizes, :dpi, :package_color, :dependency_edge, :deprecated_reference_edge, :deprecated_reference_ranking] do |_task, args|
5
+ task :generate, [:package_path, :default_package, :filename, :analyze_sizes, :dpi, :package_color, :secondary_package_color, :dependency_edge, :deprecated_reference_edge, :deprecated_reference_ranking] do |_task, args|
6
6
  params = args.to_h
7
7
  params.merge!(package_path: args[:package_path].split(/\s+/)) if args[:package_path]
8
8
  Pocky::Packwerk.generate(params)
data/lib/pocky/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pocky
4
- VERSION = "2.6.0"
4
+ VERSION = "2.7.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pocky
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Quan Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-03 00:00:00.000000000 Z
11
+ date: 2021-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-graphviz