bullet 4.0.0 → 4.1.4
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.
- data/.gitignore +1 -0
- data/.travis.yml +4 -2
- data/Gemfile +2 -3
- data/Gemfile.lock +36 -39
- data/Gemfile.rails-2.3.14.lock +1 -1
- data/{Gemfile.rails-3.0.12 → Gemfile.rails-3.0.13} +1 -1
- data/{Gemfile.rails-3.0.12.lock → Gemfile.rails-3.0.13.lock} +27 -27
- data/{Gemfile.rails-3.1.4 → Gemfile.rails-3.1.5} +2 -2
- data/{Gemfile.rails-3.1.4.lock → Gemfile.rails-3.1.5.lock} +34 -34
- data/README.textile +3 -1
- data/README_for_rails2.textile +4 -0
- data/lib/bullet/action_controller2.rb +5 -4
- data/lib/bullet/dependency.rb +83 -0
- data/lib/bullet/{mongoid.rb → mongoid24.rb} +13 -15
- data/lib/bullet/mongoid3.rb +53 -0
- data/lib/bullet/rack.rb +8 -6
- data/lib/bullet/version.rb +1 -2
- data/lib/bullet.rb +12 -17
- data/spec/bullet/ext/object_spec.rb +1 -4
- data/spec/integration/association_spec.rb +1 -1
- data/spec/integration/counter_spec.rb +1 -1
- data/spec/integration/mongoid/association_spec.rb +174 -199
- data/spec/integration/rails2/association_spec.rb +1 -1
- data/spec/integration/rails2/counter_spec.rb +2 -2
- data/spec/models/post.rb +3 -1
- data/spec/spec_helper.rb +26 -22
- data/spec/support/mongo_seed.rb +10 -2
- data/test.sh +4 -0
- metadata +14 -12
- data/test.result +0 -2293
data/spec/spec_helper.rb
CHANGED
|
@@ -5,7 +5,6 @@ rescue LoadError
|
|
|
5
5
|
# rails 2.3
|
|
6
6
|
require 'initializer'
|
|
7
7
|
end
|
|
8
|
-
require 'active_record'
|
|
9
8
|
require 'action_controller'
|
|
10
9
|
|
|
11
10
|
module Rails
|
|
@@ -18,39 +17,45 @@ end
|
|
|
18
17
|
|
|
19
18
|
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
|
|
20
19
|
require 'bullet'
|
|
20
|
+
extend Bullet::Dependency
|
|
21
21
|
Bullet.enable = true
|
|
22
|
-
ActiveRecord::Migration.verbose = false
|
|
23
22
|
|
|
24
23
|
MODELS = File.join(File.dirname(__FILE__), "models")
|
|
25
24
|
$LOAD_PATH.unshift(MODELS)
|
|
26
|
-
|
|
27
|
-
# Autoload every model for the test suite that sits in spec/models.
|
|
28
|
-
Dir[ File.join(MODELS, "*.rb") ].sort.each do |filename|
|
|
29
|
-
name = File.basename(filename, ".rb")
|
|
30
|
-
autoload name.camelize.to_sym, name
|
|
31
|
-
end
|
|
32
|
-
|
|
33
25
|
SUPPORT = File.join(File.dirname(__FILE__), "support")
|
|
34
|
-
Dir[ File.join(SUPPORT, "*.rb") ].reject { |filename| filename =~ /
|
|
26
|
+
Dir[ File.join(SUPPORT, "*.rb") ].reject { |filename| filename =~ /_seed.rb$/ }.sort.each { |file| require file }
|
|
35
27
|
|
|
36
28
|
RSpec.configure do |config|
|
|
37
|
-
config.
|
|
38
|
-
Support::SqliteSeed.setup_db
|
|
39
|
-
Support::SqliteSeed.seed_db
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
config.after(:suite) do
|
|
43
|
-
Support::SqliteSeed.teardown_db
|
|
44
|
-
end
|
|
29
|
+
config.extend Bullet::Dependency
|
|
45
30
|
|
|
46
31
|
config.filter_run :focus => true
|
|
47
32
|
config.run_all_when_everything_filtered = true
|
|
48
33
|
end
|
|
49
34
|
|
|
50
|
-
|
|
51
|
-
|
|
35
|
+
if active_record?
|
|
36
|
+
ActiveRecord::Migration.verbose = false
|
|
52
37
|
|
|
53
|
-
# Autoload every model for the test suite that sits in spec/models.
|
|
38
|
+
# Autoload every active_record model for the test suite that sits in spec/models.
|
|
39
|
+
Dir[ File.join(MODELS, "*.rb") ].sort.each do |filename|
|
|
40
|
+
name = File.basename(filename, ".rb")
|
|
41
|
+
autoload name.camelize.to_sym, name
|
|
42
|
+
end
|
|
43
|
+
require File.join(SUPPORT, "sqlite_seed.rb")
|
|
44
|
+
|
|
45
|
+
RSpec.configure do |config|
|
|
46
|
+
config.before(:suite) do
|
|
47
|
+
Support::SqliteSeed.setup_db
|
|
48
|
+
Support::SqliteSeed.seed_db
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
config.after(:suite) do
|
|
52
|
+
Support::SqliteSeed.teardown_db
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
if mongoid?
|
|
58
|
+
# Autoload every mongoid model for the test suite that sits in spec/models.
|
|
54
59
|
Dir[ File.join(MODELS, "mongoid", "*.rb") ].sort.each { |file| require file }
|
|
55
60
|
require File.join(SUPPORT, "mongo_seed.rb")
|
|
56
61
|
|
|
@@ -64,5 +69,4 @@ begin
|
|
|
64
69
|
Support::MongoSeed.teardown_db
|
|
65
70
|
end
|
|
66
71
|
end
|
|
67
|
-
rescue LoadError
|
|
68
72
|
end
|
data/spec/support/mongo_seed.rb
CHANGED
|
@@ -29,11 +29,19 @@ module Support
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def setup_db
|
|
32
|
-
Mongoid
|
|
32
|
+
if Mongoid::VERSION =~ /\A2\.4/
|
|
33
|
+
Mongoid.configure do |config|
|
|
34
|
+
config.master = Mongo::Connection.new.db("bullet")
|
|
35
|
+
end
|
|
36
|
+
elsif Mongoid::VERSION =~ /\A3/
|
|
37
|
+
Mongoid.configure do |config|
|
|
38
|
+
config.connect_to("bullet")
|
|
39
|
+
end
|
|
40
|
+
end
|
|
33
41
|
end
|
|
34
42
|
|
|
35
43
|
def teardown_db
|
|
36
|
-
Mongoid.
|
|
44
|
+
Mongoid.purge!
|
|
37
45
|
end
|
|
38
46
|
|
|
39
47
|
extend self
|
data/test.sh
ADDED
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.
|
|
4
|
+
version: 4.1.4
|
|
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-
|
|
12
|
+
date: 2012-06-23 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: uniform_notifier
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &70278160365200 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ~>
|
|
@@ -21,7 +21,7 @@ dependencies:
|
|
|
21
21
|
version: 1.0.0
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *70278160365200
|
|
25
25
|
description: A rails plugin to kill N+1 queries and unused eager loading.
|
|
26
26
|
email:
|
|
27
27
|
- flyerhzm@gmail.com
|
|
@@ -38,10 +38,10 @@ files:
|
|
|
38
38
|
- Gemfile.lock
|
|
39
39
|
- Gemfile.rails-2.3.14
|
|
40
40
|
- Gemfile.rails-2.3.14.lock
|
|
41
|
-
- Gemfile.rails-3.0.
|
|
42
|
-
- Gemfile.rails-3.0.
|
|
43
|
-
- Gemfile.rails-3.1.
|
|
44
|
-
- Gemfile.rails-3.1.
|
|
41
|
+
- Gemfile.rails-3.0.13
|
|
42
|
+
- Gemfile.rails-3.0.13.lock
|
|
43
|
+
- Gemfile.rails-3.1.5
|
|
44
|
+
- Gemfile.rails-3.1.5.lock
|
|
45
45
|
- Guardfile
|
|
46
46
|
- Hacking.textile
|
|
47
47
|
- MIT-LICENSE
|
|
@@ -54,6 +54,7 @@ files:
|
|
|
54
54
|
- lib/bullet/active_record2.rb
|
|
55
55
|
- lib/bullet/active_record3.rb
|
|
56
56
|
- lib/bullet/active_record31.rb
|
|
57
|
+
- lib/bullet/dependency.rb
|
|
57
58
|
- lib/bullet/detector.rb
|
|
58
59
|
- lib/bullet/detector/association.rb
|
|
59
60
|
- lib/bullet/detector/base.rb
|
|
@@ -62,7 +63,8 @@ files:
|
|
|
62
63
|
- lib/bullet/detector/unused_eager_association.rb
|
|
63
64
|
- lib/bullet/ext/object.rb
|
|
64
65
|
- lib/bullet/ext/string.rb
|
|
65
|
-
- lib/bullet/
|
|
66
|
+
- lib/bullet/mongoid24.rb
|
|
67
|
+
- lib/bullet/mongoid3.rb
|
|
66
68
|
- lib/bullet/notification.rb
|
|
67
69
|
- lib/bullet/notification/base.rb
|
|
68
70
|
- lib/bullet/notification/counter_cache.rb
|
|
@@ -134,7 +136,7 @@ files:
|
|
|
134
136
|
- spec/support/rack_double.rb
|
|
135
137
|
- spec/support/sqlite_seed.rb
|
|
136
138
|
- tasks/bullet_tasks.rake
|
|
137
|
-
- test.
|
|
139
|
+
- test.sh
|
|
138
140
|
homepage: http://github.com/flyerhzm/bullet
|
|
139
141
|
licenses: []
|
|
140
142
|
post_install_message:
|
|
@@ -149,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
149
151
|
version: '0'
|
|
150
152
|
segments:
|
|
151
153
|
- 0
|
|
152
|
-
hash:
|
|
154
|
+
hash: 107640970782381372
|
|
153
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
156
|
none: false
|
|
155
157
|
requirements:
|
|
@@ -158,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
158
160
|
version: 1.3.6
|
|
159
161
|
requirements: []
|
|
160
162
|
rubyforge_project:
|
|
161
|
-
rubygems_version: 1.8.
|
|
163
|
+
rubygems_version: 1.8.17
|
|
162
164
|
signing_key:
|
|
163
165
|
specification_version: 3
|
|
164
166
|
summary: A rails plugin to kill N+1 queries and unused eager loading.
|