granite 0.17.0 → 0.17.1
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/lib/granite/action/subject.rb +3 -3
- data/lib/granite/action/transaction.rb +6 -6
- data/lib/granite/version.rb +1 -1
- metadata +10 -24
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9e0ea5a4829a8f42ea8d86fa3ad0c8ae3e0e15bf4b0b92824b2268bc4be9489b
         | 
| 4 | 
            +
              data.tar.gz: a40be02b1b8cef2bfa329c1f33415b78142d497a9d20f10d4ae7b3adc060bdf5
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 37d3fe242ac9ea96ec2b4bf4aa8f55e97086a12634600e3d474558319a143cbe0a718bbd1f76a77514a9ca98fac39c0ae39439ede746ead6a8c08f3ec2e85b1e
         | 
| 7 | 
            +
              data.tar.gz: 34a452491cc98a5c650ffb513684e5f8ab1dd12407cddaadcc7a3905ece4eaab5dc40c27ab93ee99ae3f55381ebee9f510abf8a31e2d3d1d9929ab695b743aeb
         | 
| @@ -2,13 +2,13 @@ module Granite | |
| 2 2 | 
             
              class Action
         | 
| 3 3 | 
             
                class SubjectNotFoundError < ArgumentError
         | 
| 4 4 | 
             
                  def initialize(action_class)
         | 
| 5 | 
            -
                    super | 
| 5 | 
            +
                    super("Unable to initialize #{action_class} without subject provided")
         | 
| 6 6 | 
             
                  end
         | 
| 7 7 | 
             
                end
         | 
| 8 8 |  | 
| 9 9 | 
             
                class SubjectTypeMismatchError < ArgumentError
         | 
| 10 10 | 
             
                  def initialize(action_class, candidate, expected)
         | 
| 11 | 
            -
                    super | 
| 11 | 
            +
                    super("Unable to initialize #{action_class} with #{candidate} as subject, expecting instance of #{expected}")
         | 
| 12 12 | 
             
                  end
         | 
| 13 13 | 
             
                end
         | 
| 14 14 |  | 
| @@ -48,7 +48,7 @@ module Granite | |
| 48 48 | 
             
                    subject_attributes = extract_subject_attributes!(attributes, reflection)
         | 
| 49 49 | 
             
                    assign_subject(args, subject_attributes, reflection)
         | 
| 50 50 |  | 
| 51 | 
            -
                    super | 
| 51 | 
            +
                    super(attributes)
         | 
| 52 52 | 
             
                  end
         | 
| 53 53 |  | 
| 54 54 | 
             
                  private
         | 
| @@ -13,21 +13,21 @@ module Granite | |
| 13 13 | 
             
                  def run_callbacks(event)
         | 
| 14 14 | 
             
                    if event.to_s == 'commit'
         | 
| 15 15 | 
             
                      begin
         | 
| 16 | 
            -
                        super | 
| 16 | 
            +
                        super(event)
         | 
| 17 17 | 
             
                      rescue *handled_exceptions => e
         | 
| 18 18 | 
             
                        handle_exception(e)
         | 
| 19 19 | 
             
                      end
         | 
| 20 20 | 
             
                    else
         | 
| 21 | 
            -
                      super | 
| 21 | 
            +
                      super(event)
         | 
| 22 22 | 
             
                    end
         | 
| 23 23 | 
             
                  end
         | 
| 24 24 |  | 
| 25 25 | 
             
                  private
         | 
| 26 26 |  | 
| 27 | 
            -
                  attr_accessor : | 
| 27 | 
            +
                  attr_accessor :granite_in_transaction
         | 
| 28 28 |  | 
| 29 29 | 
             
                  def transaction(&block)
         | 
| 30 | 
            -
                    if  | 
| 30 | 
            +
                    if granite_in_transaction
         | 
| 31 31 | 
             
                      yield
         | 
| 32 32 | 
             
                    else
         | 
| 33 33 | 
             
                      run_in_transaction(&block)
         | 
| @@ -35,14 +35,14 @@ module Granite | |
| 35 35 | 
             
                  end
         | 
| 36 36 |  | 
| 37 37 | 
             
                  def run_in_transaction
         | 
| 38 | 
            -
                    self. | 
| 38 | 
            +
                    self.granite_in_transaction = true
         | 
| 39 39 |  | 
| 40 40 | 
             
                    TransactionManager.transaction do
         | 
| 41 41 | 
             
                      TransactionManager.after_commit(self)
         | 
| 42 42 | 
             
                      yield
         | 
| 43 43 | 
             
                    end
         | 
| 44 44 | 
             
                  ensure
         | 
| 45 | 
            -
                    self. | 
| 45 | 
            +
                    self.granite_in_transaction = false
         | 
| 46 46 | 
             
                  end
         | 
| 47 47 | 
             
                end
         | 
| 48 48 | 
             
              end
         | 
    
        data/lib/granite/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: granite
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.17. | 
| 4 | 
            +
              version: 0.17.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Toptal Engineering
         | 
| 8 | 
            -
            autorequire:
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2024-01-19 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: actionpack
         | 
| @@ -134,20 +134,6 @@ dependencies: | |
| 134 134 | 
             
                - - ">="
         | 
| 135 135 | 
             
                  - !ruby/object:Gem::Version
         | 
| 136 136 | 
             
                    version: '0'
         | 
| 137 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 138 | 
            -
              name: capybara
         | 
| 139 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 140 | 
            -
                requirements:
         | 
| 141 | 
            -
                - - "~>"
         | 
| 142 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 143 | 
            -
                    version: '2.18'
         | 
| 144 | 
            -
              type: :development
         | 
| 145 | 
            -
              prerelease: false
         | 
| 146 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 147 | 
            -
                requirements:
         | 
| 148 | 
            -
                - - "~>"
         | 
| 149 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 150 | 
            -
                    version: '2.18'
         | 
| 151 137 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 152 138 | 
             
              name: fuubar
         | 
| 153 139 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -252,14 +238,14 @@ dependencies: | |
| 252 238 | 
             
                requirements:
         | 
| 253 239 | 
             
                - - "~>"
         | 
| 254 240 | 
             
                  - !ruby/object:Gem::Version
         | 
| 255 | 
            -
                    version: ' | 
| 241 | 
            +
                    version: '6.0'
         | 
| 256 242 | 
             
              type: :development
         | 
| 257 243 | 
             
              prerelease: false
         | 
| 258 244 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 259 245 | 
             
                requirements:
         | 
| 260 246 | 
             
                - - "~>"
         | 
| 261 247 | 
             
                  - !ruby/object:Gem::Version
         | 
| 262 | 
            -
                    version: ' | 
| 248 | 
            +
                    version: '6.0'
         | 
| 263 249 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 264 250 | 
             
              name: rspec_junit_formatter
         | 
| 265 251 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -330,8 +316,8 @@ dependencies: | |
| 330 316 | 
             
                - - "~>"
         | 
| 331 317 | 
             
                  - !ruby/object:Gem::Version
         | 
| 332 318 | 
             
                    version: '0.15'
         | 
| 333 | 
            -
            description:
         | 
| 334 | 
            -
            email:
         | 
| 319 | 
            +
            description: 
         | 
| 320 | 
            +
            email: 
         | 
| 335 321 | 
             
            executables: []
         | 
| 336 322 | 
             
            extensions: []
         | 
| 337 323 | 
             
            extra_rdoc_files: []
         | 
| @@ -407,7 +393,7 @@ homepage: https://github.com/toptal/granite | |
| 407 393 | 
             
            licenses:
         | 
| 408 394 | 
             
            - MIT
         | 
| 409 395 | 
             
            metadata: {}
         | 
| 410 | 
            -
            post_install_message:
         | 
| 396 | 
            +
            post_install_message: 
         | 
| 411 397 | 
             
            rdoc_options: []
         | 
| 412 398 | 
             
            require_paths:
         | 
| 413 399 | 
             
            - lib
         | 
| @@ -422,8 +408,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 422 408 | 
             
                - !ruby/object:Gem::Version
         | 
| 423 409 | 
             
                  version: '0'
         | 
| 424 410 | 
             
            requirements: []
         | 
| 425 | 
            -
            rubygems_version: 3. | 
| 426 | 
            -
            signing_key:
         | 
| 411 | 
            +
            rubygems_version: 3.1.6
         | 
| 412 | 
            +
            signing_key: 
         | 
| 427 413 | 
             
            specification_version: 4
         | 
| 428 414 | 
             
            summary: Another business actions architecture for Rails apps
         | 
| 429 415 | 
             
            test_files: []
         |