pocky 1.3.0 → 1.4.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
- SHA1:
3
- metadata.gz: fce51337b66240934ecb460959861226aafedb75
4
- data.tar.gz: 75f97f5c6c17fade8d7e70b1119256e70bddd833
2
+ SHA256:
3
+ metadata.gz: 1bd1bd4dd6b8693596464cce4a18d69e015acb74d0534bf80c0f4861dbcb3487
4
+ data.tar.gz: b04b473ba73db68dcdd62ba9e76bf8ef25d2febba6ffe9cc11d1d90946f74243
5
5
  SHA512:
6
- metadata.gz: c71ef6721a70df6cbe50e76faf256faf8021255e08406fcca9f9d1d0a22acee48c1cdf44b074db6703b183746ac5513a27620975936302f4199218511ba79b21
7
- data.tar.gz: 1a3ee14c5c8f52150ec2e46bff9208d5f82c45d3163098117904ecf4994e52ecb8f36ae1dd6e09347195266a821a603d5f6624ff64a68088eb5ce26151ba32f6
6
+ metadata.gz: b572f0aeb26942d289a15ac2d066bcdaa2908810f3cc729725f212c41598dabb33690b72da3e3deb35b7945e668d70ddccca498f00043abc25ac5a36252949cb
7
+ data.tar.gz: 29c7d372e528161abc4e3c833521860a89a4411fd2f5cb35f294df150b0c697256b38dd8ca34009be21250467b14a1600bda76fa556e0fa2bdd2d96bf8701571
data/README.md CHANGED
@@ -6,18 +6,26 @@ Pocky generates dependency graphs for your packwerk packages. The gem is named a
6
6
 
7
7
  ## Usage
8
8
 
9
+ Invoke from irb or code
9
10
  ```ruby
10
- Pocky::Graph.generate(
11
+ Pocky::Packwerk.generate(
11
12
  root_path: 'path/to/app/packages',
12
- default_package: 'The Monolith', # The default package listed as "." in deprecated_references.yml
13
- package_prefix: 'app/packages', # this is for matching package names listed in deprecated_references.yml
14
- output_filename: 'pocky-graph.png'
13
+ default_package: 'Default', # The default package listed as "." in deprecated_references.yml
14
+ package_prefix: 'app/packages', # this is for matching package names listed in deprecated_references.yml
15
+ filename: 'packwerk-viz.png', # Name of output file
16
+ dpi: 150 # Output file resolution
15
17
  )
16
18
  ```
17
19
 
18
20
  ![pocky-graph](https://user-images.githubusercontent.com/138784/103251690-a6299b80-492e-11eb-92f1-205752d850d8.png)
19
21
 
20
- Note that the the wider edges indicate more references.
22
+ Note that the the bold edges indicate heavier dependencies.
23
+
24
+ Invoke as a rake task
25
+
26
+ ```
27
+ rake pocky:generate[path/to/app/packages,Default,app/packages,packwerk-viz.png,150]
28
+ ```
21
29
 
22
30
  ## Installation
23
31
 
data/Rakefile CHANGED
@@ -3,6 +3,6 @@
3
3
  require "bundler/gem_tasks"
4
4
  require "rspec/core/rake_task"
5
5
 
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task default: :spec
6
+ spec = Gem::Specification.find_by_name 'pocky'
7
+ rakefile = "#{spec.gem_dir}/lib/pocky/Rakefile"
8
+ load rakefile
@@ -0,0 +1,4 @@
1
+ require 'pocky'
2
+
3
+ path = File.expand_path(__dir__)
4
+ Dir.glob("#{path}/tasks/**/*.rake").each { |f| import f }
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'pocky/version'
4
- require_relative 'pocky/graph'
4
+ require_relative 'pocky/packwerk'
5
5
 
6
6
  module Pocky
7
+ require 'pocky/railtie' if defined?(Rails)
7
8
  end
@@ -4,7 +4,7 @@ require 'yaml'
4
4
  require 'ruby-graphviz'
5
5
 
6
6
  module Pocky
7
- class Graph
7
+ class Packwerk
8
8
  MAX_EDGE_WIDTH = 5
9
9
 
10
10
  def self.generate(params)
@@ -16,13 +16,14 @@ module Pocky
16
16
  root_path:,
17
17
  default_package: 'Default',
18
18
  package_prefix: '',
19
- output_filename: 'pocky-graph.png'
19
+ filename: 'packwerk-viz.png',
20
+ dpi: 150
20
21
  )
21
22
  @root_path = root_path
22
23
  @default_package = default_package
23
24
  @package_prefix = package_prefix
24
25
  @output_filename = output_filename
25
-
26
+ @output_dpi = output_dpi.to_i
26
27
  @deprecated_references = {}
27
28
  @nodes = {}
28
29
  end
@@ -35,7 +36,7 @@ module Pocky
35
36
  private
36
37
 
37
38
  def build_directed_graph
38
- graph = GraphViz.new(:G, type: :digraph, dpi: 300)
39
+ graph = GraphViz.new(:G, type: :digraph, dpi: @output_dpi)
39
40
  @deprecated_references.each do |package, references|
40
41
  @nodes[package] ||= graph.add_nodes(package)
41
42
  references.each do |provider, dependencies|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pocky
4
- VERSION = "1.3.0"
4
+ VERSION = "1.4.0"
5
5
  end
@@ -0,0 +1,13 @@
1
+ require 'pocky'
2
+ require 'rails'
3
+
4
+ module Pocky
5
+ class Railtie < Rails::Railtie
6
+ railtie_name :pocky
7
+
8
+ rake_tasks do
9
+ path = File.expand_path(__dir__)
10
+ Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,8 @@
1
+ require 'pocky'
2
+
3
+ namespace :pocky do
4
+ desc 'Generate dependency graph for packwerk packages'
5
+ task :generate, [:root_path, :default_package, :package_prefix, :filename, :dpi]: :environment do |_task, args|
6
+ Pocky::Packwerk.generate(args)
7
+ end
8
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pocky
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Quan Nguyen
@@ -40,9 +40,12 @@ files:
40
40
  - Rakefile
41
41
  - bin/console
42
42
  - bin/setup
43
+ - lib/Rakefile
43
44
  - lib/pocky.rb
44
- - lib/pocky/graph.rb
45
+ - lib/pocky/packwerk.rb
45
46
  - lib/pocky/version.rb
47
+ - lib/railtie.rb
48
+ - lib/tasks/generate.rake
46
49
  - pocky.gemspec
47
50
  homepage: https://github.com/mquan/pocky
48
51
  licenses:
@@ -66,8 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
69
  - !ruby/object:Gem::Version
67
70
  version: '0'
68
71
  requirements: []
69
- rubyforge_project:
70
- rubygems_version: 2.4.5
72
+ rubygems_version: 3.1.4
71
73
  signing_key:
72
74
  specification_version: 4
73
75
  summary: A ruby gem that generates dependency graph for your packwerk packages