bullet 5.7.2 → 5.7.3
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/CHANGELOG.md +5 -0
- data/README.md +1 -2
- data/bullet.gemspec +1 -1
- data/lib/bullet/active_record5.rb +26 -9
- data/lib/bullet/stack_trace_filter.rb +2 -1
- data/lib/bullet/version.rb +1 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 74a6d3a3671ea862309e08ecd7cb438ff1a0b1fb
         | 
| 4 | 
            +
              data.tar.gz: 4796ef4d3dc79f88cab4b3ea1800a368935c3e5b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 1590f51058fa2b58b2adf9f0df431c542bac23e2ed33d42a8733a80419d756c253740bf3c2dc47c89a2945018674164efbe5ee4912880c1b49a366d608859a6e
         | 
| 7 | 
            +
              data.tar.gz: 45ba5a4438cc5003b6b5e05e598a9e71ad3b3145996e19d7cc248bc0c6e5c7d03546d1aaf94158a1eb631957bf0fdeae44ef0701917957f1a60eb35f85c3aa1d
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -2,8 +2,7 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            [](http://badge.fury.io/rb/bullet)
         | 
| 4 4 | 
             
            [](http://travis-ci.org/flyerhzm/bullet)
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            [ ](https://awesomecode.io/projects/2)
         | 
| 5 | 
            +
            [](https://awesomecode.io/projects/2)
         | 
| 7 6 | 
             
            [](http://coderwall.com/flyerhzm)
         | 
| 8 7 |  | 
| 9 8 | 
             
            The Bullet gem is designed to help you increase your application's performance by reducing the number of queries it makes. It will watch your queries while you develop your application and notify you when you should add eager loading (N+1 queries), when you're using eager loading that isn't necessary and when you should use counter cache.
         | 
    
        data/bullet.gemspec
    CHANGED
    
    | @@ -9,7 +9,7 @@ Gem::Specification.new do |s| | |
| 9 9 | 
             
              s.platform    = Gem::Platform::RUBY
         | 
| 10 10 | 
             
              s.authors     = ['Richard Huang']
         | 
| 11 11 | 
             
              s.email       = ['flyerhzm@gmail.com']
         | 
| 12 | 
            -
              s.homepage    = ' | 
| 12 | 
            +
              s.homepage    = 'https://github.com/flyerhzm/bullet'
         | 
| 13 13 | 
             
              s.summary     = 'help to kill N+1 queries and unused eager loading.'
         | 
| 14 14 | 
             
              s.description = 'help to kill N+1 queries and unused eager loading.'
         | 
| 15 15 |  | 
| @@ -93,17 +93,34 @@ module Bullet | |
| 93 93 | 
             
                  end)
         | 
| 94 94 |  | 
| 95 95 | 
             
                  ::ActiveRecord::Associations::JoinDependency.prepend(Module.new do
         | 
| 96 | 
            -
                     | 
| 97 | 
            -
                       | 
| 98 | 
            -
                       | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 103 | 
            -
                           | 
| 96 | 
            +
                    if ::ActiveRecord::Associations::JoinDependency.instance_method(:instantiate).parameters.last[0] == :block
         | 
| 97 | 
            +
                      # ActiveRecord >= 5.1.5
         | 
| 98 | 
            +
                      def instantiate(result_set, &block)
         | 
| 99 | 
            +
                        @bullet_eager_loadings = {}
         | 
| 100 | 
            +
                        records = super
         | 
| 101 | 
            +
             | 
| 102 | 
            +
                        if Bullet.start?
         | 
| 103 | 
            +
                          @bullet_eager_loadings.each do |_klazz, eager_loadings_hash|
         | 
| 104 | 
            +
                            objects = eager_loadings_hash.keys
         | 
| 105 | 
            +
                            Bullet::Detector::UnusedEagerLoading.add_eager_loadings(objects, eager_loadings_hash[objects.first].to_a)
         | 
| 106 | 
            +
                          end
         | 
| 104 107 | 
             
                        end
         | 
| 108 | 
            +
                        records
         | 
| 109 | 
            +
                      end
         | 
| 110 | 
            +
                    else
         | 
| 111 | 
            +
                      # ActiveRecord <= 5.1.4
         | 
| 112 | 
            +
                      def instantiate(result_set, aliases)
         | 
| 113 | 
            +
                        @bullet_eager_loadings = {}
         | 
| 114 | 
            +
                        records = super
         | 
| 115 | 
            +
             | 
| 116 | 
            +
                        if Bullet.start?
         | 
| 117 | 
            +
                          @bullet_eager_loadings.each do |_klazz, eager_loadings_hash|
         | 
| 118 | 
            +
                            objects = eager_loadings_hash.keys
         | 
| 119 | 
            +
                            Bullet::Detector::UnusedEagerLoading.add_eager_loadings(objects, eager_loadings_hash[objects.first].to_a)
         | 
| 120 | 
            +
                          end
         | 
| 121 | 
            +
                        end
         | 
| 122 | 
            +
                        records
         | 
| 105 123 | 
             
                      end
         | 
| 106 | 
            -
                      records
         | 
| 107 124 | 
             
                    end
         | 
| 108 125 |  | 
| 109 126 | 
             
                    def construct(ar_parent, parent, row, rs, seen, model_cache, aliases)
         | 
| @@ -5,9 +5,10 @@ module Bullet | |
| 5 5 | 
             
                def caller_in_project
         | 
| 6 6 | 
             
                  app_root = rails? ? Rails.root.to_s : Dir.pwd
         | 
| 7 7 | 
             
                  vendor_root = app_root + VENDOR_PATH
         | 
| 8 | 
            +
                  bundler_path = Bundler.bundle_path.to_s
         | 
| 8 9 | 
             
                  caller_locations.select do |location|
         | 
| 9 10 | 
             
                    caller_path = location.absolute_path.to_s
         | 
| 10 | 
            -
                    caller_path.include?(app_root) && !caller_path.include?(vendor_root) ||
         | 
| 11 | 
            +
                    caller_path.include?(app_root) && !caller_path.include?(vendor_root) && !caller_path.include?(bundler_path) ||
         | 
| 11 12 | 
             
                      Bullet.stacktrace_includes.any? do |include_pattern|
         | 
| 12 13 | 
             
                        case include_pattern
         | 
| 13 14 | 
             
                        when String
         | 
    
        data/lib/bullet/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: bullet
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 5.7. | 
| 4 | 
            +
              version: 5.7.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Richard Huang
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018- | 
| 11 | 
            +
            date: 2018-02-17 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| @@ -160,7 +160,7 @@ files: | |
| 160 160 | 
             
            - tasks/bullet_tasks.rake
         | 
| 161 161 | 
             
            - test.sh
         | 
| 162 162 | 
             
            - update.sh
         | 
| 163 | 
            -
            homepage:  | 
| 163 | 
            +
            homepage: https://github.com/flyerhzm/bullet
         | 
| 164 164 | 
             
            licenses:
         | 
| 165 165 | 
             
            - MIT
         | 
| 166 166 | 
             
            metadata: {}
         |