bullet 5.7.2 → 5.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ed0e2ed3898670a46673b101bd879b8d108ac2c
4
- data.tar.gz: 6c919b7f0793fbbb653ae7b493adcc0d57342af4
3
+ metadata.gz: 74a6d3a3671ea862309e08ecd7cb438ff1a0b1fb
4
+ data.tar.gz: 4796ef4d3dc79f88cab4b3ea1800a368935c3e5b
5
5
  SHA512:
6
- metadata.gz: f921b2f8de2e9a222d17461f28547693e6442129f8bcd19ba19846054b057062f7ce699aae655a9fb032f68f6f347302f1112bdbe09986c11c17194bb81ee597
7
- data.tar.gz: 30a453003a415d5b932b8fe2a1dd86e012baf25dabecea8d473276b4bbe1de2276a4da6edc5b7c866a80da76fe008bac30d2b3c1e3c114ee2613973a09a1b0a9
6
+ metadata.gz: 1590f51058fa2b58b2adf9f0df431c542bac23e2ed33d42a8733a80419d756c253740bf3c2dc47c89a2945018674164efbe5ee4912880c1b49a366d608859a6e
7
+ data.tar.gz: 45ba5a4438cc5003b6b5e05e598a9e71ad3b3145996e19d7cc248bc0c6e5c7d03546d1aaf94158a1eb631957bf0fdeae44ef0701917957f1a60eb35f85c3aa1d
@@ -1,5 +1,10 @@
1
1
  ## Next Release
2
2
 
3
+ ## 5.7.3 (17/02/2018)
4
+
5
+ * Exclude configured bundler path in addition to '/vendor'
6
+ * Support rails 5.1.5
7
+
3
8
  ## 5.7.2 (18/01/2018)
4
9
 
5
10
  * Fix `caller_path` in `excluded_stacktrace_path`
data/README.md CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/bullet.png)](http://badge.fury.io/rb/bullet)
4
4
  [![Build Status](https://secure.travis-ci.org/flyerhzm/bullet.png)](http://travis-ci.org/flyerhzm/bullet)
5
- <a href="https://codeclimate.com/github/flyerhzm/bullet"><img src="https://codeclimate.com/github/flyerhzm/bullet.png" /></a>
6
- [ ![AwesomeCode Status for flyerhzm/bullet](https://awesomecode.io/projects/6755235b-e2c1-459e-bf92-b8b13d0c0472/status)](https://awesomecode.io/projects/2)
5
+ [![AwesomeCode Status](https://awesomecode.io/projects/6755235b-e2c1-459e-bf92-b8b13d0c0472/status)](https://awesomecode.io/projects/2)
7
6
  [![Coderwall Endorse](http://api.coderwall.com/flyerhzm/endorsecount.png)](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.
@@ -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 = 'http://github.com/flyerhzm/bullet'
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
- def instantiate(result_set, aliases)
97
- @bullet_eager_loadings = {}
98
- records = super
99
-
100
- if Bullet.start?
101
- @bullet_eager_loadings.each do |_klazz, eager_loadings_hash|
102
- objects = eager_loadings_hash.keys
103
- Bullet::Detector::UnusedEagerLoading.add_eager_loadings(objects, eager_loadings_hash[objects.first].to_a)
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
@@ -1,3 +1,3 @@
1
1
  module Bullet
2
- VERSION = '5.7.2'.freeze
2
+ VERSION = '5.7.3'.freeze
3
3
  end
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.2
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-01-18 00:00:00.000000000 Z
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: http://github.com/flyerhzm/bullet
163
+ homepage: https://github.com/flyerhzm/bullet
164
164
  licenses:
165
165
  - MIT
166
166
  metadata: {}