parse_packwerk 0.18.2 → 0.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/parse_packwerk/configuration.rb +2 -0
- data/lib/parse_packwerk/extensions.rb +19 -0
- data/lib/parse_packwerk/package.rb +6 -2
- data/lib/parse_packwerk.rb +9 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ccc04b5202c680f618fb55fa776cd19898dc5e126ec20ae1a0457366637f302
|
4
|
+
data.tar.gz: 1332bbf45c911be1795602b20d2b6642682b3a2c46adc57d7602da1eea4b2599
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e917cbf8dc1e687eb3478cccfa16818adfed51676a4c64d17552c795518349906fdf93fcd1bf20dd7afc24db11596db6874fb3073c76f5ff23d83d6ad37174e1
|
7
|
+
data.tar.gz: d4ae625347c3dce180b658c1b2e36dddcd816db1ca7110d5e474145dcf4b936b2755a95b013eb44da06650e1f8660fd7810882419235f147596130d4ae3f97fa
|
@@ -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]
|
@@ -15,12 +15,16 @@ module ParsePackwerk
|
|
15
15
|
sig { params(pathname: Pathname).returns(Package) }
|
16
16
|
def self.from(pathname)
|
17
17
|
package_loaded_yml = YAML.load_file(pathname)
|
18
|
+
if package_loaded_yml.nil? || package_loaded_yml == false
|
19
|
+
message = "Failed to parse `#{pathname}`. Please fix any issues with this package.yml OR add its containing folder to packwerk.yml `exclude`"
|
20
|
+
raise PackageParseError.new(message)
|
21
|
+
end
|
18
22
|
package_name = pathname.dirname.cleanpath.to_s
|
19
23
|
|
20
24
|
new(
|
21
25
|
name: package_name,
|
22
26
|
enforce_dependencies: package_loaded_yml[ENFORCE_DEPENDENCIES],
|
23
|
-
enforce_privacy: package_loaded_yml[ENFORCE_PRIVACY],
|
27
|
+
enforce_privacy: package_loaded_yml[ENFORCE_PRIVACY] || false,
|
24
28
|
public_path: package_loaded_yml[PUBLIC_PATH] || DEFAULT_PUBLIC_PATH,
|
25
29
|
metadata: package_loaded_yml[METADATA] || {},
|
26
30
|
dependencies: package_loaded_yml[DEPENDENCIES] || [],
|
data/lib/parse_packwerk.rb
CHANGED
@@ -9,8 +9,12 @@ 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
|
15
|
+
class PackageParseError < StandardError
|
16
|
+
end
|
17
|
+
|
14
18
|
class MissingConfiguration < StandardError
|
15
19
|
extend T::Sig
|
16
20
|
|
@@ -57,10 +61,11 @@ module ParsePackwerk
|
|
57
61
|
File.open(package.yml, 'w') do |file|
|
58
62
|
merged_config = package.config
|
59
63
|
|
60
|
-
merged_config.merge!(
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
+
merged_config.merge!('enforce_dependencies' => package.enforce_dependencies,)
|
65
|
+
|
66
|
+
if Extensions.privacy_extension_installed?
|
67
|
+
merged_config.merge!('enforce_privacy' => package.enforce_privacy)
|
68
|
+
end
|
64
69
|
|
65
70
|
# We want checkers of the form `enforce_xyz` to be at the top
|
66
71
|
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.
|
4
|
+
version: 0.19.1
|
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-01 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
|