bullet 4.13.1 → 5.5.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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +7 -11
  4. data/CHANGELOG.md +62 -3
  5. data/Gemfile.mongoid +0 -2
  6. data/Gemfile.mongoid-4.0 +1 -5
  7. data/{Gemfile.mongoid-2.8 → Gemfile.mongoid-5.0} +2 -6
  8. data/{Gemfile.mongoid-2.5 → Gemfile.mongoid-6.0} +2 -6
  9. data/Gemfile.rails-4.0 +2 -5
  10. data/Gemfile.rails-4.1 +2 -5
  11. data/{Gemfile.rails-3.0 → Gemfile.rails-4.2} +3 -6
  12. data/{Gemfile.rails-3.1 → Gemfile.rails-5.0} +2 -6
  13. data/Hacking.md +1 -0
  14. data/README.md +39 -7
  15. data/bullet.gemspec +1 -1
  16. data/lib/bullet/active_record4.rb +109 -33
  17. data/lib/bullet/active_record41.rb +99 -37
  18. data/lib/bullet/active_record42.rb +251 -0
  19. data/lib/bullet/active_record5.rb +243 -0
  20. data/lib/bullet/dependency.rb +34 -28
  21. data/lib/bullet/detector/association.rb +16 -16
  22. data/lib/bullet/detector/counter_cache.rb +13 -13
  23. data/lib/bullet/detector/n_plus_one_query.rb +30 -35
  24. data/lib/bullet/detector/unused_eager_loading.rb +12 -11
  25. data/lib/bullet/ext/object.rb +4 -2
  26. data/lib/bullet/{mongoid3x.rb → mongoid5x.rb} +3 -3
  27. data/lib/bullet/{mongoid2x.rb → mongoid6x.rb} +12 -12
  28. data/lib/bullet/notification/base.rb +9 -13
  29. data/lib/bullet/notification/n_plus_one_query.rb +8 -6
  30. data/lib/bullet/notification/unused_eager_loading.rb +18 -1
  31. data/lib/bullet/rack.rb +28 -16
  32. data/lib/bullet/stack_trace_filter.rb +34 -0
  33. data/lib/bullet/version.rb +1 -1
  34. data/lib/bullet.rb +48 -14
  35. data/spec/bullet/detector/counter_cache_spec.rb +8 -8
  36. data/spec/bullet/detector/n_plus_one_query_spec.rb +46 -31
  37. data/spec/bullet/detector/unused_eager_loading_spec.rb +17 -3
  38. data/spec/bullet/ext/object_spec.rb +6 -0
  39. data/spec/bullet/notification/base_spec.rb +4 -29
  40. data/spec/bullet/notification/n_plus_one_query_spec.rb +4 -4
  41. data/spec/bullet/notification/unused_eager_loading_spec.rb +3 -3
  42. data/spec/bullet/rack_spec.rb +38 -7
  43. data/spec/bullet_spec.rb +93 -0
  44. data/spec/integration/active_record4/association_spec.rb +112 -4
  45. data/spec/integration/{active_record3 → active_record5}/association_spec.rb +121 -15
  46. data/spec/integration/counter_cache_spec.rb +24 -1
  47. data/spec/models/category.rb +4 -1
  48. data/spec/models/comment.rb +2 -0
  49. data/spec/models/post.rb +7 -2
  50. data/spec/models/reply.rb +3 -0
  51. data/spec/models/submission.rb +1 -1
  52. data/spec/spec_helper.rb +3 -5
  53. data/spec/support/mongo_seed.rb +13 -0
  54. data/spec/support/sqlite_seed.rb +15 -6
  55. data/test.sh +4 -10
  56. data/update.sh +7 -0
  57. metadata +21 -23
  58. data/Gemfile.mongoid-2.4 +0 -19
  59. data/Gemfile.mongoid-2.6 +0 -19
  60. data/Gemfile.mongoid-2.7 +0 -19
  61. data/Gemfile.mongoid-3.0 +0 -19
  62. data/Gemfile.mongoid-3.1 +0 -19
  63. data/Gemfile.rails-3.2 +0 -19
  64. data/lib/bullet/active_record3.rb +0 -154
  65. data/lib/bullet/active_record3x.rb +0 -134
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- if !mongoid? && active_record3?
3
+ if !mongoid? && active_record5?
4
4
  describe Bullet::Detector::Association, 'has_many' do
5
5
  context "post => comments" do
6
6
  it "should detect non preload post => comments" do
@@ -13,6 +13,16 @@ if !mongoid? && active_record3?
13
13
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
14
14
  end
15
15
 
16
+ it "should detect non preload post => comments for find_by_sql" do
17
+ Post.find_by_sql("SELECT * FROM posts").each do |post|
18
+ post.comments.map(&:name)
19
+ end
20
+ Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
21
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
22
+
23
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
24
+ end
25
+
16
26
  it "should detect preload with post => comments" do
17
27
  Post.includes(:comments).each do |post|
18
28
  post.comments.map(&:name)
@@ -39,7 +49,7 @@ if !mongoid? && active_record3?
39
49
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
40
50
  end
41
51
 
42
- it "should not detect non preload comment => post with inverse_of" do
52
+ it "should detect non preload comment => post with inverse_of" do
43
53
  Post.includes(:comments).each do |post|
44
54
  post.comments.each do |comment|
45
55
  comment.name
@@ -72,6 +82,16 @@ if !mongoid? && active_record3?
72
82
 
73
83
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Post, :comments)
74
84
  end
85
+
86
+ it "should not detect unused preload person => pets with empty?" do
87
+ Person.all.each do |person|
88
+ person.pets.empty?
89
+ end
90
+ Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
91
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
92
+
93
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
94
+ end
75
95
  end
76
96
 
77
97
  context "category => posts => comments" do
@@ -114,7 +134,7 @@ if !mongoid? && active_record3?
114
134
  end
115
135
 
116
136
  it "should detect preload with category => posts => comments with posts.id > 0" do
117
- Category.includes({:posts => :comments}).where('posts.id > 0').each do |category|
137
+ Category.includes({:posts => :comments}).where('posts.id > 0').references(:posts).each do |category|
118
138
  category.posts.each do |post|
119
139
  post.comments.map(&:name)
120
140
  end
@@ -204,7 +224,7 @@ if !mongoid? && active_record3?
204
224
  context "post => comment" do
205
225
  it "should detect unused preload with post => comments" do
206
226
  Post.includes(:comments).each do |post|
207
- post.comments.first.name
227
+ post.comments.first.name if post.comments.first
208
228
  end
209
229
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
210
230
  expect(Bullet::Detector::Association).not_to be_unused_preload_associations_for(Post, :comments)
@@ -219,6 +239,20 @@ if !mongoid? && active_record3?
219
239
 
220
240
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
221
241
  end
242
+
243
+ it "should not detect unused preload with category => posts" do
244
+ category = Category.first
245
+ category.draft_post.destroy!
246
+ post = category.draft_post
247
+ post.update_attributes!(link: true)
248
+ Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
249
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
250
+
251
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
252
+
253
+ Support::SqliteSeed.setup_db
254
+ Support::SqliteSeed.seed_db
255
+ end
222
256
  end
223
257
 
224
258
  context "category => posts => writer" do
@@ -231,14 +265,12 @@ if !mongoid? && active_record3?
231
265
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
232
266
  expect(Bullet::Detector::Association).not_to be_unused_preload_associations_for(Category, :posts)
233
267
  expect(Bullet::Detector::Association).not_to be_unused_preload_associations_for(Post, :writer)
234
-
235
- expect(Bullet::Detector::Association).to be_completely_preloading_associations
236
268
  end
237
269
  end
238
270
 
239
271
  context "scope for_category_name" do
240
272
  it "should detect preload with post => category" do
241
- Post.in_category_name('first').each do |post|
273
+ Post.in_category_name('first').references(:categories).each do |post|
242
274
  post.category.name
243
275
  end
244
276
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
@@ -248,7 +280,7 @@ if !mongoid? && active_record3?
248
280
  end
249
281
 
250
282
  it "should not be unused preload post => category" do
251
- Post.in_category_name('first').all.map(&:name)
283
+ Post.in_category_name('first').references(:categories).map(&:name)
252
284
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
253
285
  expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
254
286
 
@@ -315,7 +347,7 @@ if !mongoid? && active_record3?
315
347
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
316
348
  end
317
349
 
318
- it "should detect unused preload with comments => post" do
350
+ it "should detect unused preload with comment => post" do
319
351
  Comment.includes(:post).map(&:name)
320
352
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
321
353
  expect(Bullet::Detector::Association).to be_unused_preload_associations_for(Comment, :post)
@@ -335,6 +367,15 @@ if !mongoid? && active_record3?
335
367
  expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Comment, :post)
336
368
  end
337
369
 
370
+ it "should not detect non preload association with only one comment" do
371
+ Comment.first.post.category.name
372
+
373
+ Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
374
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
375
+
376
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
377
+ end
378
+
338
379
  it "should detect non preload association with post => category" do
339
380
  Comment.includes(:post).each do |comment|
340
381
  comment.post.category.name
@@ -358,7 +399,7 @@ if !mongoid? && active_record3?
358
399
 
359
400
  context "comment => author, post => writer" do
360
401
  it "should detect non preloaded writer" do
361
- Comment.includes([:author, :post]).where(["base_users.id = ?", BaseUser.first]).each do |comment|
402
+ Comment.includes([:author, :post]).where(["base_users.id = ?", BaseUser.first]).references(:base_users).each do |comment|
362
403
  comment.post.writer.name
363
404
  end
364
405
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
@@ -368,7 +409,7 @@ if !mongoid? && active_record3?
368
409
  end
369
410
 
370
411
  it "should detect unused preload with comment => author" do
371
- Comment.includes([:author, {:post => :writer}]).where(["base_users.id = ?", BaseUser.first]).each do |comment|
412
+ Comment.includes([:author, {:post => :writer}]).where(["base_users.id = ?", BaseUser.first]).references(:base_users).each do |comment|
372
413
  comment.post.writer.name
373
414
  end
374
415
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
@@ -378,7 +419,7 @@ if !mongoid? && active_record3?
378
419
  end
379
420
 
380
421
  it "should detect non preloading with writer => newspaper" do
381
- Comment.all(:include => {:post => :writer}, :conditions => "posts.name like '%first%'").each do |comment|
422
+ Comment.includes(:post => :writer).where("posts.name like '%first%'").references(:posts).each do |comment|
382
423
  comment.post.writer.newspaper.name
383
424
  end
384
425
  Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
@@ -392,7 +433,7 @@ if !mongoid? && active_record3?
392
433
  Comment.includes({:post => :category}).each do |com|
393
434
  com.post.category
394
435
  end
395
- }.not_to raise_error
436
+ }.not_to raise_error()
396
437
  end
397
438
  end
398
439
  end
@@ -434,6 +475,16 @@ if !mongoid? && active_record3?
434
475
 
435
476
  expect(Bullet::Detector::Association).to be_completely_preloading_associations
436
477
  end
478
+
479
+ it "should detect non preload student => teachers with empty?" do
480
+ Student.all.each do |student|
481
+ student.teachers.empty?
482
+ end
483
+ Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
484
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
485
+
486
+ expect(Bullet::Detector::Association).to be_detecting_unpreloaded_association_for(Student, :teachers)
487
+ end
437
488
  end
438
489
  end
439
490
 
@@ -517,6 +568,17 @@ if !mongoid? && active_record3?
517
568
  end
518
569
  end
519
570
 
571
+ describe Bullet::Detector::Association, "has_one => has_many" do
572
+ it "should not detect preload association" do
573
+ user = User.first
574
+ user.submission.replies.map(&:name)
575
+ Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
576
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
577
+
578
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
579
+ end
580
+ end
581
+
520
582
  describe Bullet::Detector::Association, "call one association that in possible objects" do
521
583
  it "should not detect preload association" do
522
584
  Post.all
@@ -528,6 +590,50 @@ if !mongoid? && active_record3?
528
590
  end
529
591
  end
530
592
 
593
+ describe Bullet::Detector::Association, "query immediately after creation" do
594
+ context "with save" do
595
+ context "document => children" do
596
+ it 'should not detect non preload associations' do
597
+ document1 = Document.new
598
+ document1.children.build
599
+ document1.save
600
+
601
+ document2 = Document.new(parent: document1)
602
+ document2.save
603
+ document2.parent
604
+
605
+ document1.children.each.first
606
+
607
+ Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
608
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
609
+
610
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
611
+ end
612
+ end
613
+ end
614
+
615
+ context "with save!" do
616
+ context "document => children" do
617
+ it 'should not detect non preload associations' do
618
+ document1 = Document.new
619
+ document1.children.build
620
+ document1.save!
621
+
622
+ document2 = Document.new(parent: document1)
623
+ document2.save!
624
+ document2.parent
625
+
626
+ document1.children.each.first
627
+
628
+ Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
629
+ expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
630
+
631
+ expect(Bullet::Detector::Association).to be_completely_preloading_associations
632
+ end
633
+ end
634
+ end
635
+ end
636
+
531
637
  describe Bullet::Detector::Association, "STI" do
532
638
  context "page => author" do
533
639
  it "should detect non preload associations" do
@@ -615,7 +721,7 @@ if !mongoid? && active_record3?
615
721
 
616
722
  context "whitelist n plus one query" do
617
723
  before { Bullet.add_whitelist :type => :n_plus_one_query, :class_name => "Post", :association => :comments }
618
- after { Bullet.reset_whitelist }
724
+ after { Bullet.clear_whitelist }
619
725
 
620
726
  it "should not detect n plus one query" do
621
727
  Post.all.each do |post|
@@ -638,7 +744,7 @@ if !mongoid? && active_record3?
638
744
 
639
745
  context "whitelist unused eager loading" do
640
746
  before { Bullet.add_whitelist :type => :unused_eager_loading, :class_name => "Post", :association => :comments }
641
- after { Bullet.reset_whitelist }
747
+ after { Bullet.clear_whitelist }
642
748
 
643
749
  it "should not detect unused eager loading" do
644
750
  Post.includes(:comments).map(&:name)
@@ -29,6 +29,29 @@ if !mongoid? && active_record?
29
29
  expect(Bullet.collected_counter_cache_notifications).to be_empty
30
30
  end
31
31
 
32
+ it "should not need counter cache without size" do
33
+ Country.includes(:cities).each do |country|
34
+ country.cities.empty?
35
+ end
36
+ expect(Bullet.collected_counter_cache_notifications).to be_empty
37
+ end
38
+
39
+ if active_record5?
40
+ it "should not need counter cache for has_many through" do
41
+ Client.all.each do |client|
42
+ client.firms.size
43
+ end
44
+ expect(Bullet.collected_counter_cache_notifications).to be_empty
45
+ end
46
+ else
47
+ it "should need counter cache for has_many through" do
48
+ Client.all.each do |client|
49
+ client.firms.size
50
+ end
51
+ expect(Bullet.collected_counter_cache_notifications).not_to be_empty
52
+ end
53
+ end
54
+
32
55
  it "should not need counter cache with part of cities" do
33
56
  Country.all.each do |country|
34
57
  country.cities.where(:name => 'first').size
@@ -50,7 +73,7 @@ if !mongoid? && active_record?
50
73
 
51
74
  context "whitelist" do
52
75
  before { Bullet.add_whitelist :type => :counter_cache, :class_name => "Country", :association => :cities }
53
- after { Bullet.reset_whitelist }
76
+ after { Bullet.clear_whitelist }
54
77
 
55
78
  it "should not detect counter cache" do
56
79
  Country.all.each do |country|
@@ -2,6 +2,9 @@ class Category < ActiveRecord::Base
2
2
  has_many :posts, inverse_of: :category
3
3
  has_many :entries
4
4
 
5
- has_many :submissions
6
5
  has_many :users
6
+
7
+ def draft_post
8
+ posts.draft.first_or_create
9
+ end
7
10
  end
@@ -1,4 +1,6 @@
1
1
  class Comment < ActiveRecord::Base
2
2
  belongs_to :post, inverse_of: :comments
3
3
  belongs_to :author, class_name: "BaseUser"
4
+
5
+ validates :post, presence: true
4
6
  end
data/spec/models/post.rb CHANGED
@@ -1,10 +1,15 @@
1
1
  class Post < ActiveRecord::Base
2
- extend Bullet::Dependency
3
-
4
2
  belongs_to :category, inverse_of: :posts
5
3
  belongs_to :writer
6
4
  has_many :comments, inverse_of: :post
7
5
 
6
+ validates :category, presence: true
7
+
8
8
  scope :preload_comments, -> { includes(:comments) }
9
9
  scope :in_category_name, ->(name) { where(['categories.name = ?', name]).includes(:category) }
10
+ scope :draft, -> { where(active: false) }
11
+
12
+ def link=(*)
13
+ comments.new
14
+ end
10
15
  end
@@ -0,0 +1,3 @@
1
+ class Reply < ActiveRecord::Base
2
+ belongs_to :submission
3
+ end
@@ -1,4 +1,4 @@
1
1
  class Submission < ActiveRecord::Base
2
- belongs_to :category
3
2
  belongs_to :user
3
+ has_many :replies
4
4
  end
data/spec/spec_helper.rb CHANGED
@@ -30,9 +30,6 @@ $LOAD_PATH.unshift(MODELS)
30
30
  SUPPORT = File.join(File.dirname(__FILE__), "support")
31
31
  Dir[ File.join(SUPPORT, "*.rb") ].reject { |filename| filename =~ /_seed.rb$/ }.sort.each { |file| require file }
32
32
 
33
- require 'coveralls'
34
- Coveralls.wear!
35
-
36
33
  RSpec.configure do |config|
37
34
  config.extend Bullet::Dependency
38
35
 
@@ -56,11 +53,12 @@ if active_record?
56
53
  Support::SqliteSeed.seed_db
57
54
  end
58
55
 
59
- config.before(:each) do
56
+ config.before(:example) do
60
57
  Bullet.start_request
58
+ Bullet.enable = true
61
59
  end
62
60
 
63
- config.after(:each) do
61
+ config.after(:example) do
64
62
  Bullet.end_request
65
63
  end
66
64
  end
@@ -52,6 +52,19 @@ module Support
52
52
  }
53
53
  )
54
54
  end
55
+ elsif Mongoid::VERSION =~ /\A5/
56
+ Mongoid.configure do |config|
57
+ config.load_configuration(
58
+ clients: {
59
+ default: {
60
+ database: "bullet",
61
+ hosts: [ "localhost:27017" ]
62
+ }
63
+ }
64
+ )
65
+ end
66
+ # Increase the level from DEBUG in order to avoid excessive logging to the screen
67
+ Mongo::Logger.logger.level = Logger::WARN
55
68
  end
56
69
  end
57
70
 
@@ -14,8 +14,9 @@ module Support
14
14
  category2 = Category.create(:name => 'second')
15
15
 
16
16
  post1 = category1.posts.create(:name => 'first', :writer => writer1)
17
- post1a = category1.posts.create(:name => 'like first', :writer => writer2)
17
+ post1a = category1.posts.create(:name => 'like first', :writer => writer2, active: false)
18
18
  post2 = category2.posts.create(:name => 'second', :writer => writer2)
19
+ post3 = category2.posts.create(:name => 'third', :writer => writer2)
19
20
 
20
21
  comment1 = post1.comments.create(:name => 'first', :author => writer1)
21
22
  comment2 = post1.comments.create(:name => 'first2', :author => writer1)
@@ -82,10 +83,13 @@ module Support
82
83
  user1 = User.create(:name => 'user1', :category => category1)
83
84
  user2 = User.create(:name => 'user2', :category => category1)
84
85
 
85
- submission1 = category1.submissions.create(:name => "submission1", :user => user1)
86
- submission2 = category1.submissions.create(:name => "submission2", :user => user2)
87
- submission3 = category2.submissions.create(:name => "submission3", :user => user1)
88
- submission4 = category2.submissions.create(:name => "submission4", :user => user2)
86
+ submission1 = user1.create_submission(:name => "submission1")
87
+ submission2 = user2.create_submission(:name => "submission2")
88
+
89
+ submission1.replies.create(:name => 'reply1')
90
+ submission1.replies.create(:name => 'reply2')
91
+ submission2.replies.create(:name => 'reply3')
92
+ submission2.replies.create(:name => 'reply4')
89
93
  end
90
94
 
91
95
  def setup_db
@@ -191,6 +195,7 @@ module Support
191
195
  t.column :name, :string
192
196
  t.column :category_id, :integer
193
197
  t.column :writer_id, :integer
198
+ t.column :active, :boolean, :default => true
194
199
  end
195
200
 
196
201
  create_table :relationships do |t|
@@ -211,9 +216,13 @@ module Support
211
216
  t.column :name, :string
212
217
  end
213
218
 
219
+ create_table :replies do |t|
220
+ t.column :name, :string
221
+ t.column :submission_id, :integer
222
+ end
223
+
214
224
  create_table :submissions do |t|
215
225
  t.column :name, :string
216
- t.column :category_id, :integer
217
226
  t.column :user_id, :integer
218
227
  end
219
228
 
data/test.sh CHANGED
@@ -1,15 +1,9 @@
1
1
  #bundle update rails && bundle exec rspec spec
2
2
  #BUNDLE_GEMFILE=Gemfile.mongoid bundle update mongoid && BUNDLE_GEMFILE=Gemfile.mongoid bundle exec rspec spec
3
+ BUNDLE_GEMFILE=Gemfile.rails-5.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-5.0 bundle exec rspec spec
4
+ BUNDLE_GEMFILE=Gemfile.rails-4.2 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.2 bundle exec rspec spec
3
5
  BUNDLE_GEMFILE=Gemfile.rails-4.1 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.1 bundle exec rspec spec
4
6
  BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle exec rspec spec
5
- BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle exec rspec spec
6
- BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle exec rspec spec
7
- BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle exec rspec spec
7
+ BUNDLE_GEMFILE=Gemfile.mongoid-6.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-6.0 bundle exec rspec spec
8
+ BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle exec rspec spec
8
9
  BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle exec rspec spec
9
- BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle exec rspec spec
10
- BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle exec rspec spec
11
- BUNDLE_GEMFILE=Gemfile.mongoid-2.8 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.8 bundle exec rspec spec
12
- BUNDLE_GEMFILE=Gemfile.mongoid-2.7 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.7 bundle exec rspec spec
13
- BUNDLE_GEMFILE=Gemfile.mongoid-2.6 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.6 bundle exec rspec spec
14
- BUNDLE_GEMFILE=Gemfile.mongoid-2.5 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.5 bundle exec rspec spec
15
- BUNDLE_GEMFILE=Gemfile.mongoid-2.4 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.4 bundle exec rspec spec
data/update.sh ADDED
@@ -0,0 +1,7 @@
1
+ BUNDLE_GEMFILE=Gemfile.rails-5.0 bundle update
2
+ BUNDLE_GEMFILE=Gemfile.rails-4.2 bundle update
3
+ BUNDLE_GEMFILE=Gemfile.rails-4.1 bundle update
4
+ BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle update
5
+ BUNDLE_GEMFILE=Gemfile.mongoid-6.0 bundle update
6
+ BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle update
7
+ BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle update
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: 4.13.1
4
+ version: 5.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-03 00:00:00.000000000 Z
11
+ date: 2016-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: uniform_notifier
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.6.0
33
+ version: 1.10.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.6.0
40
+ version: 1.10.0
41
41
  description: help to kill N+1 queries and unused eager loading.
42
42
  email:
43
43
  - flyerhzm@gmail.com
@@ -51,19 +51,13 @@ files:
51
51
  - CHANGELOG.md
52
52
  - Gemfile
53
53
  - Gemfile.mongoid
54
- - Gemfile.mongoid-2.4
55
- - Gemfile.mongoid-2.5
56
- - Gemfile.mongoid-2.6
57
- - Gemfile.mongoid-2.7
58
- - Gemfile.mongoid-2.8
59
- - Gemfile.mongoid-3.0
60
- - Gemfile.mongoid-3.1
61
54
  - Gemfile.mongoid-4.0
62
- - Gemfile.rails-3.0
63
- - Gemfile.rails-3.1
64
- - Gemfile.rails-3.2
55
+ - Gemfile.mongoid-5.0
56
+ - Gemfile.mongoid-6.0
65
57
  - Gemfile.rails-4.0
66
58
  - Gemfile.rails-4.1
59
+ - Gemfile.rails-4.2
60
+ - Gemfile.rails-5.0
67
61
  - Guardfile
68
62
  - Hacking.md
69
63
  - MIT-LICENSE
@@ -71,10 +65,10 @@ files:
71
65
  - Rakefile
72
66
  - bullet.gemspec
73
67
  - lib/bullet.rb
74
- - lib/bullet/active_record3.rb
75
- - lib/bullet/active_record3x.rb
76
68
  - lib/bullet/active_record4.rb
77
69
  - lib/bullet/active_record41.rb
70
+ - lib/bullet/active_record42.rb
71
+ - lib/bullet/active_record5.rb
78
72
  - lib/bullet/dependency.rb
79
73
  - lib/bullet/detector.rb
80
74
  - lib/bullet/detector/association.rb
@@ -84,9 +78,9 @@ files:
84
78
  - lib/bullet/detector/unused_eager_loading.rb
85
79
  - lib/bullet/ext/object.rb
86
80
  - lib/bullet/ext/string.rb
87
- - lib/bullet/mongoid2x.rb
88
- - lib/bullet/mongoid3x.rb
89
81
  - lib/bullet/mongoid4x.rb
82
+ - lib/bullet/mongoid5x.rb
83
+ - lib/bullet/mongoid6x.rb
90
84
  - lib/bullet/notification.rb
91
85
  - lib/bullet/notification/base.rb
92
86
  - lib/bullet/notification/counter_cache.rb
@@ -98,6 +92,7 @@ files:
98
92
  - lib/bullet/registry/association.rb
99
93
  - lib/bullet/registry/base.rb
100
94
  - lib/bullet/registry/object.rb
95
+ - lib/bullet/stack_trace_filter.rb
101
96
  - lib/bullet/version.rb
102
97
  - perf/benchmark.rb
103
98
  - rails/init.rb
@@ -118,8 +113,8 @@ files:
118
113
  - spec/bullet/registry/base_spec.rb
119
114
  - spec/bullet/registry/object_spec.rb
120
115
  - spec/bullet_spec.rb
121
- - spec/integration/active_record3/association_spec.rb
122
116
  - spec/integration/active_record4/association_spec.rb
117
+ - spec/integration/active_record5/association_spec.rb
123
118
  - spec/integration/counter_cache_spec.rb
124
119
  - spec/integration/mongoid/association_spec.rb
125
120
  - spec/models/address.rb
@@ -148,6 +143,7 @@ files:
148
143
  - spec/models/pet.rb
149
144
  - spec/models/post.rb
150
145
  - spec/models/relationship.rb
146
+ - spec/models/reply.rb
151
147
  - spec/models/student.rb
152
148
  - spec/models/submission.rb
153
149
  - spec/models/teacher.rb
@@ -160,6 +156,7 @@ files:
160
156
  - spec/support/sqlite_seed.rb
161
157
  - tasks/bullet_tasks.rake
162
158
  - test.sh
159
+ - update.sh
163
160
  homepage: http://github.com/flyerhzm/bullet
164
161
  licenses:
165
162
  - MIT
@@ -180,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
177
  version: 1.3.6
181
178
  requirements: []
182
179
  rubyforge_project:
183
- rubygems_version: 2.2.2
180
+ rubygems_version: 2.5.1
184
181
  signing_key:
185
182
  specification_version: 4
186
183
  summary: help to kill N+1 queries and unused eager loading.
@@ -202,8 +199,8 @@ test_files:
202
199
  - spec/bullet/registry/base_spec.rb
203
200
  - spec/bullet/registry/object_spec.rb
204
201
  - spec/bullet_spec.rb
205
- - spec/integration/active_record3/association_spec.rb
206
202
  - spec/integration/active_record4/association_spec.rb
203
+ - spec/integration/active_record5/association_spec.rb
207
204
  - spec/integration/counter_cache_spec.rb
208
205
  - spec/integration/mongoid/association_spec.rb
209
206
  - spec/models/address.rb
@@ -232,6 +229,7 @@ test_files:
232
229
  - spec/models/pet.rb
233
230
  - spec/models/post.rb
234
231
  - spec/models/relationship.rb
232
+ - spec/models/reply.rb
235
233
  - spec/models/student.rb
236
234
  - spec/models/submission.rb
237
235
  - spec/models/teacher.rb
data/Gemfile.mongoid-2.4 DELETED
@@ -1,19 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
4
-
5
- gem 'rails', '~> 3.2.16'
6
- gem 'sqlite3', platforms: [:ruby]
7
- gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
8
- gem 'mongoid', '~> 2.4.12'
9
-
10
- gem "rspec"
11
- gem "guard"
12
- gem "guard-rspec"
13
-
14
- gem 'coveralls', require: false
15
-
16
- platforms :rbx do
17
- gem 'rubysl', '~> 2.0'
18
- gem 'rubinius-developer_tools'
19
- end
data/Gemfile.mongoid-2.6 DELETED
@@ -1,19 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
4
-
5
- gem 'rails', '~> 3.2.16'
6
- gem 'sqlite3', platforms: [:ruby]
7
- gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
8
- gem 'mongoid', '~> 2.6.0'
9
-
10
- gem "rspec"
11
- gem "guard"
12
- gem "guard-rspec"
13
-
14
- gem 'coveralls', require: false
15
-
16
- platforms :rbx do
17
- gem 'rubysl', '~> 2.0'
18
- gem 'rubinius-developer_tools'
19
- end