deprecation_toolkit 2.2.3 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b57fe6f900e79cc13938de52e802aaff9ab51dfe546d5f9e1cdc0a9ec6c4648
4
- data.tar.gz: 61ca80ab4fd5d2337b83cba6af0d53dd1af734957487fcf78d1677ca6b2205d0
3
+ metadata.gz: 928c5fd8932b5f69fd9a51ea255ff5db6977fedc011c9ff211de0e3d73f4cc4e
4
+ data.tar.gz: f514ee0194329683cad36aa454280acaa0a8ecd84ba02d698b45b7b1c84cf0f8
5
5
  SHA512:
6
- metadata.gz: cff2de2f59cb48d1d96b4f39c5c4cdc601d2fdf512d990794e09cf791ef49c7ca8ada4effaa1c19ce0cecc53d535cace10a32eb443abc2a04ac5ca831118dc4c
7
- data.tar.gz: 9fc7fda9a92dd4f73af1297200b81c20825b5f37529ce8f808c2a3b6e1f777586d0fba83b5982d978222c8f90b9a24e473107456d39d8758df91d775ac821d7b
6
+ metadata.gz: 65c66a322df4cfcd5977531d5b0fa60221c096d8d36e7e653b2c9f6d571e175d1fa6a868b53d85c63c80e768a115b7813f65494a61697d96a9456c786a4267e9
7
+ data.tar.gz: 149af66da445071b2b586373cffaf03f43d24b59210d102529b70024a8b5c94bdc5d465270ed2e25709e86133ebae43ba43946e4941fe888677c0d9ae1776257
@@ -15,32 +15,29 @@ module DeprecationToolkit
15
15
  end
16
16
 
17
17
  def write(deprecation_file, deprecations_to_record)
18
- create_deprecation_file(deprecation_file) unless deprecation_file.exist?
18
+ original_deprecations = deprecation_file.exist? ? YAML.load_file(deprecation_file) : {}
19
+ updated_deprecations = original_deprecations.dup
19
20
 
20
- content = YAML.load_file(deprecation_file)
21
-
22
- deprecations_to_record.each do |test, deprecations|
23
- if deprecations.any?
24
- content[test] = deprecations
21
+ deprecations_to_record.each do |test, deprecation_to_record|
22
+ if deprecation_to_record.any?
23
+ updated_deprecations[test] = deprecation_to_record
25
24
  else
26
- content.delete(test)
25
+ updated_deprecations.delete(test)
27
26
  end
28
27
  end
29
28
 
30
- if content.any?
31
- deprecation_file.write(YAML.dump(content))
32
- else
29
+ if updated_deprecations.any?
30
+ if updated_deprecations != original_deprecations
31
+ deprecation_file.dirname.mkpath
32
+ deprecation_file.write(YAML.dump(updated_deprecations.sort.to_h))
33
+ end
34
+ elsif deprecation_file.exist?
33
35
  deprecation_file.delete
34
36
  end
35
37
  end
36
38
 
37
39
  private
38
40
 
39
- def create_deprecation_file(deprecation_file)
40
- deprecation_file.dirname.mkpath
41
- deprecation_file.write(YAML.dump({}))
42
- end
43
-
44
41
  def recorded_deprecations_path(test)
45
42
  deprecation_folder = if Configuration.deprecation_path.is_a?(Proc)
46
43
  Configuration.deprecation_path.call(test_location(test))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeprecationToolkit
4
- VERSION = "2.2.3"
4
+ VERSION = "2.2.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deprecation_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
@@ -53,7 +53,7 @@ licenses:
53
53
  - MIT
54
54
  metadata:
55
55
  homepage_uri: https://github.com/shopify/deprecation_toolkit
56
- source_code_uri: https://github.com/Shopify/deprecation_toolkit/tree/v2.2.3
56
+ source_code_uri: https://github.com/Shopify/deprecation_toolkit/tree/v2.2.4
57
57
  changelog_uri: https://github.com/Shopify/deprecation_toolkit/blob/main/CHANGELOG.md
58
58
  allowed_push_host: https://rubygems.org
59
59
  rdoc_options: []
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  requirements: []
73
- rubygems_version: 3.6.8
73
+ rubygems_version: 3.7.1
74
74
  specification_version: 4
75
75
  summary: Deprecation Toolkit around ActiveSupport::Deprecation
76
76
  test_files: []