visualize_packwerk 0.0.5 → 0.0.6

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: dbd24c4c7be488fb37b173c00512196884dafe06e1788bbfb9fd3161988f395b
4
- data.tar.gz: 0c4da79eef14eba7759074636a556d03f2e74a1b964b485bba0d7e090c83471b
3
+ metadata.gz: a0b2682a8a34f87cc58bd46f0896ff4a743908035942abd58c49bbd13e1d0715
4
+ data.tar.gz: '08a6f4c9bf22cf18d6951d5ca594c2fbe79222921641a98ec6c1f3646587b398'
5
5
  SHA512:
6
- metadata.gz: 38855ce47c28b248a67de636f9e530e850425b5b7823ccc3bd1f13bde14c6bacd5aa32b68b68f54244325b6c75f8050586b36e98d5c5f0f2e90265728594f854
7
- data.tar.gz: 68c24d06b1f0c9ae4d109806d0459b38a58e6d6827a07bc745fe6dafaddf17a15c359f80a9b21e495c386eac8ceeba5e8e66d40162d3ee572544c01b5fc35e10
6
+ metadata.gz: cff9630c1df4d9dc684b2dda3c76c6e7dc14e95add1d00c117b9b9f641cdb80318aac6e523cf4fe0aac434b9fc40ddd9105fd993ebc1890a63bcf5825d04a8dd
7
+ data.tar.gz: 8c8e2208ddccbf4da02c68c747341667557cfb4df311477230d120f0979e6ab2d5a2add59ca7bd0aa2cae3e98028acaae4d39af3faefcece6e7112d34d2d355f
data/README.md CHANGED
@@ -3,30 +3,25 @@
3
3
  This gem contains rake tasks to help visualize relationships between packwerk packs.
4
4
 
5
5
  # Usage
6
- ## Building a package graph for a selection of packages (owned by 5 teams max)
7
- ```
8
- bin/rails visualize_packwerk:package_relationships['packs/pack1','packs/pack2']
6
+ ## Building a package graph for a selection of packages
7
+ ```ruby
8
+ # Select the packs you want to include
9
+ selected_packs = ParsePackwerk.all
10
+ selected_packs = ParsePackwerk.all.select{|p| ['packs/my_pack_1', 'packs/my_pack_2'].include?(p.name) }
11
+ selected_packs = ParsePackwerk.all.select{|p| ['Team 1', 'Team 2'].include?(CodeOwnership.for_package(p)&.name) }
12
+ VisualizePackwerk.package_graph!(selected_packs)
9
13
  ```
10
14
 
11
- # Building a package graph for specific teams (5 teams max)
15
+ # Building a team graph for specific teams
12
16
  ```
13
- bin/rails visualize_packwerk:package_relationships_for_teams['Team1','Team2']
17
+ # Select the teams you want to include
18
+ selected_teams = CodeTeams.all
19
+ selected_teams = CodeTeams.all.select{ ... }
20
+ VisualizePackwerk.team_graph!(selected_teams)
14
21
  ```
15
22
 
16
- # Building a package graph for all packages (this is slow and produces a huge file)
17
- ```
18
- bin/rails visualize_packwerk:package_relationships
19
- ```
20
-
21
- # Building a TEAM graph for specific teams
22
- ```
23
- bin/rails visualize_packwerk:team_relationships['Team1','Team2']
24
- ```
25
-
26
- # Building a TEAM graph for all teams (this is slow and produces a huge file)
27
- ```
28
- bin/rails visualize_packwerk:team_relationships
29
- ```
23
+ ## bin/packs
24
+ For simpler use, use `bin/packs` in `use_packwerk` (https://github.com/rubyatscale/use_packwerk)
30
25
 
31
26
  # Want to change something or add a feature?
32
27
  Submit a PR or post an issue!
@@ -1,16 +1,28 @@
1
1
  # typed: strict
2
2
 
3
+ require 'parse_packwerk'
4
+ require 'code_ownership'
5
+ require 'graphviz'
6
+ require 'sorbet-runtime'
7
+
8
+ require 'visualize_packwerk/node_interface'
9
+ require 'visualize_packwerk/graph_interface'
10
+ require 'visualize_packwerk/team_node'
11
+ require 'visualize_packwerk/package_node'
12
+ require 'visualize_packwerk/team_graph'
13
+ require 'visualize_packwerk/package_graph'
14
+ require 'visualize_packwerk/package_relationships'
15
+
3
16
  module VisualizePackwerk
4
- require 'visualize_packwerk/railtie' if defined?(Rails)
5
- require 'parse_packwerk'
6
- require 'code_ownership'
7
- require 'graphviz'
17
+ extend T::Sig
18
+
19
+ sig { params(packages: T::Array[ParsePackwerk::Package]).void }
20
+ def self.package_graph!(packages)
21
+ PackageRelationships.new.create_package_graph!(packages)
22
+ end
8
23
 
9
- require 'visualize_packwerk/node_interface'
10
- require 'visualize_packwerk/graph_interface'
11
- require 'visualize_packwerk/team_node'
12
- require 'visualize_packwerk/package_node'
13
- require 'visualize_packwerk/team_graph'
14
- require 'visualize_packwerk/package_graph'
15
- require 'visualize_packwerk/package_relationships'
24
+ sig { params(teams: T::Array[CodeTeams::Team]).void }
25
+ def self.team_graph!(teams)
26
+ PackageRelationships.new.create_team_graph!(teams)
27
+ end
16
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: visualize_packwerk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusto Engineers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-08 00:00:00.000000000 Z
11
+ date: 2022-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime
@@ -150,8 +150,6 @@ files:
150
150
  - lib/visualize_packwerk/package_graph.rb
151
151
  - lib/visualize_packwerk/package_node.rb
152
152
  - lib/visualize_packwerk/package_relationships.rb
153
- - lib/visualize_packwerk/railtie.rb
154
- - lib/visualize_packwerk/tasks/visualize_packwerk.rake
155
153
  - lib/visualize_packwerk/team_graph.rb
156
154
  - lib/visualize_packwerk/team_node.rb
157
155
  - sorbet/config
@@ -1,15 +0,0 @@
1
- # typed: ignore
2
-
3
- require 'visualize_packwerk'
4
- require 'rails'
5
-
6
- module VisualizePackwerk
7
- class Railtie < Rails::Railtie
8
- railtie_name :visualize_packwerk
9
-
10
- rake_tasks do
11
- path = File.expand_path(__dir__)
12
- Dir.glob("#{path}/tasks/visualize_packwerk.rake").each { |f| load f }
13
- end
14
- end
15
- end
@@ -1,73 +0,0 @@
1
- # typed: strict
2
-
3
- module VisualizePackwerk
4
- class TaskLoader
5
- include Rake::DSL
6
- extend T::Sig
7
-
8
- sig { void }
9
- def create_tasks!
10
- namespace(:visualize_packwerk) do
11
- # This creates the array of symbols that are needed to declare an argument to a rake task
12
- package_args = (1..100).map { |i| "package#{i}".to_sym }
13
-
14
- desc('Graph packages')
15
- task(:package_relationships, package_args => :environment) do |_task, args|
16
- show_all_packs = args.to_hash.values.none?
17
- packages = if show_all_packs
18
- ParsePackwerk.all
19
- else
20
- args.to_hash.values.map do |pack_name|
21
- found_package = ParsePackwerk.all.find { |p| p.name == pack_name }
22
- if found_package.nil?
23
- abort "Could not find pack with name: #{pack_name}"
24
- end
25
-
26
- found_package
27
- end
28
- end
29
-
30
- PackageRelationships.new.create_package_graph!(packages)
31
- end
32
-
33
- # This creates the array of symbols that are needed to declare an argument to a rake task
34
- team_args = (1..5).map { |i| "team#{i}".to_sym }
35
-
36
- desc('Graph packages for teams')
37
- task(:package_relationships_for_teams, team_args => :environment) do |_task, args|
38
- teams = args.to_hash.values.map do |team_name|
39
- team = CodeTeams.find(team_name)
40
- if team.nil?
41
- abort("Could not find team with name: #{team_name}. Check your config/teams/subdirectory/team.yml for correct team spelling, e.g. `Product Infrastructure`")
42
- end
43
-
44
- team
45
- end
46
-
47
- PackageRelationships.new.create_package_graph_for_teams!(teams)
48
- end
49
-
50
- desc('Graph team relationships')
51
- task(:team_relationships, team_args => :environment) do |_task, args|
52
- show_all_teams = args.to_hash.values.none?
53
- teams = if show_all_teams
54
- CodeTeams.all
55
- else
56
- args.to_hash.values.map do |team_name|
57
- team = CodeTeams.find(team_name)
58
- if team.nil?
59
- abort("Could not find team with name: #{team_name}. Check your config/teams/subdirectory/team.yml for correct team spelling, e.g. `Product Infrastructure`")
60
- end
61
-
62
- team
63
- end
64
- end
65
-
66
- PackageRelationships.new.create_team_graph!(teams, show_all_teams: show_all_teams)
67
- end
68
- end
69
- end
70
- end
71
- end
72
-
73
- VisualizePackwerk::TaskLoader.new.create_tasks!