nandi 0.10.0 → 0.12.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 +4 -4
 - data/README.md +1 -1
 - data/exe/nandi-enforce +1 -1
 - data/lib/nandi/file_matcher.rb +1 -1
 - data/lib/nandi/instructions/remove_column.rb +6 -1
 - data/lib/nandi/lockfile.rb +21 -1
 - data/lib/nandi/migration.rb +4 -4
 - data/lib/nandi/renderers/active_record/generate.rb +1 -1
 - data/lib/nandi/validation/timeout_validator.rb +3 -1
 - data/lib/nandi/version.rb +1 -1
 - data/lib/templates/nandi/renderers/active_record/instructions/add_column/show.rb.erb +1 -1
 - data/lib/templates/nandi/renderers/active_record/instructions/add_foreign_key/show.rb.erb +1 -1
 - data/lib/templates/nandi/renderers/active_record/instructions/add_index/show.rb.erb +1 -1
 - data/lib/templates/nandi/renderers/active_record/instructions/add_reference/show.rb.erb +1 -1
 - data/lib/templates/nandi/renderers/active_record/instructions/remove_column/show.rb.erb +1 -1
 - data/lib/templates/nandi/renderers/active_record/instructions/remove_index/show.rb.erb +1 -1
 - data/lib/templates/nandi/renderers/active_record/instructions/remove_reference/show.rb.erb +1 -1
 - metadata +9 -9
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 1da0a62d10387d4dc47b1b00045d351559d8c3a6a08b9f3de2ad029b7948e0da
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: f56710ba940ee97e004113b9d96aa6a5e4cc34b963f9c2d5dcbd8d3ae6c4b893
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 5f9a1879fa3f414c020703cf521200a1d436f2af0da8b7051beadd91bbadf9556f3e811eef17d842e54b8c962b4051529f347b8900dda3ffe5c887bc4565928f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: fcbbc52d37437d8052016e3ff1182f3b603994ab002827ef7e6fbb182ee2a816ff383abde467f0c12f99da54141cbe8ffccb99748950143d047f04233e220733
         
     | 
    
        data/README.md
    CHANGED
    
    
    
        data/exe/nandi-enforce
    CHANGED
    
    
    
        data/lib/nandi/file_matcher.rb
    CHANGED
    
    
    
        data/lib/nandi/lockfile.rb
    CHANGED
    
    | 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require "active_support/core_ext/hash/indifferent_access"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "digest"
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
            module Nandi
         
     | 
| 
       6 
7 
     | 
    
         
             
              class Lockfile
         
     | 
| 
         @@ -42,7 +43,26 @@ module Nandi 
     | 
|
| 
       42 
43 
     | 
    
         
             
                  end
         
     | 
| 
       43 
44 
     | 
    
         | 
| 
       44 
45 
     | 
    
         
             
                  def persist!
         
     | 
| 
       45 
     | 
    
         
            -
                     
     | 
| 
      
 46 
     | 
    
         
            +
                    # This is a somewhat ridiculous trick to avoid merge conflicts in git.
         
     | 
| 
      
 47 
     | 
    
         
            +
                    #
         
     | 
| 
      
 48 
     | 
    
         
            +
                    # Normally, new migrations are added to the bottom of the Nandi lockfile.
         
     | 
| 
      
 49 
     | 
    
         
            +
                    # This is relatively unfriendly to git's merge algorithm, and means that
         
     | 
| 
      
 50 
     | 
    
         
            +
                    # if someone merges a pull request with a completely unrelated migration,
         
     | 
| 
      
 51 
     | 
    
         
            +
                    # you'll have to rebase to get yours merged as the last line of the file
         
     | 
| 
      
 52 
     | 
    
         
            +
                    # will be seen as a conflict (both branches added content there).
         
     | 
| 
      
 53 
     | 
    
         
            +
                    #
         
     | 
| 
      
 54 
     | 
    
         
            +
                    # This is in contrast to something like Gemfile.lock, where changes tend
         
     | 
| 
      
 55 
     | 
    
         
            +
                    # to be distributed throughout the file. The idea behind sorting by
         
     | 
| 
      
 56 
     | 
    
         
            +
                    # SHA-256 hash is to distribute new Nandi lockfile entries evenly, but
         
     | 
| 
      
 57 
     | 
    
         
            +
                    # also stably through the file. It needs to be stable or we'd have even
         
     | 
| 
      
 58 
     | 
    
         
            +
                    # worse merge conflict problems (e.g. if we randomised the order on
         
     | 
| 
      
 59 
     | 
    
         
            +
                    # writing the file, the whole thing would conflict pretty much every time
         
     | 
| 
      
 60 
     | 
    
         
            +
                    # it was regenerated).
         
     | 
| 
      
 61 
     | 
    
         
            +
                    content = lockfile.to_h.deep_stringify_keys.sort_by do |k, _|
         
     | 
| 
      
 62 
     | 
    
         
            +
                      Digest::SHA256.hexdigest(k)
         
     | 
| 
      
 63 
     | 
    
         
            +
                    end.to_h.to_yaml
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                    File.write(path, content)
         
     | 
| 
       46 
66 
     | 
    
         
             
                  end
         
     | 
| 
       47 
67 
     | 
    
         | 
| 
       48 
68 
     | 
    
         
             
                  def path
         
     | 
    
        data/lib/nandi/migration.rb
    CHANGED
    
    | 
         @@ -357,9 +357,9 @@ module Nandi 
     | 
|
| 
       357 
357 
     | 
    
         
             
                  end.uniq
         
     | 
| 
       358 
358 
     | 
    
         
             
                end
         
     | 
| 
       359 
359 
     | 
    
         | 
| 
       360 
     | 
    
         
            -
                def method_missing(name, *args, &block)
         
     | 
| 
      
 360 
     | 
    
         
            +
                def method_missing(name, *args, **kwargs, &block)
         
     | 
| 
       361 
361 
     | 
    
         
             
                  if Nandi.config.custom_methods.key?(name)
         
     | 
| 
       362 
     | 
    
         
            -
                    invoke_custom_method(name, *args, &block)
         
     | 
| 
      
 362 
     | 
    
         
            +
                    invoke_custom_method(name, *args, **kwargs, &block)
         
     | 
| 
       363 
363 
     | 
    
         
             
                  else
         
     | 
| 
       364 
364 
     | 
    
         
             
                    super
         
     | 
| 
       365 
365 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -381,9 +381,9 @@ module Nandi 
     | 
|
| 
       381 
381 
     | 
    
         
             
                  Nandi.config.access_exclusive_lock_timeout
         
     | 
| 
       382 
382 
     | 
    
         
             
                end
         
     | 
| 
       383 
383 
     | 
    
         | 
| 
       384 
     | 
    
         
            -
                def invoke_custom_method(name, *args, &block)
         
     | 
| 
      
 384 
     | 
    
         
            +
                def invoke_custom_method(name, *args, **kwargs, &block)
         
     | 
| 
       385 
385 
     | 
    
         
             
                  klass = Nandi.config.custom_methods[name]
         
     | 
| 
       386 
     | 
    
         
            -
                  current_instructions << klass.new(*args, &block)
         
     | 
| 
      
 386 
     | 
    
         
            +
                  current_instructions << klass.new(*args, **kwargs, &block)
         
     | 
| 
       387 
387 
     | 
    
         
             
                end
         
     | 
| 
       388 
388 
     | 
    
         
             
              end
         
     | 
| 
       389 
389 
     | 
    
         
             
            end
         
     | 
    
        data/lib/nandi/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: nandi
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.12.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - GoCardless Engineering
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire: 
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-01-07 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activesupport
         
     | 
| 
         @@ -100,14 +100,14 @@ dependencies: 
     | 
|
| 
       100 
100 
     | 
    
         
             
                requirements:
         
     | 
| 
       101 
101 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       102 
102 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       103 
     | 
    
         
            -
                    version: 2. 
     | 
| 
      
 103 
     | 
    
         
            +
                    version: 2.25.0
         
     | 
| 
       104 
104 
     | 
    
         
             
              type: :development
         
     | 
| 
       105 
105 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       106 
106 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       107 
107 
     | 
    
         
             
                requirements:
         
     | 
| 
       108 
108 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       109 
109 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       110 
     | 
    
         
            -
                    version: 2. 
     | 
| 
      
 110 
     | 
    
         
            +
                    version: 2.25.0
         
     | 
| 
       111 
111 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       112 
112 
     | 
    
         
             
              name: pry-byebug
         
     | 
| 
       113 
113 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -212,7 +212,7 @@ dependencies: 
     | 
|
| 
       212 
212 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       213 
213 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       214 
214 
     | 
    
         
             
                    version: '0.9'
         
     | 
| 
       215 
     | 
    
         
            -
            description: 
     | 
| 
      
 215 
     | 
    
         
            +
            description:
         
     | 
| 
       216 
216 
     | 
    
         
             
            email:
         
     | 
| 
       217 
217 
     | 
    
         
             
            - engineering@gocardless.com
         
     | 
| 
       218 
218 
     | 
    
         
             
            executables:
         
     | 
| 
         @@ -303,7 +303,7 @@ homepage: https://github.com/gocardless/nandi 
     | 
|
| 
       303 
303 
     | 
    
         
             
            licenses:
         
     | 
| 
       304 
304 
     | 
    
         
             
            - MIT
         
     | 
| 
       305 
305 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       306 
     | 
    
         
            -
            post_install_message: 
     | 
| 
      
 306 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       307 
307 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       308 
308 
     | 
    
         
             
            require_paths:
         
     | 
| 
       309 
309 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -318,8 +318,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       318 
318 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       319 
319 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       320 
320 
     | 
    
         
             
            requirements: []
         
     | 
| 
       321 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
       322 
     | 
    
         
            -
            signing_key: 
     | 
| 
      
 321 
     | 
    
         
            +
            rubygems_version: 3.3.3
         
     | 
| 
      
 322 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       323 
323 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       324 
324 
     | 
    
         
             
            summary: Fear-free migrations for PostgreSQL
         
     | 
| 
       325 
325 
     | 
    
         
             
            test_files: []
         
     |