bullet 4.14.0 → 4.14.2
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 +9 -0
- data/Gemfile.mongoid-2.4 +2 -2
- data/Gemfile.mongoid-2.5 +2 -2
- data/Gemfile.mongoid-2.6 +1 -1
- data/Gemfile.mongoid-2.7 +2 -2
- data/Gemfile.mongoid-2.8 +2 -2
- data/Gemfile.mongoid-3.0 +2 -2
- data/Gemfile.mongoid-3.1 +2 -2
- data/Gemfile.mongoid-4.0 +1 -1
- data/Gemfile.rails-3.0 +1 -3
- data/Gemfile.rails-3.1 +1 -1
- data/Gemfile.rails-3.2 +1 -1
- data/Gemfile.rails-4.0 +1 -1
- data/Gemfile.rails-4.1 +1 -1
- data/Gemfile.rails-4.2 +1 -1
- data/README.md +1 -0
- data/lib/bullet/active_record42.rb +3 -0
- data/lib/bullet/notification/base.rb +1 -1
- data/lib/bullet/rack.rb +15 -5
- data/lib/bullet/version.rb +1 -1
- data/spec/bullet/notification/n_plus_one_query_spec.rb +3 -3
- data/spec/bullet/notification/unused_eager_loading_spec.rb +1 -1
- data/spec/bullet/rack_spec.rb +1 -1
- data/spec/integration/active_record4/association_spec.rb +11 -0
- data/spec/models/category.rb +0 -1
- data/spec/models/post.rb +0 -2
- data/spec/models/reply.rb +3 -0
- data/spec/models/submission.rb +1 -1
- data/spec/support/sqlite_seed.rb +12 -5
- data/update.sh +14 -0
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cb724ff2fab91cffc833fdf09ec6c9661b805c50
|
|
4
|
+
data.tar.gz: 65a2701588d1af6703608ce5c1e0b8505cf1c330
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e1e047c94101b65ee2360bd04f1432f7cb7965f50b9c613469dcec12603e4f9f4cdd5d973a86e0a68a5bb186d3a49d0cfef92b829b3c1169b9c8f48894ae810c
|
|
7
|
+
data.tar.gz: 0ee846a9c3963c6097dc7c98c157df6a78fc553efea2e668336ec20c64b109022dfe9e87e755a6b0807598fbd0de5fdca8c0e8d6bea2f11a439ec8d033fe3cab
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Next Release
|
|
2
2
|
|
|
3
|
+
## 4.14.2
|
|
4
|
+
|
|
5
|
+
* Hotfix nil object when add_impossible_object
|
|
6
|
+
|
|
7
|
+
## 4.14.1
|
|
8
|
+
|
|
9
|
+
* Fix has_one then has_many associations in rails 4.2
|
|
10
|
+
* Append js and dom to html body in proper position
|
|
11
|
+
|
|
3
12
|
## 4.14.0 (10/03/2014)
|
|
4
13
|
|
|
5
14
|
* Support rails 4.2
|
data/Gemfile.mongoid-2.4
CHANGED
|
@@ -2,10 +2,10 @@ source "https://rubygems.org"
|
|
|
2
2
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
|
-
gem 'rails', '~> 3.2.
|
|
5
|
+
gem 'rails', '~> 3.2.0'
|
|
6
6
|
gem 'sqlite3', platforms: [:ruby]
|
|
7
7
|
gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
|
|
8
|
-
gem 'mongoid', '~> 2.4.
|
|
8
|
+
gem 'mongoid', '~> 2.4.0'
|
|
9
9
|
|
|
10
10
|
gem "rspec"
|
|
11
11
|
gem "guard"
|
data/Gemfile.mongoid-2.5
CHANGED
|
@@ -2,10 +2,10 @@ source "https://rubygems.org"
|
|
|
2
2
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
|
-
gem 'rails', '~> 3.2.
|
|
5
|
+
gem 'rails', '~> 3.2.0'
|
|
6
6
|
gem 'sqlite3', platforms: [:ruby]
|
|
7
7
|
gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
|
|
8
|
-
gem 'mongoid', '~> 2.5.
|
|
8
|
+
gem 'mongoid', '~> 2.5.0'
|
|
9
9
|
|
|
10
10
|
gem "rspec"
|
|
11
11
|
gem "guard"
|
data/Gemfile.mongoid-2.6
CHANGED
data/Gemfile.mongoid-2.7
CHANGED
|
@@ -2,10 +2,10 @@ source "https://rubygems.org"
|
|
|
2
2
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
|
-
gem 'rails', '~> 3.2.
|
|
5
|
+
gem 'rails', '~> 3.2.0'
|
|
6
6
|
gem 'sqlite3', platforms: [:ruby]
|
|
7
7
|
gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
|
|
8
|
-
gem 'mongoid', '~> 2.7.
|
|
8
|
+
gem 'mongoid', '~> 2.7.0'
|
|
9
9
|
|
|
10
10
|
gem "rspec"
|
|
11
11
|
gem "guard"
|
data/Gemfile.mongoid-2.8
CHANGED
|
@@ -2,10 +2,10 @@ source "https://rubygems.org"
|
|
|
2
2
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
|
-
gem 'rails', '~> 3.2'
|
|
5
|
+
gem 'rails', '~> 3.2.0'
|
|
6
6
|
gem 'sqlite3', platforms: [:ruby]
|
|
7
7
|
gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
|
|
8
|
-
gem 'mongoid', '~> 2.8'
|
|
8
|
+
gem 'mongoid', '~> 2.8.0'
|
|
9
9
|
|
|
10
10
|
gem "rspec"
|
|
11
11
|
gem "guard"
|
data/Gemfile.mongoid-3.0
CHANGED
|
@@ -2,10 +2,10 @@ source "https://rubygems.org"
|
|
|
2
2
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
|
-
gem 'rails', '~> 3.2.
|
|
5
|
+
gem 'rails', '~> 3.2.0'
|
|
6
6
|
gem 'sqlite3', platforms: [:ruby]
|
|
7
7
|
gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
|
|
8
|
-
gem 'mongoid', '~> 3.0.
|
|
8
|
+
gem 'mongoid', '~> 3.0.0'
|
|
9
9
|
|
|
10
10
|
gem "rspec"
|
|
11
11
|
gem "guard"
|
data/Gemfile.mongoid-3.1
CHANGED
|
@@ -2,10 +2,10 @@ source "https://rubygems.org"
|
|
|
2
2
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
|
-
gem 'rails', '~> 3.2.
|
|
5
|
+
gem 'rails', '~> 3.2.0'
|
|
6
6
|
gem 'sqlite3', platforms: [:ruby]
|
|
7
7
|
gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
|
|
8
|
-
gem 'mongoid', '~> 3.1.
|
|
8
|
+
gem 'mongoid', '~> 3.1.0'
|
|
9
9
|
|
|
10
10
|
gem "rspec"
|
|
11
11
|
gem "guard"
|
data/Gemfile.mongoid-4.0
CHANGED
data/Gemfile.rails-3.0
CHANGED
|
@@ -2,14 +2,12 @@ source "https://rubygems.org"
|
|
|
2
2
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
|
-
gem 'rails', '~> 3.0.
|
|
5
|
+
gem 'rails', '~> 3.0.0'
|
|
6
6
|
gem 'sqlite3', platforms: [:ruby]
|
|
7
7
|
gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
|
|
8
8
|
gem 'activerecord-import'
|
|
9
9
|
|
|
10
10
|
gem "rspec"
|
|
11
|
-
gem "guard"
|
|
12
|
-
gem "guard-rspec"
|
|
13
11
|
|
|
14
12
|
gem 'coveralls', require: false
|
|
15
13
|
|
data/Gemfile.rails-3.1
CHANGED
data/Gemfile.rails-3.2
CHANGED
data/Gemfile.rails-4.0
CHANGED
data/Gemfile.rails-4.1
CHANGED
data/Gemfile.rails-4.2
CHANGED
data/README.md
CHANGED
|
@@ -67,6 +67,7 @@ The code above will enable all seven of the Bullet notification systems:
|
|
|
67
67
|
* `Bullet.alert`: pop up a JavaScript alert in the browser
|
|
68
68
|
* `Bullet.bullet_logger`: log to the Bullet log file (Rails.root/log/bullet.log)
|
|
69
69
|
* `Bullet.rails_logger`: add warnings directly to the Rails log
|
|
70
|
+
* `Bullet.bugsnag`: add notifications to bugsnag
|
|
70
71
|
* `Bullet.airbrake`: add notifications to airbrake
|
|
71
72
|
* `Bullet.console`: log warnings to your browser's console.log (Safari/Webkit browsers or Firefox w/Firebug installed)
|
|
72
73
|
* `Bullet.growl`: pop up Growl warnings if your system has Growl installed. Requires a little bit of configuration
|
|
@@ -121,6 +121,9 @@ module Bullet
|
|
|
121
121
|
Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name) unless @inversed
|
|
122
122
|
Bullet::Detector::NPlusOneQuery.add_possible_objects(result)
|
|
123
123
|
end
|
|
124
|
+
if ::ActiveRecord::Reflection::HasOneReflection === @reflection && result
|
|
125
|
+
Bullet::Detector::NPlusOneQuery.add_impossible_object(result)
|
|
126
|
+
end
|
|
124
127
|
result
|
|
125
128
|
end
|
|
126
129
|
end
|
data/lib/bullet/rack.rb
CHANGED
|
@@ -15,8 +15,9 @@ module Bullet
|
|
|
15
15
|
response_body = nil
|
|
16
16
|
if Bullet.notification?
|
|
17
17
|
if status == 200 && !response_body(response).frozen? && html_request?(headers, response)
|
|
18
|
-
response_body = response_body(response)
|
|
19
|
-
|
|
18
|
+
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)
|
|
20
21
|
headers['Content-Length'] = response_body.bytesize.to_s
|
|
21
22
|
end
|
|
22
23
|
end
|
|
@@ -42,8 +43,17 @@ module Bullet
|
|
|
42
43
|
end
|
|
43
44
|
end
|
|
44
45
|
|
|
45
|
-
def
|
|
46
|
-
response_body
|
|
46
|
+
def append_to_html_body(response_body, content)
|
|
47
|
+
if response_body.include?('</body>')
|
|
48
|
+
position = response_body.rindex('</body>')
|
|
49
|
+
response_body.insert(position, content)
|
|
50
|
+
else
|
|
51
|
+
response_body << content
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def footer_note
|
|
56
|
+
"<div #{footer_div_attributes}>" + Bullet.footer_info.uniq.join("<br>") + "</div>"
|
|
47
57
|
end
|
|
48
58
|
|
|
49
59
|
def file?(headers)
|
|
@@ -69,7 +79,7 @@ module Bullet
|
|
|
69
79
|
private
|
|
70
80
|
def footer_div_attributes
|
|
71
81
|
<<EOF
|
|
72
|
-
data-is-bullet-footer style="position: fixed; bottom: 0pt; left: 0pt; cursor: pointer; border-style: solid; border-color: rgb(153, 153, 153);
|
|
82
|
+
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);
|
|
73
83
|
-moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none;
|
|
74
84
|
-moz-border-left-colors: none; -moz-border-image: none; border-width: 2pt 2pt 0px 0px;
|
|
75
85
|
padding: 5px; border-radius: 0pt 10pt 0pt 0px; background: none repeat scroll 0% 0% rgba(200, 200, 200, 0.8);
|
data/lib/bullet/version.rb
CHANGED
|
@@ -5,9 +5,9 @@ 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: :
|
|
9
|
-
it { expect([
|
|
10
|
-
it { expect(subject.body).to eq(" Post => [:comments, :votes]\n Add to your finder: :
|
|
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" ]) }
|
|
10
|
+
it { expect(subject.body).to eq(" Post => [:comments, :votes]\n Add to your finder: :includes => [:comments, :votes]") }
|
|
11
11
|
it { expect(subject.title).to eq("N+1 Query in path") }
|
|
12
12
|
end
|
|
13
13
|
end
|
|
@@ -5,7 +5,7 @@ module Bullet
|
|
|
5
5
|
describe UnusedEagerLoading do
|
|
6
6
|
subject { UnusedEagerLoading.new(Post, [:comments, :votes], "path") }
|
|
7
7
|
|
|
8
|
-
it { expect(subject.body).to eq(" Post => [:comments, :votes]\n Remove from your finder: :
|
|
8
|
+
it { expect(subject.body).to eq(" Post => [:comments, :votes]\n Remove from your finder: :includes => [:comments, :votes]") }
|
|
9
9
|
it { expect(subject.title).to eq("Unused Eager Loading in path") }
|
|
10
10
|
end
|
|
11
11
|
end
|
data/spec/bullet/rack_spec.rb
CHANGED
|
@@ -70,7 +70,7 @@ module Bullet
|
|
|
70
70
|
expect(Bullet).to receive(:perform_out_of_channel_notifications)
|
|
71
71
|
status, headers, response = middleware.call([200, {"Content-Type" => "text/html"}])
|
|
72
72
|
expect(headers["Content-Length"]).to eq("56")
|
|
73
|
-
expect(response).to eq(["<html><head></head><body></body></html
|
|
73
|
+
expect(response).to eq(["<html><head></head><body><bullet></bullet></body></html>"])
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
it "should set the right Content-Length if response body contains accents" do
|
|
@@ -515,6 +515,17 @@ if !mongoid? && active_record4?
|
|
|
515
515
|
end
|
|
516
516
|
end
|
|
517
517
|
|
|
518
|
+
describe Bullet::Detector::Association, "has_one => has_many" do
|
|
519
|
+
it "should not detect preload association" do
|
|
520
|
+
user = User.first
|
|
521
|
+
user.submission.replies.map(&:name)
|
|
522
|
+
Bullet::Detector::UnusedEagerLoading.check_unused_preload_associations
|
|
523
|
+
expect(Bullet::Detector::Association).not_to be_has_unused_preload_associations
|
|
524
|
+
|
|
525
|
+
expect(Bullet::Detector::Association).to be_completely_preloading_associations
|
|
526
|
+
end
|
|
527
|
+
end
|
|
528
|
+
|
|
518
529
|
describe Bullet::Detector::Association, "call one association that in possible objects" do
|
|
519
530
|
it "should not detect preload association" do
|
|
520
531
|
Post.all
|
data/spec/models/category.rb
CHANGED
data/spec/models/post.rb
CHANGED
data/spec/models/submission.rb
CHANGED
data/spec/support/sqlite_seed.rb
CHANGED
|
@@ -82,10 +82,13 @@ module Support
|
|
|
82
82
|
user1 = User.create(:name => 'user1', :category => category1)
|
|
83
83
|
user2 = User.create(:name => 'user2', :category => category1)
|
|
84
84
|
|
|
85
|
-
submission1 =
|
|
86
|
-
submission2 =
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
submission1 = user1.create_submission(:name => "submission1")
|
|
86
|
+
submission2 = user2.create_submission(:name => "submission2")
|
|
87
|
+
|
|
88
|
+
submission1.replies.create(:name => 'reply1')
|
|
89
|
+
submission1.replies.create(:name => 'reply2')
|
|
90
|
+
submission2.replies.create(:name => 'reply3')
|
|
91
|
+
submission2.replies.create(:name => 'reply4')
|
|
89
92
|
end
|
|
90
93
|
|
|
91
94
|
def setup_db
|
|
@@ -211,9 +214,13 @@ module Support
|
|
|
211
214
|
t.column :name, :string
|
|
212
215
|
end
|
|
213
216
|
|
|
217
|
+
create_table :replies do |t|
|
|
218
|
+
t.column :name, :string
|
|
219
|
+
t.column :submission_id, :integer
|
|
220
|
+
end
|
|
221
|
+
|
|
214
222
|
create_table :submissions do |t|
|
|
215
223
|
t.column :name, :string
|
|
216
|
-
t.column :category_id, :integer
|
|
217
224
|
t.column :user_id, :integer
|
|
218
225
|
end
|
|
219
226
|
|
data/update.sh
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
BUNDLE_GEMFILE=Gemfile.rails-4.2 bundle update
|
|
2
|
+
BUNDLE_GEMFILE=Gemfile.rails-4.1 bundle update
|
|
3
|
+
BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle update
|
|
4
|
+
BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle update
|
|
5
|
+
BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle update
|
|
6
|
+
BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle update
|
|
7
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle update
|
|
8
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle update
|
|
9
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle update
|
|
10
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.8 bundle update
|
|
11
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.7 bundle update
|
|
12
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.6 bundle update
|
|
13
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.5 bundle update
|
|
14
|
+
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: 4.14.
|
|
4
|
+
version: 4.14.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Richard Huang
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2015-01-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -150,6 +150,7 @@ files:
|
|
|
150
150
|
- spec/models/pet.rb
|
|
151
151
|
- spec/models/post.rb
|
|
152
152
|
- spec/models/relationship.rb
|
|
153
|
+
- spec/models/reply.rb
|
|
153
154
|
- spec/models/student.rb
|
|
154
155
|
- spec/models/submission.rb
|
|
155
156
|
- spec/models/teacher.rb
|
|
@@ -162,6 +163,7 @@ files:
|
|
|
162
163
|
- spec/support/sqlite_seed.rb
|
|
163
164
|
- tasks/bullet_tasks.rake
|
|
164
165
|
- test.sh
|
|
166
|
+
- update.sh
|
|
165
167
|
homepage: http://github.com/flyerhzm/bullet
|
|
166
168
|
licenses:
|
|
167
169
|
- MIT
|
|
@@ -182,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
182
184
|
version: 1.3.6
|
|
183
185
|
requirements: []
|
|
184
186
|
rubyforge_project:
|
|
185
|
-
rubygems_version: 2.
|
|
187
|
+
rubygems_version: 2.4.5
|
|
186
188
|
signing_key:
|
|
187
189
|
specification_version: 4
|
|
188
190
|
summary: help to kill N+1 queries and unused eager loading.
|
|
@@ -234,6 +236,7 @@ test_files:
|
|
|
234
236
|
- spec/models/pet.rb
|
|
235
237
|
- spec/models/post.rb
|
|
236
238
|
- spec/models/relationship.rb
|
|
239
|
+
- spec/models/reply.rb
|
|
237
240
|
- spec/models/student.rb
|
|
238
241
|
- spec/models/submission.rb
|
|
239
242
|
- spec/models/teacher.rb
|