deprecation_toolkit 2.2.3 → 2.3.0
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:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 1d780d3c9ef2ad886d0d267a6a3d7e6e5b335cdfef2bb47ea462f285e975e703
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 51eb2e75cee43f91cfa3834baa9640b7c487b1e2b4d6ed8a62c714df84fe4c5c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 2bdc3a73e47cd1341ff4cf34285d73ae5872b27a41343ae34fe447c502c979e1fb7c45dbde21eb4f590590770d2351c4c187b8a80a8310e27fb468874434bd80
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 31c99027dc40530906abeb3dfded92f5672e25710ad0d7fcf32965a22c063b36bcb2ffbdb53af5f995b9b46ff5dd0d9a03211af2482997af3557cf773d0490e8
         
     | 
| 
         @@ -1,24 +1,41 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            require "active_support/configurable"
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
3 
     | 
    
         
             
            module DeprecationToolkit
         
     | 
| 
       6 
     | 
    
         
            -
               
     | 
| 
       7 
     | 
    
         
            -
                 
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
              module Configuration
         
     | 
| 
      
 5 
     | 
    
         
            +
                @allowed_deprecations = []
         
     | 
| 
      
 6 
     | 
    
         
            +
                singleton_class.attr_accessor(:allowed_deprecations)
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                @attach_to = [:rails]
         
     | 
| 
      
 9 
     | 
    
         
            +
                singleton_class.attr_accessor(:attach_to)
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                @behavior = Behaviors::Raise
         
     | 
| 
      
 12 
     | 
    
         
            +
                singleton_class.attr_accessor(:behavior)
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                @deprecation_path = "test/deprecations"
         
     | 
| 
      
 15 
     | 
    
         
            +
                singleton_class.attr_accessor(:deprecation_path)
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                @test_runner = :minitest
         
     | 
| 
      
 18 
     | 
    
         
            +
                singleton_class.attr_accessor(:test_runner)
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                @warnings_treated_as_deprecation = []
         
     | 
| 
      
 21 
     | 
    
         
            +
                singleton_class.attr_accessor(:warnings_treated_as_deprecation)
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                @deprecation_file_path_format = proc do |test|
         
     | 
| 
      
 24 
     | 
    
         
            +
                  if DeprecationToolkit::Configuration.test_runner == :rspec
         
     | 
| 
      
 25 
     | 
    
         
            +
                    test.example_group.file_path.sub(%r{^./spec/}, "").sub(/_spec.rb$/, "")
         
     | 
| 
      
 26 
     | 
    
         
            +
                  else
         
     | 
| 
      
 27 
     | 
    
         
            +
                    test.class.name.underscore
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
                singleton_class.attr_accessor(:deprecation_file_path_format)
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 33 
     | 
    
         
            +
                  def configure
         
     | 
| 
      
 34 
     | 
    
         
            +
                    yield self
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  def config
         
     | 
| 
      
 38 
     | 
    
         
            +
                    self
         
     | 
| 
       22 
39 
     | 
    
         
             
                  end
         
     | 
| 
       23 
40 
     | 
    
         
             
                end
         
     | 
| 
       24 
41 
     | 
    
         
             
              end
         
     | 
| 
         @@ -15,32 +15,29 @@ module DeprecationToolkit 
     | 
|
| 
       15 
15 
     | 
    
         
             
                end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                def write(deprecation_file, deprecations_to_record)
         
     | 
| 
       18 
     | 
    
         
            -
                   
     | 
| 
      
 18 
     | 
    
         
            +
                  original_deprecations = deprecation_file.exist? ? YAML.load_file(deprecation_file) : {}
         
     | 
| 
      
 19 
     | 
    
         
            +
                  updated_deprecations = original_deprecations.dup
         
     | 
| 
       19 
20 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
                   
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       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 
     | 
    
         
            -
                       
     | 
| 
      
 25 
     | 
    
         
            +
                      updated_deprecations.delete(test)
         
     | 
| 
       27 
26 
     | 
    
         
             
                    end
         
     | 
| 
       28 
27 
     | 
    
         
             
                  end
         
     | 
| 
       29 
28 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
                  if  
     | 
| 
       31 
     | 
    
         
            -
                     
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
      
 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))
         
     | 
    
        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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.3.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Shopify
         
     | 
| 
         @@ -15,14 +15,14 @@ dependencies: 
     | 
|
| 
       15 
15 
     | 
    
         
             
                requirements:
         
     | 
| 
       16 
16 
     | 
    
         
             
                - - ">="
         
     | 
| 
       17 
17 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       18 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 18 
     | 
    
         
            +
                    version: '7.0'
         
     | 
| 
       19 
19 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       20 
20 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       21 
21 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       22 
22 
     | 
    
         
             
                requirements:
         
     | 
| 
       23 
23 
     | 
    
         
             
                - - ">="
         
     | 
| 
       24 
24 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       25 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 25 
     | 
    
         
            +
                    version: '7.0'
         
     | 
| 
       26 
26 
     | 
    
         
             
            email:
         
     | 
| 
       27 
27 
     | 
    
         
             
            - rails@shopify.com
         
     | 
| 
       28 
28 
     | 
    
         
             
            executables: []
         
     | 
| 
         @@ -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. 
     | 
| 
      
 56 
     | 
    
         
            +
              source_code_uri: https://github.com/Shopify/deprecation_toolkit/tree/v2.3.0
         
     | 
| 
       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: []
         
     | 
| 
         @@ -63,14 +63,14 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       63 
63 
     | 
    
         
             
              requirements:
         
     | 
| 
       64 
64 
     | 
    
         
             
              - - ">="
         
     | 
| 
       65 
65 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       66 
     | 
    
         
            -
                  version: 3. 
     | 
| 
      
 66 
     | 
    
         
            +
                  version: 3.2.0
         
     | 
| 
       67 
67 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       68 
68 
     | 
    
         
             
              requirements:
         
     | 
| 
       69 
69 
     | 
    
         
             
              - - ">="
         
     | 
| 
       70 
70 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       71 
71 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       72 
72 
     | 
    
         
             
            requirements: []
         
     | 
| 
       73 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 73 
     | 
    
         
            +
            rubygems_version: 3.7.2
         
     | 
| 
       74 
74 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       75 
75 
     | 
    
         
             
            summary: Deprecation Toolkit around ActiveSupport::Deprecation
         
     | 
| 
       76 
76 
     | 
    
         
             
            test_files: []
         
     |