bullet 4.3.0 → 4.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -5
- data/{Gemfile.rails-2.3.14 → Gemfile.rails-2.3.17} +2 -4
- data/{Gemfile.rails-3.0.17 → Gemfile.rails-3.0.20} +2 -4
- data/{Gemfile.rails-3.1.8 → Gemfile.rails-3.1.11} +2 -4
- data/{Gemfile.rails-3.2.9 → Gemfile.rails-3.2.12} +2 -4
- data/Gemfile.rails-4-beta +2 -6
- data/README.textile +6 -10
- data/README_for_rails2.textile +6 -10
- data/lib/bullet.rb +1 -1
- data/lib/bullet/rack.rb +3 -8
- data/lib/bullet/version.rb +1 -1
- data/perf/benchmark.rb +1 -4
- data/spec/bullet/rack_spec.rb +0 -10
- data/test.sh +4 -4
- metadata +13 -20
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5e3527225d3f424d77fe6d66b89d79051ef971dd
|
4
|
+
data.tar.gz: 253640c4c6ef128c0f6959b31fae2bb202d9fc3e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 253164c19bb419669f1623eb724e33573a807c5a1998f78fefbdbaf5e5c69903dd3d296a17b4a1e99628b8ed1a83b635b612b46fb62ed735950e317bf6d1b93e
|
7
|
+
data.tar.gz: 419bb1cabd21aff3faf417718b7d48f01b55cab86d8c2fd974fd52e471074dd3062d2bc4c2a4530ffd250e35e716b6592c61187556ec184f1999937d680e4cfe
|
data/Gemfile
CHANGED
@@ -4,14 +4,12 @@ source "http://rubygems.org"
|
|
4
4
|
|
5
5
|
gemspec
|
6
6
|
|
7
|
-
gem 'rails', '3.2.
|
7
|
+
gem 'rails', '3.2.11'
|
8
8
|
gem 'sqlite3'
|
9
|
-
gem '
|
9
|
+
gem 'mysql2'
|
10
10
|
gem 'activerecord-import'
|
11
|
-
gem 'mongoid', '3.0.
|
11
|
+
gem 'mongoid', '3.0.9'
|
12
12
|
|
13
13
|
gem "rspec"
|
14
14
|
gem "guard"
|
15
15
|
gem "guard-rspec"
|
16
|
-
|
17
|
-
gem "perftools.rb"
|
@@ -4,14 +4,12 @@ source "http://rubygems.org"
|
|
4
4
|
|
5
5
|
gemspec
|
6
6
|
|
7
|
-
gem 'rails', '3.0.
|
7
|
+
gem 'rails', '3.0.20'
|
8
8
|
gem 'sqlite3'
|
9
|
-
gem '
|
9
|
+
gem 'mysql2'
|
10
10
|
gem 'activerecord-import'
|
11
11
|
gem 'bson_ext'
|
12
12
|
|
13
13
|
gem "rspec"
|
14
14
|
gem "guard"
|
15
15
|
gem "guard-rspec"
|
16
|
-
|
17
|
-
gem "perftools.rb"
|
@@ -4,9 +4,9 @@ source "http://rubygems.org"
|
|
4
4
|
|
5
5
|
gemspec
|
6
6
|
|
7
|
-
gem 'rails', '3.1.
|
7
|
+
gem 'rails', '3.1.11'
|
8
8
|
gem 'sqlite3'
|
9
|
-
gem '
|
9
|
+
gem 'mysql2'
|
10
10
|
gem 'activerecord-import'
|
11
11
|
gem 'mongoid', '2.4.12'
|
12
12
|
gem 'bson_ext'
|
@@ -14,5 +14,3 @@ gem 'bson_ext'
|
|
14
14
|
gem "rspec"
|
15
15
|
gem "guard"
|
16
16
|
gem "guard-rspec"
|
17
|
-
|
18
|
-
gem "perftools.rb"
|
@@ -4,9 +4,9 @@ source "http://rubygems.org"
|
|
4
4
|
|
5
5
|
gemspec
|
6
6
|
|
7
|
-
gem 'rails', '3.2.
|
7
|
+
gem 'rails', '3.2.12'
|
8
8
|
gem 'sqlite3'
|
9
|
-
gem '
|
9
|
+
gem 'mysql2'
|
10
10
|
gem 'activerecord-import'
|
11
11
|
gem 'mongoid', '2.5.1'
|
12
12
|
gem 'bson_ext'
|
@@ -14,5 +14,3 @@ gem 'bson_ext'
|
|
14
14
|
gem "rspec"
|
15
15
|
gem "guard"
|
16
16
|
gem "guard-rspec"
|
17
|
-
|
18
|
-
gem "perftools.rb"
|
data/Gemfile.rails-4-beta
CHANGED
@@ -4,15 +4,11 @@ source "http://rubygems.org"
|
|
4
4
|
|
5
5
|
gemspec
|
6
6
|
|
7
|
-
gem 'rails',
|
8
|
-
gem 'journey', github: 'rails/journey'
|
9
|
-
gem 'activerecord-deprecated_finders', github: 'rails/activerecord-deprecated_finders'
|
7
|
+
gem 'rails', '4.0.0.beta1'
|
10
8
|
gem 'sqlite3'
|
11
|
-
gem '
|
9
|
+
gem 'mysql2'
|
12
10
|
gem 'activerecord-import'
|
13
11
|
|
14
12
|
gem "rspec"
|
15
13
|
gem "guard"
|
16
14
|
gem "guard-rspec"
|
17
|
-
|
18
|
-
gem "perftools.rb"
|
data/README.textile
CHANGED
@@ -51,7 +51,6 @@ config.after_initialize do
|
|
51
51
|
:show_online_status => true }
|
52
52
|
Bullet.rails_logger = true
|
53
53
|
Bullet.airbrake = true
|
54
|
-
Bullet.disable_browser_cache = true
|
55
54
|
end
|
56
55
|
</code></pre>
|
57
56
|
|
@@ -66,7 +65,6 @@ The code above will enable all seven of the Bullet notification systems:
|
|
66
65
|
* <code>Bullet.console</code>: log warnings to your browser's console.log (Safari/Webkit browsers or Firefox w/Firebug installed)
|
67
66
|
* <code>Bullet.growl</code>: pop up Growl warnings if your system has Growl installed. Requires a little bit of configuration
|
68
67
|
* <code>Bullet.xmpp</code>: send XMPP/Jabber notifications to the receiver indicated. Note that the code will currently not handle the adding of contacts, so you will need to make both accounts indicated know each other manually before you will receive any notifications. If you restart the development server frequently, the 'coming online' sound for the bullet account may start to annoy - in this case set :show_online_status to false; you will still get notifications, but the bullet account won't announce it's online status anymore.
|
69
|
-
* <code>Bullet.disable_browser_cache</code>: disable browser cache which usually causes unexpected problems
|
70
68
|
|
71
69
|
****************************************************************************
|
72
70
|
|
@@ -122,11 +120,10 @@ The bullet gem use rack middleware for http request. If you want to bullet for w
|
|
122
120
|
<pre><code>
|
123
121
|
Bullet.start_request if Bullet.enable?
|
124
122
|
# run job
|
125
|
-
if Bullet.enable?
|
126
|
-
Bullet.
|
127
|
-
Bullet.log_notification('JobServer: ')
|
128
|
-
Bullet.end_request
|
123
|
+
if Bullet.enable? && Bullet.notification?
|
124
|
+
Bullet.perform_out_of_channel_notifications
|
129
125
|
end
|
126
|
+
Bullet.end_request if Bullet.enable?
|
130
127
|
</code></pre>
|
131
128
|
|
132
129
|
Or you want to use it in test mode
|
@@ -137,10 +134,10 @@ before(:each)
|
|
137
134
|
end
|
138
135
|
|
139
136
|
after(:each)
|
140
|
-
if Bullet.enable?
|
137
|
+
if Bullet.enable? && Bullet.notification?
|
141
138
|
Bullet.perform_out_of_channel_notifications
|
142
|
-
Bullet.end_request
|
143
139
|
end
|
140
|
+
Bullet.end_request if Bullet.enable?
|
144
141
|
end
|
145
142
|
</code></pre>
|
146
143
|
|
@@ -225,7 +222,6 @@ config.after_initialize do
|
|
225
222
|
Bullet.console = true
|
226
223
|
# Bullet.growl = true
|
227
224
|
Bullet.rails_logger = true
|
228
|
-
Bullet.disable_browser_cache = true
|
229
225
|
end
|
230
226
|
</code></pre>
|
231
227
|
|
@@ -374,4 +370,4 @@ In the meanwhile, there's a log appended into <code>log/bullet.log</code> file.
|
|
374
370
|
****************************************************************************
|
375
371
|
|
376
372
|
|
377
|
-
Copyright (c) 2009 -
|
373
|
+
Copyright (c) 2009 - 2013 Richard Huang (flyerhzm@gmail.com), released under the MIT license
|
data/README_for_rails2.textile
CHANGED
@@ -44,7 +44,6 @@ config.after_initialize do
|
|
44
44
|
Bullet.console = true
|
45
45
|
Bullet.growl = true
|
46
46
|
Bullet.rails_logger = true
|
47
|
-
Bullet.disable_browser_cache = true
|
48
47
|
Bullet.xmpp = { :account => 'bullets_account@jabber.org',
|
49
48
|
:password => 'bullets_password_for_jabber',
|
50
49
|
:receiver => 'your_account@jabber.org',
|
@@ -61,7 +60,6 @@ The code above will enable all five of the Bullet notification systems:
|
|
61
60
|
* <code>Bullet.rails_logger</code>: add warnings directly to the Rails log
|
62
61
|
* <code>Bullet.console</code>: log warnings to your browser's console.log (Safari/Webkit browsers or Firefox w/Firebug installed)
|
63
62
|
* <code>Bullet.growl</code>: pop up Growl warnings if your system has Growl installed. Requires a little bit of configuration
|
64
|
-
* <code>Bullet.disable_browser_cache</code>: disable browser cache which usually causes unexpected problems
|
65
63
|
|
66
64
|
****************************************************************************
|
67
65
|
|
@@ -152,11 +150,10 @@ The bullet plugin/gem use rack middleware for http request. If you want to bulle
|
|
152
150
|
<pre><code>
|
153
151
|
Bullet.start_request if Bullet.enable?
|
154
152
|
# run job
|
155
|
-
if Bullet.enable?
|
156
|
-
Bullet.
|
157
|
-
Bullet.log_notification('JobServer: ')
|
158
|
-
Bullet.end_request
|
153
|
+
if Bullet.enable? && Bullet.notification?
|
154
|
+
Bullet.perform_out_of_channel_notifications
|
159
155
|
end
|
156
|
+
Bullet.end_request if Bullet.enable?
|
160
157
|
</code></pre>
|
161
158
|
|
162
159
|
Or you want to use it in test mode
|
@@ -167,10 +164,10 @@ before(:each)
|
|
167
164
|
end
|
168
165
|
|
169
166
|
after(:each)
|
170
|
-
if Bullet.enable?
|
167
|
+
if Bullet.enable? && Bullet.notification?
|
171
168
|
Bullet.perform_out_of_channel_notifications
|
172
|
-
Bullet.end_request
|
173
169
|
end
|
170
|
+
Bullet.end_request if Bullet.enable?
|
174
171
|
end
|
175
172
|
</code></pre>
|
176
173
|
|
@@ -253,7 +250,6 @@ config.after_initialize do
|
|
253
250
|
Bullet.console = true
|
254
251
|
# Bullet.growl = true
|
255
252
|
Bullet.rails_logger = true
|
256
|
-
Bullet.disable_browser_cache = true
|
257
253
|
end
|
258
254
|
</code></pre>
|
259
255
|
|
@@ -401,4 +397,4 @@ In the meanwhile, there's a log appended into <code>log/bullet.log</code> file.
|
|
401
397
|
****************************************************************************
|
402
398
|
|
403
399
|
|
404
|
-
Copyright (c) 2009 -
|
400
|
+
Copyright (c) 2009 - 2013 Richard Huang (flyerhzm@gmail.com), released under the MIT license
|
data/lib/bullet.rb
CHANGED
data/lib/bullet/rack.rb
CHANGED
@@ -20,7 +20,6 @@ module Bullet
|
|
20
20
|
Bullet.perform_out_of_channel_notifications(env)
|
21
21
|
end
|
22
22
|
Bullet.end_request
|
23
|
-
no_browser_cache(headers) if Bullet.disable_browser_cache
|
24
23
|
[status, headers, response_body ? [response_body] : response]
|
25
24
|
end
|
26
25
|
|
@@ -28,7 +27,9 @@ module Bullet
|
|
28
27
|
def empty?(response)
|
29
28
|
# response may be ["Not Found"], ["Move Permanently"], etc.
|
30
29
|
(response.is_a?(Array) && response.size <= 1) ||
|
31
|
-
!response.respond_to?(:body) ||
|
30
|
+
!response.respond_to?(:body) ||
|
31
|
+
!response.body.respond_to?(:empty?) ||
|
32
|
+
response.body.empty?
|
32
33
|
end
|
33
34
|
|
34
35
|
# if send file?
|
@@ -39,11 +40,5 @@ module Bullet
|
|
39
40
|
def html_request?(headers, response)
|
40
41
|
headers['Content-Type'] && headers['Content-Type'].include?('text/html') && response.body.include?("<html")
|
41
42
|
end
|
42
|
-
|
43
|
-
def no_browser_cache(headers)
|
44
|
-
headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
|
45
|
-
headers["Pragma"] = "no-cache"
|
46
|
-
headers["Expires"] = "Wed, 09 Sep 2009 09:09:09 GMT"
|
47
|
-
end
|
48
43
|
end
|
49
44
|
end
|
data/lib/bullet/version.rb
CHANGED
data/perf/benchmark.rb
CHANGED
@@ -27,7 +27,7 @@ class User < ActiveRecord::Base
|
|
27
27
|
end
|
28
28
|
|
29
29
|
# create database bullet_benchmark;
|
30
|
-
ActiveRecord::Base.establish_connection(:adapter => '
|
30
|
+
ActiveRecord::Base.establish_connection(:adapter => 'mysql2', :database => 'bullet_benchmark', :server => '/tmp/mysql.socket', :username => 'root')
|
31
31
|
|
32
32
|
ActiveRecord::Base.connection.tables.each do |table|
|
33
33
|
ActiveRecord::Base.connection.drop_table(table)
|
@@ -79,8 +79,6 @@ puts "Start benchmarking..."
|
|
79
79
|
|
80
80
|
Bullet.enable = true
|
81
81
|
|
82
|
-
PerfTools::CpuProfiler.start(ARGV[0]|| "benchmark_profile") if defined? PerfTools
|
83
|
-
|
84
82
|
Benchmark.bm(70) do |bm|
|
85
83
|
bm.report("Querying & Iterating #{posts_size} Posts with #{comments_size} Comments and #{users_size} Users") do
|
86
84
|
10.times do
|
@@ -98,7 +96,6 @@ Benchmark.bm(70) do |bm|
|
|
98
96
|
end
|
99
97
|
end
|
100
98
|
|
101
|
-
PerfTools::CpuProfiler.stop if defined? PerfTools
|
102
99
|
puts "End benchmarking..."
|
103
100
|
|
104
101
|
|
data/spec/bullet/rack_spec.rb
CHANGED
@@ -6,16 +6,6 @@ module Bullet
|
|
6
6
|
let(:middleware) { Bullet::Rack.new app }
|
7
7
|
let(:app) { Support::AppDouble.new }
|
8
8
|
|
9
|
-
context "#no_browser_cache" do
|
10
|
-
it "should add no cache meta in http headers" do
|
11
|
-
headers = {}
|
12
|
-
middleware.no_browser_cache(headers)
|
13
|
-
headers["Cache-Control"].should == "no-cache, no-store, max-age=0, must-revalidate"
|
14
|
-
headers["Pragma"].should == "no-cache"
|
15
|
-
headers["Expires"].should == "Wed, 09 Sep 2009 09:09:09 GMT"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
9
|
context "#html_request?" do
|
20
10
|
it "should be true if Content-Type is text/html and http body contains html tag" do
|
21
11
|
headers = {"Content-Type" => "text/html"}
|
data/test.sh
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
bundle && bundle exec rspec spec
|
2
|
-
BUNDLE_GEMFILE=Gemfile.rails-3.2.
|
3
|
-
BUNDLE_GEMFILE=Gemfile.rails-3.1.
|
4
|
-
BUNDLE_GEMFILE=Gemfile.rails-3.0.
|
5
|
-
BUNDLE_GEMFILE=Gemfile.rails-2.3.
|
2
|
+
BUNDLE_GEMFILE=Gemfile.rails-3.2.12 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.2.12 bundle exec rspec spec
|
3
|
+
BUNDLE_GEMFILE=Gemfile.rails-3.1.11 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.1.11 bundle exec rspec spec
|
4
|
+
BUNDLE_GEMFILE=Gemfile.rails-3.0.20 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.0.20 bundle exec rspec spec
|
5
|
+
BUNDLE_GEMFILE=Gemfile.rails-2.3.17 bundle && BUNDLE_GEMFILE=Gemfile.rails-2.3.17 bundle exec rspec spec
|
6
6
|
BUNDLE_GEMFILE=Gemfile.rails-4-beta bundle && BUNDLE_GEMFILE=Gemfile.rails-4-beta bundle exec rspec spec
|
metadata
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
5
|
-
prerelease:
|
4
|
+
version: 4.3.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Richard Huang
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-03-01 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: uniform_notifier
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
description: A rails plugin to kill N+1 queries and unused eager loading.
|
@@ -40,10 +37,10 @@ files:
|
|
40
37
|
- .rvmrc.example
|
41
38
|
- .travis.yml
|
42
39
|
- Gemfile
|
43
|
-
- Gemfile.rails-2.3.
|
44
|
-
- Gemfile.rails-3.0.
|
45
|
-
- Gemfile.rails-3.1.
|
46
|
-
- Gemfile.rails-3.2.
|
40
|
+
- Gemfile.rails-2.3.17
|
41
|
+
- Gemfile.rails-3.0.20
|
42
|
+
- Gemfile.rails-3.1.11
|
43
|
+
- Gemfile.rails-3.2.12
|
47
44
|
- Gemfile.rails-4-beta
|
48
45
|
- Guardfile
|
49
46
|
- Hacking.textile
|
@@ -143,30 +140,26 @@ files:
|
|
143
140
|
- test.sh
|
144
141
|
homepage: http://github.com/flyerhzm/bullet
|
145
142
|
licenses: []
|
143
|
+
metadata: {}
|
146
144
|
post_install_message:
|
147
145
|
rdoc_options: []
|
148
146
|
require_paths:
|
149
147
|
- lib
|
150
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
-
none: false
|
152
149
|
requirements:
|
153
|
-
- -
|
150
|
+
- - '>='
|
154
151
|
- !ruby/object:Gem::Version
|
155
152
|
version: '0'
|
156
|
-
segments:
|
157
|
-
- 0
|
158
|
-
hash: 197998252985008423
|
159
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
-
none: false
|
161
154
|
requirements:
|
162
|
-
- -
|
155
|
+
- - '>='
|
163
156
|
- !ruby/object:Gem::Version
|
164
157
|
version: 1.3.6
|
165
158
|
requirements: []
|
166
159
|
rubyforge_project:
|
167
|
-
rubygems_version:
|
160
|
+
rubygems_version: 2.0.0
|
168
161
|
signing_key:
|
169
|
-
specification_version:
|
162
|
+
specification_version: 4
|
170
163
|
summary: A rails plugin to kill N+1 queries and unused eager loading.
|
171
164
|
test_files:
|
172
165
|
- spec/bullet/detector/association_spec.rb
|