parse_packwerk 0.10.1 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/parse_packwerk.rb +11 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f409f199bdc5359f8287eeb77ddc83b47ee35d98d7066af8d11dafa1dda0f23b
4
- data.tar.gz: 2a0978ce08554183ec20865f64bfc6480d7d9501ca015130589d4f20a75bcf72
3
+ metadata.gz: f97fa90aa6c1081358322fcbce578b4a133305216312ec90cd27cd990bf16575
4
+ data.tar.gz: 497321cf3cddc44fc099244ca9b2481beff586a9ad82a0482971977e368dcce7
5
5
  SHA512:
6
- metadata.gz: 4c9338e22916f759cbe982087f52606eaec69ff4fcbd4bbc90bb8f1c2787e1cfa08fce8e678f70edd5ae2566e0afa1ba8aa65e3039706bfe7390ad8b1b2d3853
7
- data.tar.gz: 9fe7860d98c05d3049b902f2a3bd0c04c1b69568195e385c00ae756883b7b48d52da9decd6f5cd1c2b848daf1414de5a99e6461fdafc95265ec09c202eddb128
6
+ metadata.gz: db897c18973474fac686a1ed2bf60882fea2ddb28e41c419199e30c08d76598b185ec2e44600ece0421d19f4a44bdb8d3348ca6cfd6ef59c99a7f1cacb2e087d
7
+ data.tar.gz: 6a5ccf2ff287f334fc404b7c2064c2f10c6d43fd91a84e8fc641e1f9360b526fb9829e6ad4ab44761c54b8effaedec9ca3468f493cc3680d9b7883c02345cb67
@@ -39,6 +39,17 @@ module ParsePackwerk
39
39
  Configuration.fetch
40
40
  end
41
41
 
42
+ sig { params(file_path: T.any(Pathname, String)).returns(T.nilable(Package)) }
43
+ def self.package_from_path(file_path)
44
+ path_string = file_path.to_s
45
+ @package_from_path = T.let(@package_from_path, T.nilable(T::Hash[String, Package]))
46
+ @package_from_path ||= {}
47
+ @package_from_path[path_string] ||= T.must(begin
48
+ matching_package = all.find { |package| path_string.start_with?("#{package.name}/") || path_string == package.name }
49
+ matching_package || find(ROOT_PACKAGE_NAME)
50
+ end)
51
+ end
52
+
42
53
  sig { params(package: ParsePackwerk::Package).void }
43
54
  def self.write_package_yml!(package)
44
55
  FileUtils.mkdir_p(package.directory)
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.10.1
4
+ version: 0.11.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: 2022-06-14 00:00:00.000000000 Z
11
+ date: 2022-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime