use_packs 0.0.18 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/use_packs/private.rb +39 -6
- data/lib/use_packs.rb +1 -14
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e5ff298c66cd0240894575bbcd27229d27370a946f59578c21f650de6fbb699
|
4
|
+
data.tar.gz: 8863e9d1fd26bbbe3fa512b06f3338e05d0de0d552febd207989d229f07f76c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa284550c2ffe844c552568ec06985b5d8bf95ebab863b7ceafbad9b28b84604eec045fc9ea56c9c0c73608507406c20eed4c1d1cd932b3c05855eb963eb7359
|
7
|
+
data.tar.gz: 8a186d4871ea6860535dba32a427d9a62c09b0bb92597d168a009d8c49def298877ac5437d7b979f9818b671ffa31dee806c738f7c7afe759734eb5d96347d44
|
data/lib/use_packs/private.rb
CHANGED
@@ -366,25 +366,25 @@ module UsePacks
|
|
366
366
|
|
367
367
|
existing_package = ParsePackwerk.all.find { |p| p.name == pack_name }
|
368
368
|
if existing_package.nil?
|
369
|
-
|
369
|
+
should_enforce_dependencies = enforce_dependencies.nil? ? UsePacks.config.enforce_dependencies : enforce_dependencies
|
370
370
|
|
371
371
|
# TODO: This should probably be `if defined?(CodeOwnership) && CodeOwnership.configured?`
|
372
372
|
# but we'll need to add an API to CodeOwnership to do this
|
373
373
|
if Pathname.new('config/code_ownership.yml').exist?
|
374
|
-
|
374
|
+
config = {
|
375
375
|
'owner' => team.nil? ? 'MyTeam' : team.name
|
376
376
|
}
|
377
377
|
else
|
378
|
-
|
378
|
+
config = {}
|
379
379
|
end
|
380
380
|
|
381
381
|
package = ParsePackwerk::Package.new(
|
382
|
-
enforce_dependencies:
|
382
|
+
enforce_dependencies: should_enforce_dependencies || false,
|
383
383
|
enforce_privacy: enforce_privacy,
|
384
384
|
dependencies: [],
|
385
|
-
metadata:
|
385
|
+
metadata: {},
|
386
386
|
name: pack_name,
|
387
|
-
config:
|
387
|
+
config: config
|
388
388
|
)
|
389
389
|
|
390
390
|
ParsePackwerk.write_package_yml!(package)
|
@@ -557,6 +557,39 @@ module UsePacks
|
|
557
557
|
end
|
558
558
|
end
|
559
559
|
|
560
|
+
sig { params(packs: T::Array[Packs::Pack]).void }
|
561
|
+
def self.lint_package_yml_files!(packs)
|
562
|
+
packs.each do |p|
|
563
|
+
packwerk_package = ParsePackwerk.find(p.name)
|
564
|
+
next if packwerk_package.nil?
|
565
|
+
|
566
|
+
new_metadata = packwerk_package.metadata
|
567
|
+
new_config = packwerk_package.config
|
568
|
+
|
569
|
+
# Move metadata owner key to top-level
|
570
|
+
existing_owner = new_config['owner'] || new_metadata.delete('owner')
|
571
|
+
new_config['owner'] = existing_owner if !existing_owner.nil?
|
572
|
+
|
573
|
+
if new_metadata.empty?
|
574
|
+
new_config.delete('metadata')
|
575
|
+
end
|
576
|
+
|
577
|
+
new_package = packwerk_package.with(
|
578
|
+
config: new_config,
|
579
|
+
metadata: new_metadata,
|
580
|
+
dependencies: packwerk_package.dependencies.uniq.sort
|
581
|
+
)
|
582
|
+
|
583
|
+
ParsePackwerk.write_package_yml!(new_package)
|
584
|
+
end
|
585
|
+
end
|
586
|
+
|
587
|
+
sig { params(config: T::Hash[T.anything, T.anything]).returns(T::Hash[T.anything, T.anything]) }
|
588
|
+
def self.sort_keys(config)
|
589
|
+
sort_order = ParsePackwerk.key_sort_order
|
590
|
+
config.to_a.sort_by { |key, _value| T.unsafe(sort_order).index(key) }.to_h
|
591
|
+
end
|
592
|
+
|
560
593
|
sig { params(packs: T::Array[Packs::Pack]).void }
|
561
594
|
def self.visualize(packs: Packs.all)
|
562
595
|
packwerk_packages = packs.map do |pack|
|
data/lib/use_packs.rb
CHANGED
@@ -253,19 +253,6 @@ module UsePacks
|
|
253
253
|
|
254
254
|
sig { params(packs: T::Array[Packs::Pack]).void }
|
255
255
|
def self.lint_package_yml_files!(packs)
|
256
|
-
packs
|
257
|
-
packwerk_package = ParsePackwerk.find(p.name)
|
258
|
-
next if packwerk_package.nil?
|
259
|
-
|
260
|
-
new_package = ParsePackwerk::Package.new(
|
261
|
-
name: packwerk_package.name,
|
262
|
-
enforce_privacy: packwerk_package.enforce_privacy,
|
263
|
-
enforce_dependencies: packwerk_package.enforce_dependencies,
|
264
|
-
dependencies: packwerk_package.dependencies.uniq.sort,
|
265
|
-
metadata: packwerk_package.metadata,
|
266
|
-
config: packwerk_package.config
|
267
|
-
)
|
268
|
-
ParsePackwerk.write_package_yml!(new_package)
|
269
|
-
end
|
256
|
+
Private.lint_package_yml_files!(packs)
|
270
257
|
end
|
271
258
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: use_packs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
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
|
+
date: 2023-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: code_ownership
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.33.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.33.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: colorize
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|