bullet 5.7.4 → 5.7.5
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/bullet.gemspec +2 -0
- data/lib/bullet.rb +2 -0
- data/lib/bullet/active_record4.rb +2 -0
- data/lib/bullet/active_record41.rb +2 -0
- data/lib/bullet/active_record42.rb +2 -0
- data/lib/bullet/active_record5.rb +2 -0
- data/lib/bullet/active_record52.rb +2 -0
- data/lib/bullet/dependency.rb +2 -0
- data/lib/bullet/detector.rb +2 -0
- data/lib/bullet/detector/association.rb +2 -0
- data/lib/bullet/detector/base.rb +2 -0
- data/lib/bullet/detector/counter_cache.rb +2 -0
- data/lib/bullet/detector/n_plus_one_query.rb +2 -0
- data/lib/bullet/detector/unused_eager_loading.rb +2 -0
- data/lib/bullet/ext/object.rb +2 -0
- data/lib/bullet/ext/string.rb +2 -0
- data/lib/bullet/mongoid4x.rb +6 -2
- data/lib/bullet/mongoid5x.rb +6 -2
- data/lib/bullet/mongoid6x.rb +2 -0
- data/lib/bullet/notification.rb +2 -0
- data/lib/bullet/notification/base.rb +2 -0
- data/lib/bullet/notification/counter_cache.rb +2 -0
- data/lib/bullet/notification/n_plus_one_query.rb +2 -0
- data/lib/bullet/notification/unused_eager_loading.rb +2 -0
- data/lib/bullet/notification_collector.rb +2 -0
- data/lib/bullet/rack.rb +10 -7
- data/lib/bullet/registry.rb +2 -0
- data/lib/bullet/registry/association.rb +2 -0
- data/lib/bullet/registry/base.rb +2 -0
- data/lib/bullet/registry/object.rb +2 -0
- data/lib/bullet/stack_trace_filter.rb +2 -0
- data/lib/bullet/version.rb +3 -1
- data/lib/generators/bullet/install_generator.rb +2 -0
- data/perf/benchmark.rb +2 -0
- data/rails/init.rb +2 -0
- data/spec/bullet/detector/association_spec.rb +2 -0
- data/spec/bullet/detector/base_spec.rb +2 -0
- data/spec/bullet/detector/counter_cache_spec.rb +2 -0
- data/spec/bullet/detector/n_plus_one_query_spec.rb +2 -0
- data/spec/bullet/detector/unused_eager_loading_spec.rb +2 -0
- data/spec/bullet/ext/object_spec.rb +2 -0
- data/spec/bullet/ext/string_spec.rb +2 -0
- data/spec/bullet/notification/base_spec.rb +2 -0
- data/spec/bullet/notification/counter_cache_spec.rb +2 -0
- data/spec/bullet/notification/n_plus_one_query_spec.rb +2 -0
- data/spec/bullet/notification/unused_eager_loading_spec.rb +2 -0
- data/spec/bullet/notification_collector_spec.rb +2 -0
- data/spec/bullet/rack_spec.rb +2 -0
- data/spec/bullet/registry/association_spec.rb +2 -0
- data/spec/bullet/registry/base_spec.rb +2 -0
- data/spec/bullet/registry/object_spec.rb +2 -0
- data/spec/bullet_spec.rb +2 -0
- data/spec/integration/active_record/association_spec.rb +2 -0
- data/spec/integration/counter_cache_spec.rb +2 -0
- data/spec/integration/mongoid/association_spec.rb +2 -0
- data/spec/models/address.rb +2 -0
- data/spec/models/author.rb +2 -0
- data/spec/models/base_user.rb +2 -0
- data/spec/models/category.rb +2 -0
- data/spec/models/city.rb +2 -0
- data/spec/models/client.rb +2 -0
- data/spec/models/comment.rb +2 -0
- data/spec/models/company.rb +2 -0
- data/spec/models/country.rb +2 -0
- data/spec/models/document.rb +2 -0
- data/spec/models/entry.rb +2 -0
- data/spec/models/firm.rb +2 -0
- data/spec/models/folder.rb +2 -0
- data/spec/models/mongoid/address.rb +2 -0
- data/spec/models/mongoid/category.rb +2 -0
- data/spec/models/mongoid/comment.rb +2 -0
- data/spec/models/mongoid/company.rb +2 -0
- data/spec/models/mongoid/entry.rb +2 -0
- data/spec/models/mongoid/post.rb +2 -0
- data/spec/models/mongoid/user.rb +2 -0
- data/spec/models/newspaper.rb +2 -0
- data/spec/models/page.rb +2 -0
- data/spec/models/person.rb +2 -0
- data/spec/models/pet.rb +2 -0
- data/spec/models/post.rb +2 -0
- data/spec/models/relationship.rb +2 -0
- data/spec/models/reply.rb +2 -0
- data/spec/models/student.rb +2 -0
- data/spec/models/submission.rb +2 -0
- data/spec/models/teacher.rb +2 -0
- data/spec/models/user.rb +2 -0
- data/spec/models/writer.rb +2 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/bullet_ext.rb +2 -0
- data/spec/support/mongo_seed.rb +4 -2
- data/spec/support/rack_double.rb +2 -0
- data/spec/support/sqlite_seed.rb +4 -2
- data/tasks/bullet_tasks.rake +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fb27c10f2796dc6cc38899be2b88943f6c124d80
|
|
4
|
+
data.tar.gz: c89d95e08212b3bf8da49f2ce4c542ec2aa3021d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8f4d67bebf52a6730fa623bb150717e56c052605fc339f37d89d915af0981e442200e2bfee5c3405e6269d0907dc4e4f89fd2965000e637555aa8614580837c0
|
|
7
|
+
data.tar.gz: 3fbfc65e37e50444107e153050b33f66fe51037fd9d325438015d51c71f4a5ccb387e9b76ba28a2c753c9f9227653686535c857f457c80d62213cdda070b9c18
|
data/CHANGELOG.md
CHANGED
data/bullet.gemspec
CHANGED
data/lib/bullet.rb
CHANGED
data/lib/bullet/dependency.rb
CHANGED
data/lib/bullet/detector.rb
CHANGED
data/lib/bullet/detector/base.rb
CHANGED
data/lib/bullet/ext/object.rb
CHANGED
data/lib/bullet/ext/string.rb
CHANGED
data/lib/bullet/mongoid4x.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Bullet
|
|
2
4
|
module Mongoid
|
|
3
5
|
def self.enable
|
|
@@ -21,13 +23,15 @@ module Bullet
|
|
|
21
23
|
end
|
|
22
24
|
|
|
23
25
|
def each(&block)
|
|
24
|
-
|
|
26
|
+
return to_enum unless block_given?
|
|
27
|
+
records = []
|
|
28
|
+
origin_each { |record| records << record }
|
|
25
29
|
if records.length > 1
|
|
26
30
|
Bullet::Detector::NPlusOneQuery.add_possible_objects(records)
|
|
27
31
|
elsif records.size == 1
|
|
28
32
|
Bullet::Detector::NPlusOneQuery.add_impossible_object(records.first)
|
|
29
33
|
end
|
|
30
|
-
|
|
34
|
+
records.each(&block)
|
|
31
35
|
end
|
|
32
36
|
|
|
33
37
|
def eager_load(docs)
|
data/lib/bullet/mongoid5x.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Bullet
|
|
2
4
|
module Mongoid
|
|
3
5
|
def self.enable
|
|
@@ -21,13 +23,15 @@ module Bullet
|
|
|
21
23
|
end
|
|
22
24
|
|
|
23
25
|
def each(&block)
|
|
24
|
-
|
|
26
|
+
return to_enum unless block_given?
|
|
27
|
+
records = []
|
|
28
|
+
origin_each { |record| records << record }
|
|
25
29
|
if records.length > 1
|
|
26
30
|
Bullet::Detector::NPlusOneQuery.add_possible_objects(records)
|
|
27
31
|
elsif records.size == 1
|
|
28
32
|
Bullet::Detector::NPlusOneQuery.add_impossible_object(records.first)
|
|
29
33
|
end
|
|
30
|
-
|
|
34
|
+
records.each(&block)
|
|
31
35
|
end
|
|
32
36
|
|
|
33
37
|
def eager_load(docs)
|
data/lib/bullet/mongoid6x.rb
CHANGED
data/lib/bullet/notification.rb
CHANGED
data/lib/bullet/rack.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Bullet
|
|
2
4
|
class Rack
|
|
3
5
|
include Dependency
|
|
@@ -14,10 +16,10 @@ module Bullet
|
|
|
14
16
|
response_body = nil
|
|
15
17
|
if Bullet.notification?
|
|
16
18
|
if !file?(headers) && !sse?(headers) && !empty?(response) &&
|
|
17
|
-
status == 200 &&
|
|
19
|
+
status == 200 && html_request?(headers, response)
|
|
18
20
|
response_body = response_body(response)
|
|
19
|
-
append_to_html_body(response_body, footer_note) if Bullet.add_footer
|
|
20
|
-
append_to_html_body(response_body, Bullet.gather_inline_notifications)
|
|
21
|
+
response_body = append_to_html_body(response_body, footer_note) if Bullet.add_footer
|
|
22
|
+
response_body = append_to_html_body(response_body, Bullet.gather_inline_notifications)
|
|
21
23
|
headers['Content-Length'] = response_body.bytesize.to_s
|
|
22
24
|
end
|
|
23
25
|
Bullet.perform_out_of_channel_notifications(env)
|
|
@@ -42,11 +44,12 @@ module Bullet
|
|
|
42
44
|
end
|
|
43
45
|
|
|
44
46
|
def append_to_html_body(response_body, content)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
body = response_body.dup
|
|
48
|
+
if body.include?('</body>')
|
|
49
|
+
position = body.rindex('</body>')
|
|
50
|
+
body.insert(position, content)
|
|
48
51
|
else
|
|
49
|
-
|
|
52
|
+
body << content
|
|
50
53
|
end
|
|
51
54
|
end
|
|
52
55
|
|
data/lib/bullet/registry.rb
CHANGED
data/lib/bullet/registry/base.rb
CHANGED
data/lib/bullet/version.rb
CHANGED
data/perf/benchmark.rb
CHANGED
data/rails/init.rb
CHANGED
data/spec/bullet/rack_spec.rb
CHANGED
data/spec/bullet_spec.rb
CHANGED
data/spec/models/address.rb
CHANGED
data/spec/models/author.rb
CHANGED
data/spec/models/base_user.rb
CHANGED
data/spec/models/category.rb
CHANGED
data/spec/models/city.rb
CHANGED
data/spec/models/client.rb
CHANGED
data/spec/models/comment.rb
CHANGED
data/spec/models/company.rb
CHANGED
data/spec/models/country.rb
CHANGED
data/spec/models/document.rb
CHANGED
data/spec/models/entry.rb
CHANGED
data/spec/models/firm.rb
CHANGED
data/spec/models/folder.rb
CHANGED
data/spec/models/mongoid/post.rb
CHANGED
data/spec/models/mongoid/user.rb
CHANGED
data/spec/models/newspaper.rb
CHANGED
data/spec/models/page.rb
CHANGED
data/spec/models/person.rb
CHANGED
data/spec/models/pet.rb
CHANGED
data/spec/models/post.rb
CHANGED
data/spec/models/relationship.rb
CHANGED
data/spec/models/reply.rb
CHANGED
data/spec/models/student.rb
CHANGED
data/spec/models/submission.rb
CHANGED
data/spec/models/teacher.rb
CHANGED
data/spec/models/user.rb
CHANGED
data/spec/models/writer.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/support/bullet_ext.rb
CHANGED
data/spec/support/mongo_seed.rb
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Support
|
|
2
4
|
module MongoSeed
|
|
5
|
+
module_function
|
|
6
|
+
|
|
3
7
|
def seed_db
|
|
4
8
|
category1 = Mongoid::Category.create(name: 'first')
|
|
5
9
|
category2 = Mongoid::Category.create(name: 'second')
|
|
@@ -64,7 +68,5 @@ module Support
|
|
|
64
68
|
Mongoid.purge!
|
|
65
69
|
Mongoid::IdentityMap.clear if Mongoid.const_defined?(:IdentityMap)
|
|
66
70
|
end
|
|
67
|
-
|
|
68
|
-
module_function
|
|
69
71
|
end
|
|
70
72
|
end
|
data/spec/support/rack_double.rb
CHANGED
data/spec/support/sqlite_seed.rb
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Support
|
|
2
4
|
module SqliteSeed
|
|
5
|
+
module_function
|
|
6
|
+
|
|
3
7
|
def seed_db
|
|
4
8
|
newspaper1 = Newspaper.create(name: 'First Newspaper')
|
|
5
9
|
newspaper2 = Newspaper.create(name: 'Second Newspaper')
|
|
@@ -231,7 +235,5 @@ module Support
|
|
|
231
235
|
end
|
|
232
236
|
end
|
|
233
237
|
end
|
|
234
|
-
|
|
235
|
-
module_function
|
|
236
238
|
end
|
|
237
239
|
end
|
data/tasks/bullet_tasks.rake
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.5
|
|
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-03-
|
|
11
|
+
date: 2018-03-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|