bullet 5.4.3 → 5.6.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 (50) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +1 -96
  4. data/CHANGELOG.md +13 -7
  5. data/Gemfile +6 -1
  6. data/Gemfile.mongoid-5.0 +1 -1
  7. data/{Gemfile.mongoid-2.4 → Gemfile.mongoid-6.0} +2 -2
  8. data/Gemfile.rails-5.0 +1 -1
  9. data/{Gemfile.mongoid-2.5 → Gemfile.rails-5.1} +3 -3
  10. data/Hacking.md +1 -1
  11. data/README.md +14 -20
  12. data/lib/bullet/active_record4.rb +2 -2
  13. data/lib/bullet/active_record41.rb +5 -6
  14. data/lib/bullet/active_record42.rb +6 -19
  15. data/lib/bullet/active_record5.rb +44 -62
  16. data/lib/bullet/dependency.rb +8 -34
  17. data/lib/bullet/detector/association.rb +2 -2
  18. data/lib/bullet/detector/n_plus_one_query.rb +6 -5
  19. data/lib/bullet/ext/object.rb +1 -1
  20. data/lib/bullet/ext/string.rb +1 -1
  21. data/lib/bullet/{mongoid3x.rb → mongoid6x.rb} +3 -3
  22. data/lib/bullet/notification/base.rb +1 -1
  23. data/lib/bullet/notification/n_plus_one_query.rb +3 -3
  24. data/lib/bullet/notification/unused_eager_loading.rb +12 -7
  25. data/lib/bullet/rack.rb +7 -2
  26. data/lib/bullet/stack_trace_filter.rb +2 -1
  27. data/lib/bullet/version.rb +1 -1
  28. data/lib/generators/bullet/install_generator.rb +46 -0
  29. data/spec/bullet/detector/n_plus_one_query_spec.rb +11 -11
  30. data/spec/bullet/notification/n_plus_one_query_spec.rb +3 -3
  31. data/spec/bullet/notification/unused_eager_loading_spec.rb +1 -1
  32. data/spec/integration/{active_record4 → active_record}/association_spec.rb +1 -1
  33. data/spec/integration/counter_cache_spec.rb +7 -0
  34. data/spec/support/mongo_seed.rb +2 -10
  35. data/test.sh +1 -10
  36. data/update.sh +1 -10
  37. metadata +9 -23
  38. data/Gemfile.mongoid-2.6 +0 -15
  39. data/Gemfile.mongoid-2.7 +0 -15
  40. data/Gemfile.mongoid-2.8 +0 -15
  41. data/Gemfile.mongoid-3.0 +0 -15
  42. data/Gemfile.mongoid-3.1 +0 -15
  43. data/Gemfile.rails-3.0 +0 -16
  44. data/Gemfile.rails-3.1 +0 -16
  45. data/Gemfile.rails-3.2 +0 -16
  46. data/lib/bullet/active_record3.rb +0 -238
  47. data/lib/bullet/active_record3x.rb +0 -210
  48. data/lib/bullet/mongoid2x.rb +0 -56
  49. data/spec/integration/active_record3/association_spec.rb +0 -745
  50. data/spec/integration/active_record5/association_spec.rb +0 -768
@@ -14,11 +14,7 @@ module Bullet
14
14
 
15
15
  def active_record_version
16
16
  @active_record_version ||= begin
17
- if active_record30?
18
- 'active_record3'
19
- elsif active_record31? || active_record32?
20
- 'active_record3x'
21
- elsif active_record40?
17
+ if active_record40?
22
18
  'active_record4'
23
19
  elsif active_record41?
24
20
  'active_record41'
@@ -36,24 +32,18 @@ module Bullet
36
32
 
37
33
  def mongoid_version
38
34
  @mongoid_version ||= begin
39
- if mongoid2x?
40
- 'mongoid2x'
41
- elsif mongoid3x?
42
- 'mongoid3x'
43
- elsif mongoid4x?
35
+ if mongoid4x?
44
36
  'mongoid4x'
45
37
  elsif mongoid5x?
46
38
  'mongoid5x'
39
+ elsif mongoid6x?
40
+ 'mongoid6x'
47
41
  else
48
42
  raise "Bullet does not support mongoid #{::Mongoid::VERSION} yet"
49
43
  end
50
44
  end
51
45
  end
52
46
 
53
- def active_record3?
54
- active_record? && ::ActiveRecord::VERSION::MAJOR == 3
55
- end
56
-
57
47
  def active_record4?
58
48
  active_record? && ::ActiveRecord::VERSION::MAJOR == 4
59
49
  end
@@ -62,18 +52,6 @@ module Bullet
62
52
  active_record? && ::ActiveRecord::VERSION::MAJOR == 5
63
53
  end
64
54
 
65
- def active_record30?
66
- active_record3? && ::ActiveRecord::VERSION::MINOR == 0
67
- end
68
-
69
- def active_record31?
70
- active_record3? && ::ActiveRecord::VERSION::MINOR == 1
71
- end
72
-
73
- def active_record32?
74
- active_record3? && ::ActiveRecord::VERSION::MINOR == 2
75
- end
76
-
77
55
  def active_record40?
78
56
  active_record4? && ::ActiveRecord::VERSION::MINOR == 0
79
57
  end
@@ -94,14 +72,6 @@ module Bullet
94
72
  active_record5? && ::ActiveRecord::VERSION::MINOR == 1
95
73
  end
96
74
 
97
- def mongoid2x?
98
- mongoid? && ::Mongoid::VERSION =~ /\A2\.[4-9]/
99
- end
100
-
101
- def mongoid3x?
102
- mongoid? && ::Mongoid::VERSION =~ /\A3/
103
- end
104
-
105
75
  def mongoid4x?
106
76
  mongoid? && ::Mongoid::VERSION =~ /\A4/
107
77
  end
@@ -109,5 +79,9 @@ module Bullet
109
79
  def mongoid5x?
110
80
  mongoid? && ::Mongoid::VERSION =~ /\A5/
111
81
  end
82
+
83
+ def mongoid6x?
84
+ mongoid? && ::Mongoid::VERSION =~ /\A6/
85
+ end
112
86
  end
113
87
  end
@@ -7,7 +7,7 @@ module Bullet
7
7
  return if !Bullet.n_plus_one_query_enable? && !Bullet.unused_eager_loading_enable?
8
8
  return unless object.primary_key_value
9
9
 
10
- Bullet.debug("Detector::Association#add_object_associations", "object: #{object.bullet_key}, associations: #{associations}")
10
+ Bullet.debug("Detector::Association#add_object_associations".freeze, "object: #{object.bullet_key}, associations: #{associations}")
11
11
  object_associations.add(object.bullet_key, associations)
12
12
  end
13
13
 
@@ -16,7 +16,7 @@ module Bullet
16
16
  return if !Bullet.n_plus_one_query_enable? && !Bullet.unused_eager_loading_enable?
17
17
  return unless object.primary_key_value
18
18
 
19
- Bullet.debug("Detector::Association#add_call_object_associations", "object: #{object.bullet_key}, associations: #{associations}")
19
+ Bullet.debug("Detector::Association#add_call_object_associations".freeze, "object: #{object.bullet_key}, associations: #{associations}")
20
20
  call_object_associations.add(object.bullet_key, associations)
21
21
  end
22
22
 
@@ -11,11 +11,12 @@ module Bullet
11
11
  # if it is, keeps this unpreload associations and caller.
12
12
  def call_association(object, associations)
13
13
  return unless Bullet.start?
14
+ return unless Bullet.n_plus_one_query_enable?
14
15
  return unless object.primary_key_value
15
16
  return if inversed_objects.include?(object.bullet_key, associations)
16
17
  add_call_object_associations(object, associations)
17
18
 
18
- Bullet.debug("Detector::NPlusOneQuery#call_association", "object: #{object.bullet_key}, associations: #{associations}")
19
+ Bullet.debug("Detector::NPlusOneQuery#call_association".freeze, "object: #{object.bullet_key}, associations: #{associations}")
19
20
  if !excluded_stacktrace_path? && conditions_met?(object, associations)
20
21
  Bullet.debug("detect n + 1 query", "object: #{object.bullet_key}, associations: #{associations}")
21
22
  create_notification caller_in_project, object.class.to_s, associations
@@ -28,7 +29,7 @@ module Bullet
28
29
  objects = Array(object_or_objects)
29
30
  return if objects.map(&:primary_key_value).compact.empty?
30
31
 
31
- Bullet.debug("Detector::NPlusOneQuery#add_possible_objects", "objects: #{objects.map(&:bullet_key).join(', ')}")
32
+ Bullet.debug("Detector::NPlusOneQuery#add_possible_objects".freeze, "objects: #{objects.map(&:bullet_key).join(', '.freeze)}")
32
33
  objects.each { |object| possible_objects.add object.bullet_key }
33
34
  end
34
35
 
@@ -37,7 +38,7 @@ module Bullet
37
38
  return unless Bullet.n_plus_one_query_enable?
38
39
  return unless object.primary_key_value
39
40
 
40
- Bullet.debug("Detector::NPlusOneQuery#add_impossible_object", "object: #{object.bullet_key}")
41
+ Bullet.debug("Detector::NPlusOneQuery#add_impossible_object".freeze, "object: #{object.bullet_key}")
41
42
  impossible_objects.add object.bullet_key
42
43
  end
43
44
 
@@ -46,7 +47,7 @@ module Bullet
46
47
  return unless Bullet.n_plus_one_query_enable?
47
48
  return unless object.primary_key_value
48
49
 
49
- Bullet.debug("Detector::NPlusOneQuery#add_inversed_object", "object: #{object.bullet_key}, association: #{association}")
50
+ Bullet.debug("Detector::NPlusOneQuery#add_inversed_object".freeze, "object: #{object.bullet_key}, association: #{association}")
50
51
  inversed_objects.add object.bullet_key, association
51
52
  end
52
53
 
@@ -68,7 +69,7 @@ module Bullet
68
69
  value = object_associations[object.bullet_key]
69
70
  if value
70
71
  value.each do |v|
71
- # associations == v comparision order is important here because
72
+ # associations == v comparison order is important here because
72
73
  # v variable might be a squeel node where :== method is redefined,
73
74
  # so it does not compare values at all and return unexpected results
74
75
  result = v.is_a?(Hash) ? v.key?(associations) : associations == v
@@ -5,7 +5,7 @@ class Object
5
5
 
6
6
  def primary_key_value
7
7
  if self.class.respond_to?(:primary_keys) && self.class.primary_keys
8
- self.class.primary_keys.map { |primary_key| self.send primary_key }.join(',')
8
+ self.class.primary_keys.map { |primary_key| self.send primary_key }.join(','.freeze)
9
9
  elsif self.class.respond_to?(:primary_key) && self.class.primary_key
10
10
  self.send self.class.primary_key
11
11
  else
@@ -1,5 +1,5 @@
1
1
  class String
2
2
  def bullet_class_name
3
- self.sub(/:[^:]*?$/, "")
3
+ self.sub(/:[^:]*?$/, "".freeze)
4
4
  end
5
5
  end
@@ -21,7 +21,7 @@ module Bullet
21
21
  end
22
22
 
23
23
  def each(&block)
24
- records = query.map{ |doc| ::Mongoid::Factory.from_db(klass, doc) }
24
+ records = view.map{ |doc| ::Mongoid::Factory.from_db(klass, doc) }
25
25
  if records.length > 1
26
26
  Bullet::Detector::NPlusOneQuery.add_possible_objects(records)
27
27
  elsif records.size == 1
@@ -43,8 +43,8 @@ module Bullet
43
43
  ::Mongoid::Relations::Accessors.class_eval do
44
44
  alias_method :origin_get_relation, :get_relation
45
45
 
46
- def get_relation(name, metadata, reload = false)
47
- result = origin_get_relation(name, metadata, reload)
46
+ def get_relation(name, metadata, object, reload = false)
47
+ result = origin_get_relation(name, metadata, object, reload)
48
48
  if metadata.macro !~ /embed/
49
49
  Bullet::Detector::NPlusOneQuery.call_association(self, name)
50
50
  end
@@ -66,7 +66,7 @@ module Bullet
66
66
 
67
67
  protected
68
68
  def klazz_associations_str
69
- " #{@base_class} => [#{@associations.map(&:inspect).join(', ')}]"
69
+ " #{@base_class} => [#{@associations.map(&:inspect).join(', '.freeze)}]"
70
70
  end
71
71
 
72
72
  def associations_str
@@ -12,18 +12,18 @@ module Bullet
12
12
  end
13
13
 
14
14
  def title
15
- "N+1 Query #{@path ? "in #{@path}" : 'detected'}"
15
+ "USE eager loading #{@path ? "in #{@path}" : 'detected'}"
16
16
  end
17
17
 
18
18
  def notification_data
19
19
  super.merge(
20
- :backtrace => @callers
20
+ :backtrace => []
21
21
  )
22
22
  end
23
23
 
24
24
  protected
25
25
  def call_stack_messages
26
- (['N+1 Query method call stack'] + @callers).join( "\n " )
26
+ (['Call stack'] + @callers).join( "\n " )
27
27
  end
28
28
  end
29
29
  end
@@ -7,19 +7,24 @@ module Bullet
7
7
  @callers = callers
8
8
  end
9
9
 
10
- def notification_data
11
- super.merge(
12
- :backtrace => @callers
13
- )
14
- end
15
-
16
10
  def body
17
11
  "#{klazz_associations_str}\n Remove from your finder: #{associations_str}"
18
12
  end
19
13
 
20
14
  def title
21
- "Unused Eager Loading #{@path ? "in #{@path}" : 'detected'}"
15
+ "AVOID eager loading #{@path ? "in #{@path}" : 'detected'}"
22
16
  end
17
+
18
+ def notification_data
19
+ super.merge(
20
+ :backtrace => []
21
+ )
22
+ end
23
+
24
+ protected
25
+ def call_stack_messages
26
+ (['Call stack'] + @callers).join( "\n " )
27
+ end
23
28
  end
24
29
  end
25
30
  end
data/lib/bullet/rack.rb CHANGED
@@ -51,11 +51,11 @@ module Bullet
51
51
  end
52
52
 
53
53
  def footer_note
54
- "<div #{footer_div_attributes}>" + Bullet.footer_info.uniq.join("<br>") + "</div>"
54
+ "<div #{footer_div_attributes}>" + footer_close_button + Bullet.footer_info.uniq.join("<br>") + "</div>"
55
55
  end
56
56
 
57
57
  def file?(headers)
58
- headers["Content-Transfer-Encoding"] == "binary"
58
+ headers["Content-Transfer-Encoding"] == "binary" || headers["Content-Disposition"]
59
59
  end
60
60
 
61
61
  def sse?(headers)
@@ -75,6 +75,7 @@ module Bullet
75
75
  end
76
76
 
77
77
  private
78
+
78
79
  def footer_div_attributes
79
80
  <<EOF
80
81
  data-is-bullet-footer ondblclick="this.parentNode.removeChild(this);" style="position: fixed; bottom: 0pt; left: 0pt; cursor: pointer; border-style: solid; border-color: rgb(153, 153, 153);
@@ -84,5 +85,9 @@ data-is-bullet-footer ondblclick="this.parentNode.removeChild(this);" style="pos
84
85
  color: rgb(119, 119, 119); font-size: 16px; font-family: 'Arial', sans-serif; z-index:9999;"
85
86
  EOF
86
87
  end
88
+
89
+ def footer_close_button
90
+ "<span onclick='this.parentNode.remove()' style='position:absolute; right: 10px; top: 0px; font-weight: bold; color: #333;'>&times;</span>"
91
+ end
87
92
  end
88
93
  end
@@ -5,7 +5,8 @@ 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
- caller.select do |caller_path|
8
+ caller_locations.select do |location|
9
+ caller_path = location.absolute_path
9
10
  caller_path.include?(app_root) && !caller_path.include?(vendor_root) ||
10
11
  Bullet.stacktrace_includes.any? do |include_pattern|
11
12
  case include_pattern
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Bullet
3
- VERSION = "5.4.3"
3
+ VERSION = "5.6.0"
4
4
  end
@@ -0,0 +1,46 @@
1
+ module Bullet
2
+ module Generators
3
+ class InstallGenerator < ::Rails::Generators::Base
4
+ desc <<-DESC
5
+ Description:
6
+ Enable bullet in development/test for your application.
7
+ DESC
8
+
9
+ def enable_in_development
10
+ environment(nil, env: "development") do
11
+ <<-"FILE".strip
12
+
13
+ config.after_initialize do
14
+ Bullet.enable = true
15
+ Bullet.alert = true
16
+ Bullet.bullet_logger = true
17
+ Bullet.console = true
18
+ # Bullet.growl = true
19
+ Bullet.rails_logger = true
20
+ Bullet.add_footer = true
21
+ end
22
+ FILE
23
+ end
24
+
25
+ say "Enabled bullet in config/environments/development.rb"
26
+ end
27
+
28
+ def enable_in_test
29
+ if yes?("Would you like to enable bullet in test environment? (y/n)")
30
+ environment(nil, env: "test") do
31
+ <<-"FILE".strip
32
+
33
+ config.after_initialize do
34
+ Bullet.enable = true
35
+ Bullet.bullet_logger = true
36
+ Bullet.raise = true # raise an error if n+1 query occurs
37
+ end
38
+ FILE
39
+ end
40
+
41
+ say "Enabled bullet in config/environments/test.rb"
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -91,11 +91,11 @@ module Bullet
91
91
  after { Bullet.stacktrace_excludes = nil }
92
92
 
93
93
  it "should not create notification when stacktrace contains paths that are in the exclude list" do
94
- in_project = File.join(Dir.pwd, 'abc', 'abc.rb')
95
- included_path = '/ghi/ghi.rb'
96
- excluded_path = '/def/def.rb'
94
+ in_project = OpenStruct.new(:absolute_path => File.join(Dir.pwd, 'abc', 'abc.rb'))
95
+ included_path = OpenStruct.new(:absolute_path => '/ghi/ghi.rb')
96
+ excluded_path = OpenStruct.new(:absolute_path => '/def/def.rb')
97
97
 
98
- expect(NPlusOneQuery).to receive(:caller).and_return([in_project, included_path, excluded_path])
98
+ expect(NPlusOneQuery).to receive(:caller_locations).and_return([in_project, included_path, excluded_path])
99
99
  expect(NPlusOneQuery).to_not receive(:create_notification)
100
100
  NPlusOneQuery.call_association(@post, :association)
101
101
  end
@@ -104,10 +104,10 @@ module Bullet
104
104
 
105
105
  context ".caller_in_project" do
106
106
  it "should include only paths that are in the project" do
107
- in_project = File.join(Dir.pwd, 'abc', 'abc.rb')
108
- not_in_project = '/def/def.rb'
107
+ in_project = OpenStruct.new(:absolute_path => File.join(Dir.pwd, 'abc', 'abc.rb'))
108
+ not_in_project = OpenStruct.new(:absolute_path => '/def/def.rb')
109
109
 
110
- expect(NPlusOneQuery).to receive(:caller).and_return([in_project, not_in_project])
110
+ expect(NPlusOneQuery).to receive(:caller_locations).and_return([in_project, not_in_project])
111
111
  expect(NPlusOneQuery).to receive(:conditions_met?).with(@post, :association).and_return(true)
112
112
  expect(NPlusOneQuery).to receive(:create_notification).with([in_project], "Post", :association)
113
113
  NPlusOneQuery.call_association(@post, :association)
@@ -118,11 +118,11 @@ module Bullet
118
118
  after { Bullet.stacktrace_includes = nil }
119
119
 
120
120
  it "should include paths that are in the stacktrace_include list" do
121
- in_project = File.join(Dir.pwd, 'abc', 'abc.rb')
122
- included_gems = ['/def/def.rb', 'xyz/xyz.rb']
123
- excluded_gem = '/ghi/ghi.rb'
121
+ in_project = OpenStruct.new(:absolute_path => File.join(Dir.pwd, 'abc', 'abc.rb'))
122
+ included_gems = [OpenStruct.new(:absolute_path => '/def/def.rb'), OpenStruct.new(:absolute_path => 'xyz/xyz.rb')]
123
+ excluded_gem = OpenStruct.new(:absolute_path => '/ghi/ghi.rb')
124
124
 
125
- expect(NPlusOneQuery).to receive(:caller).and_return([in_project, *included_gems, excluded_gem])
125
+ expect(NPlusOneQuery).to receive(:caller_locations).and_return([in_project, *included_gems, excluded_gem])
126
126
  expect(NPlusOneQuery).to receive(:conditions_met?).with(@post, :association).and_return(true)
127
127
  expect(NPlusOneQuery).to receive(:create_notification).with([in_project, *included_gems], "Post", :association)
128
128
  NPlusOneQuery.call_association(@post, :association)
@@ -5,10 +5,10 @@ module Bullet
5
5
  describe NPlusOneQuery do
6
6
  subject { NPlusOneQuery.new([["caller1", "caller2"]], Post, [:comments, :votes], "path") }
7
7
 
8
- it { expect(subject.body_with_caller).to eq(" Post => [:comments, :votes]\n Add to your finder: :includes => [:comments, :votes]\nN+1 Query method call stack\n caller1\n caller2\n") }
9
- it { expect([subject.body_with_caller, subject.body_with_caller]).to eq([ " Post => [:comments, :votes]\n Add to your finder: :includes => [:comments, :votes]\nN+1 Query method call stack\n caller1\n caller2\n", " Post => [:comments, :votes]\n Add to your finder: :includes => [:comments, :votes]\nN+1 Query method call stack\n caller1\n caller2\n" ]) }
8
+ it { expect(subject.body_with_caller).to eq(" Post => [:comments, :votes]\n Add to your finder: :includes => [:comments, :votes]\nCall stack\n caller1\n caller2\n") }
9
+ it { expect([subject.body_with_caller, subject.body_with_caller]).to eq([ " Post => [:comments, :votes]\n Add to your finder: :includes => [:comments, :votes]\nCall stack\n caller1\n caller2\n", " Post => [:comments, :votes]\n Add to your finder: :includes => [:comments, :votes]\nCall stack\n caller1\n caller2\n" ]) }
10
10
  it { expect(subject.body).to eq(" Post => [:comments, :votes]\n Add to your finder: :includes => [:comments, :votes]") }
11
- it { expect(subject.title).to eq("N+1 Query in path") }
11
+ it { expect(subject.title).to eq("USE eager loading in path") }
12
12
  end
13
13
  end
14
14
  end
@@ -6,7 +6,7 @@ module Bullet
6
6
  subject { UnusedEagerLoading.new([""], Post, [:comments, :votes], "path") }
7
7
 
8
8
  it { expect(subject.body).to eq(" Post => [:comments, :votes]\n Remove from your finder: :includes => [:comments, :votes]") }
9
- it { expect(subject.title).to eq("Unused Eager Loading in path") }
9
+ it { expect(subject.title).to eq("AVOID eager loading in path") }
10
10
  end
11
11
  end
12
12
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- if !mongoid? && active_record4?
3
+ if active_record?
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
@@ -29,6 +29,13 @@ 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
+
32
39
  if active_record5?
33
40
  it "should not need counter cache for has_many through" do
34
41
  Client.all.each do |client|
@@ -33,15 +33,7 @@ module Support
33
33
  end
34
34
 
35
35
  def setup_db
36
- if Mongoid::VERSION =~ /\A2\.[4-8]/
37
- Mongoid.configure do |config|
38
- config.master = Mongo::Connection.new.db("bullet")
39
- end
40
- elsif Mongoid::VERSION =~ /\A3/
41
- Mongoid.configure do |config|
42
- config.connect_to("bullet")
43
- end
44
- elsif Mongoid::VERSION =~ /\A4/
36
+ if Mongoid::VERSION =~ /\A4/
45
37
  Mongoid.configure do |config|
46
38
  config.load_configuration(
47
39
  sessions: {
@@ -52,7 +44,7 @@ module Support
52
44
  }
53
45
  )
54
46
  end
55
- elsif Mongoid::VERSION =~ /\A5/
47
+ else
56
48
  Mongoid.configure do |config|
57
49
  config.load_configuration(
58
50
  clients: {
data/test.sh CHANGED
@@ -4,15 +4,6 @@ BUNDLE_GEMFILE=Gemfile.rails-5.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-5.0 bund
4
4
  BUNDLE_GEMFILE=Gemfile.rails-4.2 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.2 bundle exec rspec spec
5
5
  BUNDLE_GEMFILE=Gemfile.rails-4.1 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.1 bundle exec rspec spec
6
6
  BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle exec rspec spec
7
- BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle exec rspec spec
8
- BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle exec rspec spec
9
- 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
10
8
  BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle exec rspec spec
11
9
  BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle exec rspec spec
12
- BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle exec rspec spec
13
- BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle exec rspec spec
14
- BUNDLE_GEMFILE=Gemfile.mongoid-2.8 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.8 bundle exec rspec spec
15
- BUNDLE_GEMFILE=Gemfile.mongoid-2.7 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.7 bundle exec rspec spec
16
- BUNDLE_GEMFILE=Gemfile.mongoid-2.6 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.6 bundle exec rspec spec
17
- BUNDLE_GEMFILE=Gemfile.mongoid-2.5 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.5 bundle exec rspec spec
18
- BUNDLE_GEMFILE=Gemfile.mongoid-2.4 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.4 bundle exec rspec spec
data/update.sh CHANGED
@@ -2,15 +2,6 @@ BUNDLE_GEMFILE=Gemfile.rails-5.0 bundle update
2
2
  BUNDLE_GEMFILE=Gemfile.rails-4.2 bundle update
3
3
  BUNDLE_GEMFILE=Gemfile.rails-4.1 bundle update
4
4
  BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle update
5
- BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle update
6
- BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle update
7
- BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle update
5
+ BUNDLE_GEMFILE=Gemfile.mongoid-6.0 bundle update
8
6
  BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle update
9
7
  BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle update
10
- BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle update
11
- BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle update
12
- BUNDLE_GEMFILE=Gemfile.mongoid-2.8 bundle update
13
- BUNDLE_GEMFILE=Gemfile.mongoid-2.7 bundle update
14
- BUNDLE_GEMFILE=Gemfile.mongoid-2.6 bundle update
15
- BUNDLE_GEMFILE=Gemfile.mongoid-2.5 bundle update
16
- BUNDLE_GEMFILE=Gemfile.mongoid-2.4 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: 5.4.3
4
+ version: 5.6.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: 2016-12-13 00:00:00.000000000 Z
11
+ date: 2017-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -51,22 +51,14 @@ 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
55
  - Gemfile.mongoid-5.0
63
- - Gemfile.rails-3.0
64
- - Gemfile.rails-3.1
65
- - Gemfile.rails-3.2
56
+ - Gemfile.mongoid-6.0
66
57
  - Gemfile.rails-4.0
67
58
  - Gemfile.rails-4.1
68
59
  - Gemfile.rails-4.2
69
60
  - Gemfile.rails-5.0
61
+ - Gemfile.rails-5.1
70
62
  - Guardfile
71
63
  - Hacking.md
72
64
  - MIT-LICENSE
@@ -74,8 +66,6 @@ files:
74
66
  - Rakefile
75
67
  - bullet.gemspec
76
68
  - lib/bullet.rb
77
- - lib/bullet/active_record3.rb
78
- - lib/bullet/active_record3x.rb
79
69
  - lib/bullet/active_record4.rb
80
70
  - lib/bullet/active_record41.rb
81
71
  - lib/bullet/active_record42.rb
@@ -89,10 +79,9 @@ files:
89
79
  - lib/bullet/detector/unused_eager_loading.rb
90
80
  - lib/bullet/ext/object.rb
91
81
  - lib/bullet/ext/string.rb
92
- - lib/bullet/mongoid2x.rb
93
- - lib/bullet/mongoid3x.rb
94
82
  - lib/bullet/mongoid4x.rb
95
83
  - lib/bullet/mongoid5x.rb
84
+ - lib/bullet/mongoid6x.rb
96
85
  - lib/bullet/notification.rb
97
86
  - lib/bullet/notification/base.rb
98
87
  - lib/bullet/notification/counter_cache.rb
@@ -106,6 +95,7 @@ files:
106
95
  - lib/bullet/registry/object.rb
107
96
  - lib/bullet/stack_trace_filter.rb
108
97
  - lib/bullet/version.rb
98
+ - lib/generators/bullet/install_generator.rb
109
99
  - perf/benchmark.rb
110
100
  - rails/init.rb
111
101
  - spec/bullet/detector/association_spec.rb
@@ -125,9 +115,7 @@ files:
125
115
  - spec/bullet/registry/base_spec.rb
126
116
  - spec/bullet/registry/object_spec.rb
127
117
  - spec/bullet_spec.rb
128
- - spec/integration/active_record3/association_spec.rb
129
- - spec/integration/active_record4/association_spec.rb
130
- - spec/integration/active_record5/association_spec.rb
118
+ - spec/integration/active_record/association_spec.rb
131
119
  - spec/integration/counter_cache_spec.rb
132
120
  - spec/integration/mongoid/association_spec.rb
133
121
  - spec/models/address.rb
@@ -190,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
178
  version: 1.3.6
191
179
  requirements: []
192
180
  rubyforge_project:
193
- rubygems_version: 2.5.1
181
+ rubygems_version: 2.6.12
194
182
  signing_key:
195
183
  specification_version: 4
196
184
  summary: help to kill N+1 queries and unused eager loading.
@@ -212,9 +200,7 @@ test_files:
212
200
  - spec/bullet/registry/base_spec.rb
213
201
  - spec/bullet/registry/object_spec.rb
214
202
  - spec/bullet_spec.rb
215
- - spec/integration/active_record3/association_spec.rb
216
- - spec/integration/active_record4/association_spec.rb
217
- - spec/integration/active_record5/association_spec.rb
203
+ - spec/integration/active_record/association_spec.rb
218
204
  - spec/integration/counter_cache_spec.rb
219
205
  - spec/integration/mongoid/association_spec.rb
220
206
  - spec/models/address.rb
data/Gemfile.mongoid-2.6 DELETED
@@ -1,15 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
4
-
5
- gem 'rails', '~> 3.2.0'
6
- gem 'sqlite3', platforms: [:ruby]
7
- gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
8
- gem 'mongoid', '~> 2.6.0'
9
-
10
- gem "rspec"
11
-
12
- platforms :rbx do
13
- gem 'rubysl', '~> 2.0'
14
- gem 'rubinius-developer_tools'
15
- end
data/Gemfile.mongoid-2.7 DELETED
@@ -1,15 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
4
-
5
- gem 'rails', '~> 3.2.0'
6
- gem 'sqlite3', platforms: [:ruby]
7
- gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
8
- gem 'mongoid', '~> 2.7.0'
9
-
10
- gem "rspec"
11
-
12
- platforms :rbx do
13
- gem 'rubysl', '~> 2.0'
14
- gem 'rubinius-developer_tools'
15
- end