bullet 4.2.0 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,9 +3,12 @@ rvm:
3
3
  - 1.9.3
4
4
  gemfile:
5
5
  - Gemfile
6
+ - Gemfile.rails-4-beta
6
7
  - Gemfile.rails-3.1.5
7
8
  - Gemfile.rails-3.0.13
8
9
  - Gemfile.rails-2.3.14
9
10
  env: DB=sqlite
11
+ services: mongodb
10
12
  before_install:
11
- - echo "yes" | gem uninstall json
13
+ - gem uninstall json
14
+ - gem install bundler
@@ -4,7 +4,7 @@ source "http://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'rails', '3.0.13'
7
+ gem 'rails', '3.0.17'
8
8
  gem 'sqlite3'
9
9
  gem 'mysql'
10
10
  gem 'activerecord-import'
@@ -4,11 +4,11 @@ source "http://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'rails', '3.1.5'
7
+ gem 'rails', '3.1.8'
8
8
  gem 'sqlite3'
9
9
  gem 'mysql'
10
10
  gem 'activerecord-import'
11
- gem 'mongoid', '2.4.10'
11
+ gem 'mongoid', '2.4.12'
12
12
  gem 'bson_ext'
13
13
 
14
14
  gem "rspec"
@@ -0,0 +1,18 @@
1
+ # Use `bundle install` in order to install these gems
2
+ # Use `bundle exec rake` in order to run the specs using the bundle
3
+ source "http://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ gem 'rails', '3.2.9'
8
+ gem 'sqlite3'
9
+ gem 'mysql'
10
+ gem 'activerecord-import'
11
+ gem 'mongoid', '2.5.1'
12
+ gem 'bson_ext'
13
+
14
+ gem "rspec"
15
+ gem "guard"
16
+ gem "guard-rspec"
17
+
18
+ gem "perftools.rb"
@@ -10,7 +10,6 @@ gem 'activerecord-deprecated_finders', github: 'rails/activerecord-deprecated_fi
10
10
  gem 'sqlite3'
11
11
  gem 'mysql'
12
12
  gem 'activerecord-import'
13
- gem 'mongoid', github: 'slbug/mongoid'
14
13
 
15
14
  gem "rspec"
16
15
  gem "guard"
@@ -58,7 +58,7 @@ module Bullet
58
58
 
59
59
  def bullet_logger=(active)
60
60
  if active
61
- bullet_log_file = File.open('log/bullet.log', 'a+')
61
+ bullet_log_file = File.open("#{rails2? ? RAILS_ROOT : Rails.root.to_s}/log/bullet.log", 'a+')
62
62
  bullet_log_file.sync = true
63
63
  UniformNotifier.customized_logger = bullet_log_file
64
64
  end
@@ -33,7 +33,7 @@ module Bullet
33
33
  if Bullet.notification?
34
34
  if response.headers["type"] && response.headers["type"].include?('text/html') && response.body.include?("<html>")
35
35
  response.body <<= Bullet.gather_inline_notifications
36
- response.headers["Content-Length"] = response.body.length.to_s
36
+ response.headers["Content-Length"] = response.body.bytesize.to_s
37
37
  end
38
38
 
39
39
  Bullet.perform_out_of_channel_notifications
@@ -3,7 +3,7 @@ module Bullet
3
3
  def mongoid?
4
4
  @mongoid ||= begin
5
5
  require 'mongoid'
6
- true
6
+ mongoid_version.present?
7
7
  rescue LoadError
8
8
  false
9
9
  end
@@ -25,17 +25,17 @@ module Bullet
25
25
  elsif active_record30?
26
26
  'active_record3'
27
27
  elsif active_record31? || active_record32? || active_record4?
28
- 'active_record31'
28
+ 'active_record3x'
29
29
  end
30
30
  end
31
31
  end
32
32
 
33
33
  def mongoid_version
34
34
  @mongoid_version ||= begin
35
- if mongoid24?
36
- 'mongoid24'
37
- elsif mongoid3?
38
- 'mongoid3'
35
+ if mongoid2x?
36
+ 'mongoid2x'
37
+ elsif mongoid3x?
38
+ 'mongoid3x'
39
39
  end
40
40
  end
41
41
  end
@@ -76,12 +76,16 @@ module Bullet
76
76
  active_record3? && ::ActiveRecord::VERSION::MINOR == 2
77
77
  end
78
78
 
79
- def mongoid24?
80
- ::Mongoid::VERSION =~ /\A2\.4/
79
+ def mongoid2x?
80
+ ::Mongoid::VERSION =~ /\A2\.[4|5]/
81
81
  end
82
82
 
83
- def mongoid3?
83
+ def mongoid3x?
84
84
  ::Mongoid::VERSION =~ /\A3/
85
85
  end
86
+
87
+ def rails2?
88
+ ::Rails::VERSION::MAJOR < 3
89
+ end
86
90
  end
87
91
  end
File without changes
@@ -15,7 +15,7 @@ module Bullet
15
15
  if Bullet.notification?
16
16
  if status == 200 && !response.body.frozen? && html_request?(headers, response)
17
17
  response_body = response.body << Bullet.gather_inline_notifications
18
- headers['Content-Length'] = response_body.length.to_s
18
+ headers['Content-Length'] = response_body.bytesize.to_s
19
19
  end
20
20
  Bullet.perform_out_of_channel_notifications(env)
21
21
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Bullet
3
- VERSION = "4.2.0"
3
+ VERSION = "4.3.0"
4
4
  end
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'spec_helper'
2
3
 
3
4
  module Bullet
@@ -87,6 +88,16 @@ module Bullet
87
88
  headers["Content-Length"].should == "56"
88
89
  response.should == ["<html><head></head><body></body></html><bullet></bullet>"]
89
90
  end
91
+
92
+ it "should set the right Content-Length if response body contains accents" do
93
+ response = Support::ResponseDouble.new
94
+ response.body = "<html><head></head><body>é</body></html>"
95
+ app.response = response
96
+ Bullet.should_receive(:notification?).and_return(true)
97
+ Bullet.should_receive(:gather_inline_notifications).and_return("<bullet></bullet>")
98
+ status, headers, response = middleware.call([200, {"Content-Type" => "text/html"}])
99
+ headers["Content-Length"].should == "58"
100
+ end
90
101
  end
91
102
 
92
103
  context "when Bullet is disabled" do
@@ -33,7 +33,7 @@ module Support
33
33
  end
34
34
 
35
35
  def setup_db
36
- if Mongoid::VERSION =~ /\A2\.4/
36
+ if Mongoid::VERSION =~ /\A2\.[4|5]/
37
37
  Mongoid.configure do |config|
38
38
  config.master = Mongo::Connection.new.db("bullet")
39
39
  end
data/test.sh CHANGED
@@ -1,5 +1,6 @@
1
1
  bundle && bundle exec rspec spec
2
- BUNDLE_GEMFILE=Gemfile.rails-3.1.5 bundle && bundle exec rspec spec
3
- BUNDLE_GEMFILE=Gemfile.rails-3.0.13 bundle && bundle exec rspec spec
4
- BUNDLE_GEMFILE=Gemfile.rails-2.3.14 bundle && bundle exec rspec spec
5
- BUNDLE_GEMFILE=Gemfile.rails-4-beta bundle && bundle exec rspec spec
2
+ BUNDLE_GEMFILE=Gemfile.rails-3.2.9 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.2.9 bundle exec rspec spec
3
+ BUNDLE_GEMFILE=Gemfile.rails-3.1.8 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.1.8 bundle exec rspec spec
4
+ BUNDLE_GEMFILE=Gemfile.rails-3.0.17 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.0.17 bundle exec rspec spec
5
+ BUNDLE_GEMFILE=Gemfile.rails-2.3.14 bundle && BUNDLE_GEMFILE=Gemfile.rails-2.3.14 bundle exec rspec spec
6
+ BUNDLE_GEMFILE=Gemfile.rails-4-beta bundle && BUNDLE_GEMFILE=Gemfile.rails-4-beta bundle exec rspec spec
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.2.0
4
+ version: 4.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-28 00:00:00.000000000 Z
12
+ date: 2012-12-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: uniform_notifier
16
- requirement: &70294547787940 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,12 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70294547787940
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  description: A rails plugin to kill N+1 queries and unused eager loading.
26
31
  email:
27
32
  - flyerhzm@gmail.com
@@ -36,8 +41,9 @@ files:
36
41
  - .travis.yml
37
42
  - Gemfile
38
43
  - Gemfile.rails-2.3.14
39
- - Gemfile.rails-3.0.13
40
- - Gemfile.rails-3.1.5
44
+ - Gemfile.rails-3.0.17
45
+ - Gemfile.rails-3.1.8
46
+ - Gemfile.rails-3.2.9
41
47
  - Gemfile.rails-4-beta
42
48
  - Guardfile
43
49
  - Hacking.textile
@@ -50,7 +56,7 @@ files:
50
56
  - lib/bullet/action_controller2.rb
51
57
  - lib/bullet/active_record2.rb
52
58
  - lib/bullet/active_record3.rb
53
- - lib/bullet/active_record31.rb
59
+ - lib/bullet/active_record3x.rb
54
60
  - lib/bullet/dependency.rb
55
61
  - lib/bullet/detector.rb
56
62
  - lib/bullet/detector/association.rb
@@ -60,8 +66,8 @@ files:
60
66
  - lib/bullet/detector/unused_eager_association.rb
61
67
  - lib/bullet/ext/object.rb
62
68
  - lib/bullet/ext/string.rb
63
- - lib/bullet/mongoid24.rb
64
- - lib/bullet/mongoid3.rb
69
+ - lib/bullet/mongoid2x.rb
70
+ - lib/bullet/mongoid3x.rb
65
71
  - lib/bullet/notification.rb
66
72
  - lib/bullet/notification/base.rb
67
73
  - lib/bullet/notification/counter_cache.rb
@@ -149,7 +155,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
155
  version: '0'
150
156
  segments:
151
157
  - 0
152
- hash: -1372591245763188534
158
+ hash: 197998252985008423
153
159
  required_rubygems_version: !ruby/object:Gem::Requirement
154
160
  none: false
155
161
  requirements:
@@ -158,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
164
  version: 1.3.6
159
165
  requirements: []
160
166
  rubyforge_project:
161
- rubygems_version: 1.8.17
167
+ rubygems_version: 1.8.24
162
168
  signing_key:
163
169
  specification_version: 3
164
170
  summary: A rails plugin to kill N+1 queries and unused eager loading.