packs 0.0.35 → 0.0.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/packs/cli.rb +1 -1
- data/lib/packs/private.rb +8 -4
- data/lib/packs/user_event_logger.rb +5 -5
- data/lib/packs.rb +0 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0a49abad749c63c73c0bbb9cfa0ac4d75962af3c0f5b22cfb8173906f18310e
|
4
|
+
data.tar.gz: e9757c94ee7866e9ee7daaeec189166aa7a07b47baa18f93eff239552a5e94ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a74621a2a3346a352256086cb534c1ef6038beac481af3559409682ce2198c4d90e16b4d276ebe271fc93d6a9d7a2260642bf0aa2b76de22cd8bd4d9f11054a1
|
7
|
+
data.tar.gz: 93dc9e6df47b7150fd1c2ef1ddd312931b154934d83ae8060307ef17a6a146858b98b33f6961863a3c23348b0aa398f0c188098e6bdf5dc5c6c70547b97fc843
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ The rest of the [rubyatscale](https://github.com/rubyatscale) ecosystem is inten
|
|
21
21
|
Here are some example integrations with `packs`:
|
22
22
|
- [`packs-specification`](https://github.com/rubyatscale/packs-specification) is a low-dependency gem that allows your production environment to query simple information about packs
|
23
23
|
- [`packs-rails`](https://github.com/rubyatscale/packs-rails) can be used to integrate `packs` into your `rails` application
|
24
|
-
- [`rubocop-packs`](https://github.com/rubyatscale/rubocop-packs) contains cops to improve boundaries around `packs`
|
24
|
+
- [`rubocop-packs`](https://github.com/rubyatscale/rubocop-packs) contains cops to improve boundaries around `packs`
|
25
25
|
- [`packwerk`](https://github.com/Shopify/packwerk) and [`packwerk-extensions`](https://github.com/rubyatscale/packwerk-extensions) help you describe and constrain your package graph in terms of dependencies between packs and pack public API
|
26
26
|
- [`code_ownership`](https://github.com/rubyatscale/code_ownership) gives your application the capability to determine the owner of a pack
|
27
27
|
- [`pack_stats`](https://github.com/rubyatscale/pack_stats) makes it easy to send metrics about pack adoption and modularization to your favorite metrics provider, such as DataDog (which has built-in support).
|
@@ -77,7 +77,7 @@ If no pack name is passed in, this will list out violations across all packs.
|
|
77
77
|
## Make files or directories public API
|
78
78
|
`bin/packs make_public path/to/file.rb path/to/directory`
|
79
79
|
|
80
|
-
This moves a file or directory to public API (
|
80
|
+
This moves a file or directory to public API (either the `app/public` folder or the pack's specified public path).
|
81
81
|
|
82
82
|
Make sure there are no spaces between the comma-separated list of paths of directories.
|
83
83
|
|
data/lib/packs/cli.rb
CHANGED
@@ -68,7 +68,7 @@ module Packs
|
|
68
68
|
|
69
69
|
desc 'make_public path/to/file.rb path/to/directory', 'Make files or directories public API'
|
70
70
|
long_desc <<~LONG_DESC
|
71
|
-
This moves a file or directory to public API (
|
71
|
+
This moves a file or directory to public API (either the `#{ParsePackwerk::DEFAULT_PUBLIC_PATH}` folder or the pack's specified public path).
|
72
72
|
|
73
73
|
Make sure there are no spaces between the comma-separated list of paths of directories.
|
74
74
|
LONG_DESC
|
data/lib/packs/private.rb
CHANGED
@@ -348,7 +348,7 @@ module Packs
|
|
348
348
|
|
349
349
|
sig { params(package: ParsePackwerk::Package).void }
|
350
350
|
def self.add_public_directory(package)
|
351
|
-
public_directory = package.directory.join(
|
351
|
+
public_directory = package.directory.join(package.public_path)
|
352
352
|
|
353
353
|
if public_directory.glob('**/**.rb').none?
|
354
354
|
FileUtils.mkdir_p(public_directory)
|
@@ -376,8 +376,9 @@ module Packs
|
|
376
376
|
).returns(ParsePackwerk::Package)
|
377
377
|
end
|
378
378
|
def self.create_pack_if_not_exists!(pack_name:, enforce_privacy:, enforce_dependencies:, team: nil)
|
379
|
-
|
380
|
-
|
379
|
+
allowed_locations = Packs::Specification.config.pack_paths
|
380
|
+
if allowed_locations.none? { |location| File.fnmatch(location, pack_name) }
|
381
|
+
raise StandardError, "Packs only supports packages in the the following directories: #{allowed_locations}. Please make sure to pass in the name of the pack including the full directory path, e.g. `packs/my_pack`."
|
381
382
|
end
|
382
383
|
|
383
384
|
existing_package = ParsePackwerk.all.find { |p| p.name == pack_name }
|
@@ -512,7 +513,10 @@ module Packs
|
|
512
513
|
outbound: {}
|
513
514
|
}
|
514
515
|
|
516
|
+
package_by_name = {}
|
517
|
+
|
515
518
|
ParsePackwerk.all.each do |p|
|
519
|
+
package_by_name[p.name] = p
|
516
520
|
p.violations.each do |violation|
|
517
521
|
violations[:outbound][p.name] ||= []
|
518
522
|
violations[:outbound][p.name] << violation
|
@@ -557,7 +561,7 @@ module Packs
|
|
557
561
|
pack_name: pack.name,
|
558
562
|
owner: owner.nil? ? 'No one' : owner.name,
|
559
563
|
size: pack.relative_path.glob('**/*.rb').count,
|
560
|
-
public_api: pack.relative_path.join(
|
564
|
+
public_api: pack.relative_path.join(package_by_name[pack.name].public_path)
|
561
565
|
}
|
562
566
|
|
563
567
|
row.delete(:date) unless include_date
|
@@ -23,7 +23,7 @@ module Packs
|
|
23
23
|
|
24
24
|
2) Run `bin/packwerk update-todo` to update the violations. Make sure to run `spring stop` if you've added new load paths (new top-level directories) in your pack.
|
25
25
|
|
26
|
-
3) Expose public API in #{pack_name}
|
26
|
+
3) Expose public API in #{pack_name}/#{ParsePackwerk::DEFAULT_PUBLIC_PATH}. Try `bin/packs make_public #{pack_name}/path/to/file.rb`
|
27
27
|
|
28
28
|
4) Update your readme at #{pack_name}/README.md
|
29
29
|
MSG
|
@@ -45,7 +45,7 @@ module Packs
|
|
45
45
|
|
46
46
|
2) Touch base with each team who owns files involved in this move
|
47
47
|
|
48
|
-
3) Expose public API in #{pack_name}
|
48
|
+
3) Expose public API in #{pack_name}/#{ParsePackwerk::DEFAULT_PUBLIC_PATH}. Try `bin/packs make_public #{pack_name}/path/to/file.rb`
|
49
49
|
|
50
50
|
4) Update your readme at #{pack_name}/README.md
|
51
51
|
MSG
|
@@ -136,7 +136,7 @@ module Packs
|
|
136
136
|
If you're the author, please consider replacing this file with a README.md, which may contain:
|
137
137
|
- What your pack is and does
|
138
138
|
- How you expect people to use your pack
|
139
|
-
- Example usage of your pack's public API (which lives in `#{pack_name}
|
139
|
+
- Example usage of your pack's public API (which lives in `#{pack_name}/#{ParsePackwerk::DEFAULT_PUBLIC_PATH}`)
|
140
140
|
- Limitations, risks, and important considerations of usage
|
141
141
|
- How to get in touch with eng and other stakeholders for questions or issues pertaining to this pack (note: it is recommended to add ownership in `#{pack_name}/package.yml` under the `owner` metadata key)
|
142
142
|
- What SLAs/SLOs (service level agreements/objectives), if any, your package provides
|
@@ -157,7 +157,7 @@ module Packs
|
|
157
157
|
Pass in a limit to display more or less, e.g. `bin/packs list_top_violations #{type} #{pack_name} -l 1000`
|
158
158
|
|
159
159
|
This script is intended to help you find which of YOUR pack's private classes, constants, or modules other packs are using the most.
|
160
|
-
Anything not in pack_name
|
160
|
+
Anything not in pack_name/#{ParsePackwerk::DEFAULT_PUBLIC_PATH} is considered private API.
|
161
161
|
PACK_CONTENT
|
162
162
|
else
|
163
163
|
<<~PACK_CONTENT
|
@@ -165,7 +165,7 @@ module Packs
|
|
165
165
|
Pass in a limit to display more or less, e.g. `bin/packs list_top_violations #{type} #{pack_name} -l 1000`
|
166
166
|
|
167
167
|
This script is intended to help you find which of YOUR pack's private classes, constants, or modules other packs are using the most.
|
168
|
-
Anything not in #{pack_name}
|
168
|
+
Anything not in #{pack_name}/#{ParsePackwerk::DEFAULT_PUBLIC_PATH} is considered private API.
|
169
169
|
PACK_CONTENT
|
170
170
|
end
|
171
171
|
end
|
data/lib/packs.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.36
|
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-11-
|
11
|
+
date: 2023-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: code_ownership
|