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 +4 -4
- data/README.md +1 -0
- data/lib/pocky/packwerk.rb +28 -6
- data/lib/pocky/tasks/generate.rake +1 -1
- data/lib/pocky/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b57fd82dd4f61236c2f397da42b99fcc7c846781
|
4
|
+
data.tar.gz: ab8764520751d80799f31e119511d48ff551b718
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
data/lib/pocky/packwerk.rb
CHANGED
@@ -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
|
-
@
|
88
|
-
|
89
|
-
|
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
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.
|
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-
|
11
|
+
date: 2021-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-graphviz
|