parse_packwerk 0.18.2 → 0.19.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
2
  SHA256:
3
- metadata.gz: 674c8a13d849b72a052c6624b6a700a902579c917d2670da62a965c4944801dd
4
- data.tar.gz: 91ae13980be718d98c96c77a8b1caf5cc3c9a5c05a700522f6189c57d61bdc0e
3
+ metadata.gz: e7ad4138e437e366112368306d99f0fb6a7d8391fa6c2542dfdcba60e62db72c
4
+ data.tar.gz: e5c61e8197584802cb4e8816a2c38330332bffee0f31ef17d2d47c2e834ebd1e
5
5
  SHA512:
6
- metadata.gz: d854c12addbf7826864bec2cf9d7bbb990030c9c0d852f76b4efe33eab36ec5d8d139b44430bed86236e8d7e31ff24c6ae933817995cf8712f82a867f7e2567a
7
- data.tar.gz: c01c719aba0bb2a1cc4e49931436882a442fbd4d0f1b2ed64cea7a08cb4caa370c7aa93a55590cab96e716d76df158f7b53b41732af21e51f8e6eefdae7a79d1
6
+ metadata.gz: c8aa241f818b4a81bec504aa12100809f113587c540ddb32cea6e65c9141b74fcf9bdc99b9ef3f95b86e253a0beec3f25a85f0138deb09995f5908d9352054e6
7
+ data.tar.gz: a6f4846034457b057021fb3a309b28020c18175086c13523fce09f3092fe5bd05d06935546b0b956e029384af9caaff61de485243c66c71276bd8700312b4829
@@ -6,6 +6,7 @@ module ParsePackwerk
6
6
 
7
7
  const :exclude, T::Array[String]
8
8
  const :package_paths, T::Array[String]
9
+ const :requires, T::Array[String]
9
10
 
10
11
  sig { returns(Configuration) }
11
12
  def self.fetch
@@ -21,6 +22,7 @@ module ParsePackwerk
21
22
  Configuration.new(
22
23
  exclude: excludes(raw_packwerk_config),
23
24
  package_paths: package_paths(raw_packwerk_config),
25
+ requires: raw_packwerk_config['require'] || []
24
26
  )
25
27
  end
26
28
 
@@ -0,0 +1,19 @@
1
+ # typed: strict
2
+
3
+ module ParsePackwerk
4
+ module Extensions
5
+ extend T::Sig
6
+
7
+ sig { returns(T::Boolean) }
8
+ def self.all_extensions_installed?
9
+ ParsePackwerk.yml.requires.include?('packwerk-extensions')
10
+ end
11
+
12
+ sig { returns(T::Boolean) }
13
+ def self.privacy_extension_installed?
14
+ all_extensions_installed? || ParsePackwerk.yml.requires.include?('packwerk/privacy/checker')
15
+ end
16
+ end
17
+
18
+ private_constant :Extensions
19
+ end
@@ -6,7 +6,7 @@ module ParsePackwerk
6
6
 
7
7
  const :name, String
8
8
  const :enforce_dependencies, T.any(T::Boolean, String)
9
- const :enforce_privacy, T.any(T::Boolean, String)
9
+ const :enforce_privacy, T.any(T::Boolean, String), default: false
10
10
  const :public_path, String, default: DEFAULT_PUBLIC_PATH
11
11
  const :metadata, MetadataYmlType
12
12
  const :dependencies, T::Array[String]
@@ -20,7 +20,7 @@ module ParsePackwerk
20
20
  new(
21
21
  name: package_name,
22
22
  enforce_dependencies: package_loaded_yml[ENFORCE_DEPENDENCIES],
23
- enforce_privacy: package_loaded_yml[ENFORCE_PRIVACY],
23
+ enforce_privacy: package_loaded_yml[ENFORCE_PRIVACY] || false,
24
24
  public_path: package_loaded_yml[PUBLIC_PATH] || DEFAULT_PUBLIC_PATH,
25
25
  metadata: package_loaded_yml[METADATA] || {},
26
26
  dependencies: package_loaded_yml[DEPENDENCIES] || [],
@@ -9,6 +9,7 @@ require 'parse_packwerk/package_todo'
9
9
  require 'parse_packwerk/package'
10
10
  require 'parse_packwerk/configuration'
11
11
  require 'parse_packwerk/package_set'
12
+ require 'parse_packwerk/extensions'
12
13
 
13
14
  module ParsePackwerk
14
15
  class MissingConfiguration < StandardError
@@ -57,10 +58,11 @@ module ParsePackwerk
57
58
  File.open(package.yml, 'w') do |file|
58
59
  merged_config = package.config
59
60
 
60
- merged_config.merge!(
61
- 'enforce_dependencies' => package.enforce_dependencies,
62
- 'enforce_privacy' => package.enforce_privacy
63
- )
61
+ merged_config.merge!('enforce_dependencies' => package.enforce_dependencies,)
62
+
63
+ if Extensions.privacy_extension_installed?
64
+ merged_config.merge!('enforce_privacy' => package.enforce_privacy)
65
+ end
64
66
 
65
67
  # We want checkers of the form `enforce_xyz` to be at the top
66
68
  merged_config_arr = merged_config.sort_by do |k, v|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parse_packwerk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.2
4
+ version: 0.19.0
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-03-13 00:00:00.000000000 Z
11
+ date: 2023-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime
@@ -133,6 +133,7 @@ files:
133
133
  - lib/parse_packwerk.rb
134
134
  - lib/parse_packwerk/configuration.rb
135
135
  - lib/parse_packwerk/constants.rb
136
+ - lib/parse_packwerk/extensions.rb
136
137
  - lib/parse_packwerk/package.rb
137
138
  - lib/parse_packwerk/package_set.rb
138
139
  - lib/parse_packwerk/package_todo.rb