packwerk-extensions 0.0.7 → 0.0.8

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
2
  SHA256:
3
- metadata.gz: 558107be67a748dfb9a175b9d90be2acc373913f36a66c5bccbb3401e80cd85f
4
- data.tar.gz: fb98b8c64bb3043d267aab3d966d404934a5a530020dc18e3e599a13153fe121
3
+ metadata.gz: 661762b44e28e84ff3b70007bc039b6f767ddf638524f5a069a832e1f0d2fb34
4
+ data.tar.gz: a229b9432f95c10b211a411fee200e48721ff8d3c6b3fd1b745f8211cf58038a
5
5
  SHA512:
6
- metadata.gz: e6beb350fd3089406f7a0ec0409b79f261136b89ffe0ede267215893ca7abb9f5613a7aaf44248f1c0b53560a0596a78739568f85bd2a081edf4b3d0f69fe0d0
7
- data.tar.gz: 706bc3779b3af6ce3d6780ba9106a8bb4fc84cd81ddd93c7809b62f2663de1baf4c906f961abc6a4982c8815142478d839054b27c504639e1eb5dc88e0b267e3
6
+ metadata.gz: 32e5084af7d8e7cba4b743d0be13d29c1ea05b0c6e00ab7d0b9a38a229545093cf21f9e18da883987e487588f5bb7a47cc8728912332c9f295a42b03432bafc3
7
+ data.tar.gz: 01ff189cc3e645da3eeab3176351ebc0d23d274a9d20269f32733cdb2771169f365857bc946a66e5982c447887f81817fee047b82709e34115f18abaa53a0479
@@ -22,11 +22,12 @@ module Packwerk
22
22
  results << result
23
23
  next if !result.ok?
24
24
 
25
- result = check_layer_setting(config, f, config['layer'])
25
+ package = Package.from(package, layers)
26
+
27
+ result = check_layer_setting(package, f)
26
28
  results << result
27
29
  next if !result.ok?
28
30
 
29
- package = Package.from(package, layers)
30
31
  results += check_dependencies_setting(package_set, package, f)
31
32
  end
32
33
 
@@ -65,17 +66,16 @@ module Packwerk
65
66
  end
66
67
 
67
68
  sig do
68
- params(config: T::Hash[T.untyped, T.untyped], config_file_path: String, layer: T.untyped).returns(Result)
69
+ params(package: Package, config_file_path: String).returns(Result)
69
70
  end
70
- def check_layer_setting(config, config_file_path, layer)
71
- enforce_architecture = config['enforce_architecture']
72
- enforce_architecture_enabled = !(enforce_architecture.nil? || enforce_architecture == false)
71
+ def check_layer_setting(package, config_file_path)
72
+ layer = package.layer
73
73
  valid_layer = layer.nil? || layers.names.include?(layer)
74
74
 
75
- if layer.nil? && enforce_architecture_enabled
75
+ if layer.nil? && package.enforces?
76
76
  Result.new(
77
77
  ok: false,
78
- error_value: "Invalid 'layer' option in #{config_file_path.inspect}: #{layer.inspect}. `layer` must be set if `enforce_architecture` is on."
78
+ error_value: "Invalid 'layer' option in #{config_file_path.inspect}: #{package.layer.inspect}. `layer` must be set if `enforce_architecture` is on."
79
79
  )
80
80
  elsif valid_layer
81
81
  Result.new(ok: true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packwerk-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
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-12-28 00:00:00.000000000 Z
11
+ date: 2022-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: packwerk