bullet 4.14.8 → 4.14.9
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/.travis.yml +2 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile.mongoid-5.0 +17 -0
- data/README.md +3 -0
- data/lib/bullet.rb +11 -3
- data/lib/bullet/active_record3.rb +7 -5
- data/lib/bullet/active_record3x.rb +3 -3
- data/lib/bullet/active_record4.rb +12 -2
- data/lib/bullet/active_record41.rb +12 -2
- data/lib/bullet/active_record42.rb +23 -4
- data/lib/bullet/dependency.rb +6 -0
- data/lib/bullet/detector/n_plus_one_query.rb +1 -1
- data/lib/bullet/mongoid5x.rb +56 -0
- data/lib/bullet/version.rb +1 -1
- data/spec/bullet_spec.rb +47 -0
- data/spec/integration/active_record3/association_spec.rb +2 -2
- data/spec/integration/active_record4/association_spec.rb +23 -2
- data/spec/integration/counter_cache_spec.rb +8 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/mongo_seed.rb +13 -0
- data/test.sh +1 -0
- data/update.sh +1 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46631b5662b830f5e0c89e381ece4763ba55b2af
|
4
|
+
data.tar.gz: e636307ee2cea385fdd720a4757685f7de401a4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d5b60419c3f1676c8227db1102f9fac8c7085297aca02511b6e9822c8b14a19ed59c227a5ca2dee060b18295b633e4b3fbb246ee23afdd3c348b6f09468fa30
|
7
|
+
data.tar.gz: 6bfaf51d9ff6cebbc597fa9c6c97cc902b7cf6037f219a7d8bd72dbd09b530921174bea1aa4e9d5d29525107fee5ce9f782acd88d55668d1ab7d3ce11e9b707e
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Next Release
|
2
2
|
|
3
|
+
## 4.14.9
|
4
|
+
|
5
|
+
* Support mongoid 5.0.0
|
6
|
+
* Do not report association queries immediately after object creation to
|
7
|
+
require a preload
|
8
|
+
* Detect `counter_cache` for `has_many :through` association
|
9
|
+
|
3
10
|
## 4.14.8
|
4
11
|
|
5
12
|
* compatible with `composite_primary_keys` gem
|
data/Gemfile.mongoid-5.0
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem 'rails', '~> 4.0.0'
|
6
|
+
gem 'sqlite3', platforms: [:ruby]
|
7
|
+
gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
|
8
|
+
gem 'mongoid', '~> 5.0.0.beta', github: 'mongoid'
|
9
|
+
|
10
|
+
gem "rspec"
|
11
|
+
|
12
|
+
gem 'coveralls', require: false
|
13
|
+
|
14
|
+
platforms :rbx do
|
15
|
+
gem 'rubysl', '~> 2.0'
|
16
|
+
gem 'rubinius-developer_tools'
|
17
|
+
end
|
data/README.md
CHANGED
@@ -36,6 +36,9 @@ or add it into a Gemfile (Bundler):
|
|
36
36
|
gem "bullet", :group => "development"
|
37
37
|
```
|
38
38
|
|
39
|
+
**Note**: make sure `bullet` gem is added after activerecord (rails) and
|
40
|
+
mongoid.
|
41
|
+
|
39
42
|
## Configuration
|
40
43
|
|
41
44
|
Bullet won't do ANYTHING unless you tell it to explicitly. Append to
|
data/lib/bullet.rb
CHANGED
@@ -16,6 +16,9 @@ module Bullet
|
|
16
16
|
autoload :Registry, 'bullet/registry'
|
17
17
|
autoload :NotificationCollector, 'bullet/notification_collector'
|
18
18
|
|
19
|
+
BULLET_DEBUG = 'BULLET_DEBUG'.freeze
|
20
|
+
TRUE = 'true'.freeze
|
21
|
+
|
19
22
|
if defined? Rails::Railtie
|
20
23
|
class BulletRailtie < Rails::Railtie
|
21
24
|
initializer "bullet.configure_rails_initialization" do |app|
|
@@ -74,6 +77,7 @@ module Bullet
|
|
74
77
|
end
|
75
78
|
|
76
79
|
def add_whitelist(options)
|
80
|
+
reset_whitelist
|
77
81
|
@whitelist[options[:type]][options[:class_name].classify] ||= []
|
78
82
|
@whitelist[options[:type]][options[:class_name].classify] << options[:association].to_sym
|
79
83
|
end
|
@@ -83,7 +87,11 @@ module Bullet
|
|
83
87
|
end
|
84
88
|
|
85
89
|
def reset_whitelist
|
86
|
-
@whitelist
|
90
|
+
@whitelist ||= {:n_plus_one_query => {}, :unused_eager_loading => {}, :counter_cache => {}}
|
91
|
+
end
|
92
|
+
|
93
|
+
def clear_whitelist
|
94
|
+
@whitelist = nil
|
87
95
|
end
|
88
96
|
|
89
97
|
def bullet_logger=(active)
|
@@ -98,7 +106,7 @@ module Bullet
|
|
98
106
|
end
|
99
107
|
|
100
108
|
def debug(title, message)
|
101
|
-
puts "[Bullet][#{title}] #{message}" if ENV[
|
109
|
+
puts "[Bullet][#{title}] #{message}" if ENV[BULLET_DEBUG] == TRUE
|
102
110
|
end
|
103
111
|
|
104
112
|
def start_request
|
@@ -132,7 +140,7 @@ module Bullet
|
|
132
140
|
end
|
133
141
|
|
134
142
|
def start?
|
135
|
-
Thread.current[:bullet_start]
|
143
|
+
enable? && Thread.current[:bullet_start]
|
136
144
|
end
|
137
145
|
|
138
146
|
def notification_collector
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Bullet
|
2
2
|
module ActiveRecord
|
3
|
+
LOAD_TARGET = 'load_target'.freeze
|
4
|
+
|
3
5
|
def self.enable
|
4
6
|
require 'active_record'
|
5
7
|
::ActiveRecord::Relation.class_eval do
|
@@ -138,7 +140,7 @@ module Bullet
|
|
138
140
|
# avoid stack level too deep
|
139
141
|
result = origin_load_target
|
140
142
|
if Bullet.start?
|
141
|
-
Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name) unless caller.any? { |c| c.include?(
|
143
|
+
Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name) unless caller.any? { |c| c.include?(LOAD_TARGET) }
|
142
144
|
Bullet::Detector::NPlusOneQuery.add_possible_objects(result)
|
143
145
|
end
|
144
146
|
result
|
@@ -160,8 +162,8 @@ module Bullet
|
|
160
162
|
|
161
163
|
def has_cached_counter?
|
162
164
|
result = origin_has_cached_counter?
|
163
|
-
if Bullet.start?
|
164
|
-
Bullet::Detector::CounterCache.add_counter_cache(@owner, @reflection.name)
|
165
|
+
if Bullet.start? && !result
|
166
|
+
Bullet::Detector::CounterCache.add_counter_cache(@owner, @reflection.name)
|
165
167
|
end
|
166
168
|
result
|
167
169
|
end
|
@@ -171,8 +173,8 @@ module Bullet
|
|
171
173
|
alias_method :origin_has_cached_counter?, :has_cached_counter?
|
172
174
|
def has_cached_counter?
|
173
175
|
result = origin_has_cached_counter?
|
174
|
-
if Bullet.start?
|
175
|
-
Bullet::Detector::CounterCache.add_counter_cache(@owner, @reflection.name)
|
176
|
+
if Bullet.start? && !result
|
177
|
+
Bullet::Detector::CounterCache.add_counter_cache(@owner, @reflection.name)
|
176
178
|
end
|
177
179
|
result
|
178
180
|
end
|
@@ -143,10 +143,10 @@ module Bullet
|
|
143
143
|
::ActiveRecord::Associations::HasManyAssociation.class_eval do
|
144
144
|
alias_method :origin_has_cached_counter?, :has_cached_counter?
|
145
145
|
|
146
|
-
def has_cached_counter?(reflection = reflection)
|
146
|
+
def has_cached_counter?(reflection = reflection())
|
147
147
|
result = origin_has_cached_counter?(reflection)
|
148
|
-
if Bullet.start?
|
149
|
-
Bullet::Detector::CounterCache.add_counter_cache(owner, reflection.name)
|
148
|
+
if Bullet.start? && !result
|
149
|
+
Bullet::Detector::CounterCache.add_counter_cache(owner, reflection.name)
|
150
150
|
end
|
151
151
|
result
|
152
152
|
end
|
@@ -21,6 +21,16 @@ module Bullet
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
::ActiveRecord::Persistence.class_eval do
|
25
|
+
def save_with_bullet(*args, &proc)
|
26
|
+
was_new_record = new_record?
|
27
|
+
save_without_bullet(*args, &proc).tap do |result|
|
28
|
+
Bullet::Detector::NPlusOneQuery.add_impossible_object(self) if result && was_new_record
|
29
|
+
end
|
30
|
+
end
|
31
|
+
alias_method_chain :save, :bullet
|
32
|
+
end
|
33
|
+
|
24
34
|
::ActiveRecord::Associations::Preloader.class_eval do
|
25
35
|
# include query for one to many associations.
|
26
36
|
# keep this eager loadings.
|
@@ -135,8 +145,8 @@ module Bullet
|
|
135
145
|
|
136
146
|
def has_cached_counter?(reflection = reflection())
|
137
147
|
result = origin_has_cached_counter?(reflection)
|
138
|
-
if Bullet.start?
|
139
|
-
Bullet::Detector::CounterCache.add_counter_cache(owner, reflection.name)
|
148
|
+
if Bullet.start? && !result
|
149
|
+
Bullet::Detector::CounterCache.add_counter_cache(owner, reflection.name)
|
140
150
|
end
|
141
151
|
result
|
142
152
|
end
|
@@ -23,6 +23,16 @@ module Bullet
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
::ActiveRecord::Persistence.class_eval do
|
27
|
+
def save_with_bullet(*args, &proc)
|
28
|
+
was_new_record = new_record?
|
29
|
+
save_without_bullet(*args, &proc).tap do |result|
|
30
|
+
Bullet::Detector::NPlusOneQuery.add_impossible_object(self) if result && was_new_record
|
31
|
+
end
|
32
|
+
end
|
33
|
+
alias_method_chain :save, :bullet
|
34
|
+
end
|
35
|
+
|
26
36
|
::ActiveRecord::Associations::Preloader.class_eval do
|
27
37
|
alias_method :origin_preloaders_on, :preloaders_on
|
28
38
|
|
@@ -138,8 +148,8 @@ module Bullet
|
|
138
148
|
|
139
149
|
def has_cached_counter?(reflection = reflection())
|
140
150
|
result = origin_has_cached_counter?(reflection)
|
141
|
-
if Bullet.start?
|
142
|
-
Bullet::Detector::CounterCache.add_counter_cache(owner, reflection.name)
|
151
|
+
if Bullet.start? && !result
|
152
|
+
Bullet::Detector::CounterCache.add_counter_cache(owner, reflection.name)
|
143
153
|
end
|
144
154
|
result
|
145
155
|
end
|
@@ -21,6 +21,16 @@ module Bullet
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
::ActiveRecord::Persistence.class_eval do
|
25
|
+
def save_with_bullet(*args, &proc)
|
26
|
+
was_new_record = new_record?
|
27
|
+
save_without_bullet(*args, &proc).tap do |result|
|
28
|
+
Bullet::Detector::NPlusOneQuery.add_impossible_object(self) if result && was_new_record
|
29
|
+
end
|
30
|
+
end
|
31
|
+
alias_method_chain :save, :bullet
|
32
|
+
end
|
33
|
+
|
24
34
|
::ActiveRecord::Relation.class_eval do
|
25
35
|
alias_method :origin_to_a, :to_a
|
26
36
|
# if select a collection of objects, then these objects have possible to cause N+1 query.
|
@@ -182,10 +192,19 @@ module Bullet
|
|
182
192
|
alias_method :origin_has_cached_counter?, :has_cached_counter?
|
183
193
|
def has_cached_counter?(reflection = reflection())
|
184
194
|
result = origin_has_cached_counter?(reflection)
|
185
|
-
if Bullet.start?
|
186
|
-
|
187
|
-
|
188
|
-
|
195
|
+
if Bullet.start? && !result && !Thread.current[:bullet_collection_empty]
|
196
|
+
Bullet::Detector::CounterCache.add_counter_cache(owner, reflection.name)
|
197
|
+
end
|
198
|
+
result
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
::ActiveRecord::Associations::HasManyThroughAssociation.class_eval do
|
203
|
+
alias_method :origin_has_cached_counter?, :has_cached_counter?
|
204
|
+
def has_cached_counter?(reflection = reflection())
|
205
|
+
result = origin_has_cached_counter?(reflection)
|
206
|
+
if Bullet.start? && !result && !Thread.current[:bullet_collection_empty]
|
207
|
+
Bullet::Detector::CounterCache.add_counter_cache(owner, reflection.name)
|
189
208
|
end
|
190
209
|
result
|
191
210
|
end
|
data/lib/bullet/dependency.rb
CHANGED
@@ -36,6 +36,8 @@ module Bullet
|
|
36
36
|
'mongoid3x'
|
37
37
|
elsif mongoid4x?
|
38
38
|
'mongoid4x'
|
39
|
+
elsif mongoid5x?
|
40
|
+
'mongoid5x'
|
39
41
|
end
|
40
42
|
end
|
41
43
|
end
|
@@ -83,5 +85,9 @@ module Bullet
|
|
83
85
|
def mongoid4x?
|
84
86
|
mongoid? && ::Mongoid::VERSION =~ /\A4/
|
85
87
|
end
|
88
|
+
|
89
|
+
def mongoid5x?
|
90
|
+
mongoid? && ::Mongoid::VERSION =~ /\A5/
|
91
|
+
end
|
86
92
|
end
|
87
93
|
end
|
@@ -70,7 +70,7 @@ module Bullet
|
|
70
70
|
# associations == v comparision order is important here because
|
71
71
|
# v variable might be a squeel node where :== method is redefined,
|
72
72
|
# so it does not compare values at all and return unexpected results
|
73
|
-
result = v.is_a?(Hash) ? v.
|
73
|
+
result = v.is_a?(Hash) ? v.key?(associations) : associations == v
|
74
74
|
return true if result
|
75
75
|
end
|
76
76
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Bullet
|
2
|
+
module Mongoid
|
3
|
+
def self.enable
|
4
|
+
require 'mongoid'
|
5
|
+
::Mongoid::Contextual::Mongo.class_eval do
|
6
|
+
alias_method :origin_first, :first
|
7
|
+
alias_method :origin_last, :last
|
8
|
+
alias_method :origin_each, :each
|
9
|
+
alias_method :origin_eager_load, :eager_load
|
10
|
+
|
11
|
+
def first
|
12
|
+
result = origin_first
|
13
|
+
Bullet::Detector::NPlusOneQuery.add_impossible_object(result) if result
|
14
|
+
result
|
15
|
+
end
|
16
|
+
|
17
|
+
def last
|
18
|
+
result = origin_last
|
19
|
+
Bullet::Detector::NPlusOneQuery.add_impossible_object(result) if result
|
20
|
+
result
|
21
|
+
end
|
22
|
+
|
23
|
+
def each(&block)
|
24
|
+
records = view.map{ |doc| ::Mongoid::Factory.from_db(klass, doc) }
|
25
|
+
if records.length > 1
|
26
|
+
Bullet::Detector::NPlusOneQuery.add_possible_objects(records)
|
27
|
+
elsif records.size == 1
|
28
|
+
Bullet::Detector::NPlusOneQuery.add_impossible_object(records.first)
|
29
|
+
end
|
30
|
+
origin_each(&block)
|
31
|
+
end
|
32
|
+
|
33
|
+
def eager_load(docs)
|
34
|
+
associations = criteria.inclusions.map(&:name)
|
35
|
+
docs.each do |doc|
|
36
|
+
Bullet::Detector::NPlusOneQuery.add_object_associations(doc, associations)
|
37
|
+
end
|
38
|
+
Bullet::Detector::UnusedEagerLoading.add_eager_loadings(docs, associations)
|
39
|
+
origin_eager_load(docs)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
::Mongoid::Relations::Accessors.class_eval do
|
44
|
+
alias_method :origin_get_relation, :get_relation
|
45
|
+
|
46
|
+
def get_relation(name, metadata, object, reload = false)
|
47
|
+
result = origin_get_relation(name, metadata, object, reload)
|
48
|
+
if metadata.macro !~ /embed/
|
49
|
+
Bullet::Detector::NPlusOneQuery.call_association(self, name)
|
50
|
+
end
|
51
|
+
result
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/bullet/version.rb
CHANGED
data/spec/bullet_spec.rb
CHANGED
@@ -38,4 +38,51 @@ describe Bullet, focused: true do
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
41
|
+
|
42
|
+
describe '#start?' do
|
43
|
+
context 'when bullet is disabled' do
|
44
|
+
before(:each) do
|
45
|
+
Bullet.enable = false
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should not be started' do
|
49
|
+
expect(Bullet).not_to be_start
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#debug' do
|
55
|
+
before(:each) do
|
56
|
+
$stdout = StringIO.new
|
57
|
+
end
|
58
|
+
|
59
|
+
after(:each) do
|
60
|
+
$stdout = STDOUT
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'when debug is enabled' do
|
64
|
+
before(:each) do
|
65
|
+
ENV['BULLET_DEBUG'] = 'true'
|
66
|
+
end
|
67
|
+
|
68
|
+
after(:each) do
|
69
|
+
ENV['BULLET_DEBUG'] = 'false'
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'should output debug information' do
|
73
|
+
Bullet.debug('debug_message', 'this is helpful information')
|
74
|
+
|
75
|
+
expect($stdout.string)
|
76
|
+
.to eq("[Bullet][debug_message] this is helpful information\n")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context 'when debug is disabled' do
|
81
|
+
it 'should output debug information' do
|
82
|
+
Bullet.debug('debug_message', 'this is helpful information')
|
83
|
+
|
84
|
+
expect($stdout.string).to be_empty
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
41
88
|
end
|
@@ -624,7 +624,7 @@ if !mongoid? && active_record3?
|
|
624
624
|
|
625
625
|
context "whitelist n plus one query" do
|
626
626
|
before { Bullet.add_whitelist :type => :n_plus_one_query, :class_name => "Post", :association => :comments }
|
627
|
-
after { Bullet.
|
627
|
+
after { Bullet.clear_whitelist }
|
628
628
|
|
629
629
|
it "should not detect n plus one query" do
|
630
630
|
Post.all.each do |post|
|
@@ -647,7 +647,7 @@ if !mongoid? && active_record3?
|
|
647
647
|
|
648
648
|
context "whitelist unused eager loading" do
|
649
649
|
before { Bullet.add_whitelist :type => :unused_eager_loading, :class_name => "Post", :association => :comments }
|
650
|
-
after { Bullet.
|
650
|
+
after { Bullet.clear_whitelist }
|
651
651
|
|
652
652
|
it "should not detect unused eager loading" do
|
653
653
|
Post.includes(:comments).map(&:name)
|
@@ -560,6 +560,27 @@ if !mongoid? && active_record4?
|
|
560
560
|
end
|
561
561
|
end
|
562
562
|
|
563
|
+
describe Bullet::Detector::Association, "query immediately after creation" do
|
564
|
+
context "document => children" do
|
565
|
+
it 'should not detect non preload associations' do
|
566
|
+
document1 = Document.new
|
567
|
+
document1.children.build
|
568
|
+
document1.save
|
569
|
+
|
570
|
+
document2 = Document.new(parent: document1)
|
571
|
+
document2.save
|
572
|
+
document2.parent
|
573
|
+
|
574
|
+
document1.children.each.first
|
575
|
+
|
576
|
+
Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
|
577
|
+
expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
|
578
|
+
|
579
|
+
expect(Bullet::Detector::Association).to be_completely_preloading_associations
|
580
|
+
end
|
581
|
+
end
|
582
|
+
end
|
583
|
+
|
563
584
|
describe Bullet::Detector::Association, "STI" do
|
564
585
|
context "page => author" do
|
565
586
|
it "should detect non preload associations" do
|
@@ -647,7 +668,7 @@ if !mongoid? && active_record4?
|
|
647
668
|
|
648
669
|
context "whitelist n plus one query" do
|
649
670
|
before { Bullet.add_whitelist :type => :n_plus_one_query, :class_name => "Post", :association => :comments }
|
650
|
-
after { Bullet.
|
671
|
+
after { Bullet.clear_whitelist }
|
651
672
|
|
652
673
|
it "should not detect n plus one query" do
|
653
674
|
Post.all.each do |post|
|
@@ -670,7 +691,7 @@ if !mongoid? && active_record4?
|
|
670
691
|
|
671
692
|
context "whitelist unused eager loading" do
|
672
693
|
before { Bullet.add_whitelist :type => :unused_eager_loading, :class_name => "Post", :association => :comments }
|
673
|
-
after { Bullet.
|
694
|
+
after { Bullet.clear_whitelist }
|
674
695
|
|
675
696
|
it "should not detect unused eager loading" do
|
676
697
|
Post.includes(:comments).map(&:name)
|
@@ -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 need counter cache for has_many through" do
|
33
|
+
Client.all.each do |client|
|
34
|
+
client.firms.size
|
35
|
+
end
|
36
|
+
expect(Bullet.collected_counter_cache_notifications).not_to be_empty
|
37
|
+
end
|
38
|
+
|
32
39
|
it "should not need counter cache with part of cities" do
|
33
40
|
Country.all.each do |country|
|
34
41
|
country.cities.where(:name => 'first').size
|
@@ -50,7 +57,7 @@ if !mongoid? && active_record?
|
|
50
57
|
|
51
58
|
context "whitelist" do
|
52
59
|
before { Bullet.add_whitelist :type => :counter_cache, :class_name => "Country", :association => :cities }
|
53
|
-
after { Bullet.
|
60
|
+
after { Bullet.clear_whitelist }
|
54
61
|
|
55
62
|
it "should not detect counter cache" do
|
56
63
|
Country.all.each do |country|
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/mongo_seed.rb
CHANGED
@@ -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
|
|
data/test.sh
CHANGED
@@ -6,6 +6,7 @@ BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.0 bund
|
|
6
6
|
BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle exec rspec spec
|
7
7
|
BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle exec rspec spec
|
8
8
|
BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle exec rspec spec
|
9
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle exec rspec spec
|
9
10
|
BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle exec rspec spec
|
10
11
|
BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle exec rspec spec
|
11
12
|
BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle exec rspec spec
|
data/update.sh
CHANGED
@@ -4,6 +4,7 @@ BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle update
|
|
4
4
|
BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle update
|
5
5
|
BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle update
|
6
6
|
BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle update
|
7
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle update
|
7
8
|
BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle update
|
8
9
|
BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle update
|
9
10
|
BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle update
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.14.
|
4
|
+
version: 4.14.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- Gemfile.mongoid-3.0
|
60
60
|
- Gemfile.mongoid-3.1
|
61
61
|
- Gemfile.mongoid-4.0
|
62
|
+
- Gemfile.mongoid-5.0
|
62
63
|
- Gemfile.rails-3.0
|
63
64
|
- Gemfile.rails-3.1
|
64
65
|
- Gemfile.rails-3.2
|
@@ -89,6 +90,7 @@ files:
|
|
89
90
|
- lib/bullet/mongoid2x.rb
|
90
91
|
- lib/bullet/mongoid3x.rb
|
91
92
|
- lib/bullet/mongoid4x.rb
|
93
|
+
- lib/bullet/mongoid5x.rb
|
92
94
|
- lib/bullet/notification.rb
|
93
95
|
- lib/bullet/notification/base.rb
|
94
96
|
- lib/bullet/notification/counter_cache.rb
|