packs 0.0.40 → 0.0.42

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: 3317999d00b6c772ba2272a52813b945647c0699abd927f2ab95373e69f5204a
4
- data.tar.gz: c7c35f6160a0d9288551ba87c73daba9d186490c26cbba0726b875e0a833d14b
3
+ metadata.gz: 013625f1961cdc9ba674369e6039a17dcde8e2039a0b3e7283362d1c84ac6014
4
+ data.tar.gz: 7756ab964185ac8cdabd86be4964654970eaa8502685f8e7e4af017fe127ebd7
5
5
  SHA512:
6
- metadata.gz: aa0c6ccb60434cc1e732d91ac114c2b16cde61d0d114112aa66dea8c67c79afa42fe881bf6d213621208b7897545e98bf585fe4edd496ee6a6fc2c34e692fe65
7
- data.tar.gz: f96feabe77b1b8a648404270101f9d767f81a3daa3800f067f4e02c273dbfb19df484c4a6c8f3114bbc06e79ed7ebfe779b48775adb706146b236c94f18869d4
6
+ metadata.gz: 4ffe1c6dd9e30fcaf474a0ddad5df39a0da6f8a8373137dc05e7f009608427904bb1673b929bb53ccbc76bb1fc77a5c0f718ce620edf2cef5579718ff301a62b
7
+ data.tar.gz: 07a6c67e9739780b72c688499cafd70c4128a6f1bacc8472b140170ea466fad238d8566fd01998ff6d8098e3698d2216265c233459147cf840a147d57e8c6488
@@ -9,34 +9,38 @@ module Packs
9
9
  const :destination_pathname, Pathname
10
10
  const :destination_pack, ParsePackwerk::Package
11
11
 
12
- sig { returns(ParsePackwerk::Package) }
12
+ sig { returns(T.nilable(Packs::Pack)) }
13
13
  def origin_pack
14
- ParsePackwerk.package_from_path(origin_pathname)
14
+ self.class.get_origin_pack(origin_pathname)
15
+ end
16
+
17
+ sig { params(origin_pathname: Pathname).returns(T.nilable(Packs::Pack)) }
18
+ def self.get_origin_pack(origin_pathname)
19
+ Packs.for_file(origin_pathname)
15
20
  end
16
21
 
17
22
  sig { params(origin_pathname: Pathname, new_package_root: Pathname).returns(Pathname) }
18
23
  def self.destination_pathname_for_package_move(origin_pathname, new_package_root)
19
- origin_pack = ParsePackwerk.package_from_path(origin_pathname)
20
-
21
- if origin_pack.name == ParsePackwerk::ROOT_PACKAGE_NAME
22
- new_package_root.join(origin_pathname).cleanpath
23
- else
24
+ origin_pack = get_origin_pack(origin_pathname)
25
+ if origin_pack
24
26
  Pathname.new(origin_pathname.to_s.gsub(origin_pack.name, new_package_root.to_s)).cleanpath
27
+ else
28
+ new_package_root.join(origin_pathname).cleanpath
25
29
  end
26
30
  end
27
31
 
28
32
  sig { params(origin_pathname: Pathname).returns(Pathname) }
29
33
  def self.destination_pathname_for_new_public_api(origin_pathname)
30
- origin_pack = ParsePackwerk.package_from_path(origin_pathname)
31
- if origin_pack.name == ParsePackwerk::ROOT_PACKAGE_NAME
32
- filepath_without_pack_name = origin_pathname.to_s
33
- else
34
+ origin_pack = get_origin_pack(origin_pathname)
35
+ if origin_pack
34
36
  filepath_without_pack_name = origin_pathname.to_s.gsub("#{origin_pack.name}/", '')
37
+ else
38
+ filepath_without_pack_name = origin_pathname.to_s
35
39
  end
36
40
 
37
41
  # We join the pack name with the rest of the path...
38
42
  path_parts = filepath_without_pack_name.split('/')
39
- Pathname.new(origin_pack.name).join(
43
+ Pathname.new(origin_pack&.name || ParsePackwerk::ROOT_PACKAGE_NAME).join(
40
44
  # ... keeping the "app" or "spec"
41
45
  T.must(path_parts[0]),
42
46
  # ... substituting "controllers," "services," etc. with "public"
@@ -15,7 +15,7 @@ module Packs
15
15
  def after_move_files!(file_move_operations)
16
16
  return if file_move_operations.empty?
17
17
 
18
- origin_pack = T.must(file_move_operations.first).origin_pack.name
18
+ origin_pack = T.must(file_move_operations.first).origin_pack&.name || ParsePackwerk::ROOT_PACKAGE_NAME
19
19
  destination_pack = T.must(file_move_operations.first).destination_pack.name
20
20
 
21
21
  if self.class.ripgrep_enabled?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.40
4
+ version: 0.0.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusto Engineers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-26 00:00:00.000000000 Z
11
+ date: 2024-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal
@@ -73,6 +73,9 @@ dependencies:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: 0.22.0
76
+ - - "<="
77
+ - !ruby/object:Gem::Version
78
+ version: 0.23.0
76
79
  type: :runtime
77
80
  prerelease: false
78
81
  version_requirements: !ruby/object:Gem::Requirement
@@ -80,6 +83,9 @@ dependencies:
80
83
  - - ">="
81
84
  - !ruby/object:Gem::Version
82
85
  version: 0.22.0
86
+ - - "<="
87
+ - !ruby/object:Gem::Version
88
+ version: 0.23.0
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: rainbow
85
91
  requirement: !ruby/object:Gem::Requirement
@@ -344,7 +350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
344
350
  - !ruby/object:Gem::Version
345
351
  version: '0'
346
352
  requirements: []
347
- rubygems_version: 3.5.3
353
+ rubygems_version: 3.5.9
348
354
  signing_key:
349
355
  specification_version: 4
350
356
  summary: Provides CLI tools for working with ruby packs.