packs 0.0.39 → 0.0.41

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: 01d0eabdf25328fdc677db1822e9fa63708f5fd300acac2a0a35642fdaf90406
4
- data.tar.gz: 861dd9be5a4c13ffefaa3004631077023accd9ae13ec6f9cf616bd3247c24fcb
3
+ metadata.gz: 6ffe5dc9bf38dcea0c7eb2bf1091c5ea162d04a2a8551f2a4198d3b60acfe878
4
+ data.tar.gz: 2c74caaac69bcc7ad850c940f25254995333d4dcb144d779b6302872a1365cb1
5
5
  SHA512:
6
- metadata.gz: 71c3578facc93a54296f35722a872c810a87a9e368081a1d9041f8747ebe8cd34b8dc5a90b6207bf41c7be06222b7e8e748910d605805754704350c24f155726
7
- data.tar.gz: 6c66f26b4825c4a57eb3aa08b1e6ce566241be72e83b7cad38faf9f24c6c50558977b6b8dfbc1be50c89bf02d870087da62fca8caafa3e5a39085f4abb569308
6
+ metadata.gz: 6ba2df6056b91420e64b222c8a23e233634612bc0e1be4b249775892ce5be947523b1c9bd1665eadc5a9e7658e976be228912ec07ca55d64aa318eeb9fc39eab
7
+ data.tar.gz: 84235f58a2c5e5ddb106761bd4a2a312a6d3118af539f5f1ab9e09bc194f78dcc5f614b914450e6e6254c8f2b1e8989a265654a32b07b6e199ff25ce8f0a7559
@@ -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,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.39
4
+ version: 0.0.41
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-01-05 00:00:00.000000000 Z
11
+ date: 2024-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bigdecimal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: code_ownership
15
29
  requirement: !ruby/object:Gem::Requirement