bullet 4.0.0 → 4.13.1
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 +7 -0
- data/.gitignore +4 -0
- data/.rspec +1 -1
- data/.travis.yml +17 -6
- data/CHANGELOG.md +86 -0
- data/Gemfile +13 -12
- data/Gemfile.mongoid +14 -0
- data/Gemfile.mongoid-2.4 +19 -0
- data/Gemfile.mongoid-2.5 +19 -0
- data/Gemfile.mongoid-2.6 +19 -0
- data/Gemfile.mongoid-2.7 +19 -0
- data/Gemfile.mongoid-2.8 +19 -0
- data/Gemfile.mongoid-3.0 +19 -0
- data/Gemfile.mongoid-3.1 +19 -0
- data/Gemfile.mongoid-4.0 +19 -0
- data/Gemfile.rails-3.0 +19 -0
- data/Gemfile.rails-3.1 +19 -0
- data/Gemfile.rails-3.2 +19 -0
- data/Gemfile.rails-4.0 +19 -0
- data/Gemfile.rails-4.1 +19 -0
- data/{Hacking.textile → Hacking.md} +10 -5
- data/README.md +432 -0
- data/Rakefile +13 -6
- data/bullet.gemspec +6 -3
- data/lib/bullet/active_record3.rb +49 -11
- data/lib/bullet/active_record3x.rb +134 -0
- data/lib/bullet/{active_record31.rb → active_record4.rb} +45 -15
- data/lib/bullet/active_record41.rb +128 -0
- data/lib/bullet/dependency.rb +81 -0
- data/lib/bullet/detector/association.rb +24 -68
- data/lib/bullet/detector/base.rb +0 -6
- data/lib/bullet/detector/counter_cache.rb +59 -0
- data/lib/bullet/detector/n_plus_one_query.rb +56 -15
- data/lib/bullet/detector/unused_eager_loading.rb +84 -0
- data/lib/bullet/detector.rb +2 -2
- data/lib/bullet/ext/object.rb +10 -2
- data/lib/bullet/{mongoid.rb → mongoid2x.rb} +18 -18
- data/lib/bullet/mongoid3x.rb +56 -0
- data/lib/bullet/mongoid4x.rb +56 -0
- data/lib/bullet/notification/base.rb +22 -4
- data/lib/bullet/notification/n_plus_one_query.rb +1 -1
- data/lib/bullet/notification.rb +2 -0
- data/lib/bullet/rack.rb +51 -17
- data/lib/bullet/registry/base.rb +1 -1
- data/lib/bullet/registry/object.rb +4 -4
- data/lib/bullet/version.rb +1 -2
- data/lib/bullet.rb +119 -39
- data/perf/benchmark.rb +1 -4
- data/spec/bullet/detector/association_spec.rb +2 -70
- data/spec/bullet/detector/base_spec.rb +0 -6
- data/spec/bullet/detector/counter_cache_spec.rb +56 -0
- data/spec/bullet/detector/n_plus_one_query_spec.rb +78 -34
- data/spec/bullet/detector/unused_eager_loading_spec.rb +88 -0
- data/spec/bullet/ext/object_spec.rb +18 -7
- data/spec/bullet/ext/string_spec.rb +2 -2
- data/spec/bullet/notification/base_spec.rb +68 -15
- data/spec/bullet/notification/counter_cache_spec.rb +2 -2
- data/spec/bullet/notification/n_plus_one_query_spec.rb +4 -3
- data/spec/bullet/notification/unused_eager_loading_spec.rb +2 -2
- data/spec/bullet/notification_collector_spec.rb +4 -4
- data/spec/bullet/rack_spec.rb +40 -39
- data/spec/bullet/registry/association_spec.rb +3 -3
- data/spec/bullet/registry/base_spec.rb +6 -6
- data/spec/bullet/registry/object_spec.rb +4 -5
- data/spec/bullet_spec.rb +41 -0
- data/spec/integration/active_record3/association_spec.rb +662 -0
- data/spec/integration/active_record4/association_spec.rb +660 -0
- data/spec/integration/counter_cache_spec.rb +63 -0
- data/spec/integration/mongoid/association_spec.rb +190 -208
- data/spec/models/category.rb +1 -1
- data/spec/models/client.rb +1 -1
- data/spec/models/comment.rb +2 -2
- data/spec/models/document.rb +2 -2
- data/spec/models/firm.rb +1 -1
- 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 +4 -0
- data/spec/models/mongoid/user.rb +5 -0
- data/spec/models/newspaper.rb +1 -1
- data/spec/models/pet.rb +1 -1
- data/spec/models/post.rb +6 -13
- data/spec/spec_helper.rb +60 -25
- data/spec/support/bullet_ext.rb +1 -1
- data/spec/support/mongo_seed.rb +26 -2
- data/spec/support/sqlite_seed.rb +0 -6
- data/test.sh +15 -0
- metadata +77 -54
- data/.rvmrc +0 -2
- data/.rvmrc.example +0 -2
- data/Gemfile.lock +0 -132
- data/Gemfile.rails-2.3.14 +0 -16
- data/Gemfile.rails-2.3.14.lock +0 -65
- data/Gemfile.rails-3.0.12 +0 -17
- data/Gemfile.rails-3.0.12.lock +0 -116
- data/Gemfile.rails-3.1.4 +0 -18
- data/Gemfile.rails-3.1.4.lock +0 -134
- data/README.textile +0 -395
- data/README_for_rails2.textile +0 -400
- data/lib/bullet/action_controller2.rb +0 -49
- data/lib/bullet/active_record2.rb +0 -121
- data/lib/bullet/detector/counter.rb +0 -48
- data/lib/bullet/detector/unused_eager_association.rb +0 -42
- data/spec/bullet/detector/counter_spec.rb +0 -64
- data/spec/bullet/detector/unused_eager_association_spec.rb +0 -62
- data/spec/integration/association_spec.rb +0 -593
- data/spec/integration/counter_spec.rb +0 -39
- data/spec/integration/rails2/association_spec.rb +0 -593
- data/spec/integration/rails2/counter_spec.rb +0 -39
- data/test.result +0 -2293
data/spec/models/post.rb
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
class Post < ActiveRecord::Base
|
|
2
|
-
|
|
2
|
+
extend Bullet::Dependency
|
|
3
|
+
|
|
4
|
+
belongs_to :category, inverse_of: :posts
|
|
3
5
|
belongs_to :writer
|
|
4
|
-
has_many :comments
|
|
6
|
+
has_many :comments, inverse_of: :post
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
named_scope :in_category_name, lambda { |name|
|
|
9
|
-
{:conditions => ['categories.name = ?', name], :include => :category}
|
|
10
|
-
}
|
|
11
|
-
else
|
|
12
|
-
scope :preload_comments, lambda { includes(:comments) }
|
|
13
|
-
scope :in_category_name, lambda { |name|
|
|
14
|
-
where(['categories.name = ?', name]).includes(:category)
|
|
15
|
-
}
|
|
16
|
-
end
|
|
8
|
+
scope :preload_comments, -> { includes(:comments) }
|
|
9
|
+
scope :in_category_name, ->(name) { where(['categories.name = ?', name]).includes(:category) }
|
|
17
10
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,56 +1,78 @@
|
|
|
1
1
|
require 'rspec'
|
|
2
2
|
begin
|
|
3
|
-
require '
|
|
3
|
+
require 'active_record'
|
|
4
|
+
rescue LoadError
|
|
5
|
+
end
|
|
6
|
+
begin
|
|
7
|
+
require 'mongoid'
|
|
4
8
|
rescue LoadError
|
|
5
|
-
# rails 2.3
|
|
6
|
-
require 'initializer'
|
|
7
9
|
end
|
|
8
|
-
require 'active_record'
|
|
9
|
-
require 'action_controller'
|
|
10
10
|
|
|
11
11
|
module Rails
|
|
12
12
|
class <<self
|
|
13
13
|
def root
|
|
14
14
|
File.expand_path(__FILE__).split('/')[0..-3].join('/')
|
|
15
15
|
end
|
|
16
|
+
|
|
17
|
+
def env
|
|
18
|
+
"test"
|
|
19
|
+
end
|
|
16
20
|
end
|
|
17
21
|
end
|
|
18
22
|
|
|
19
23
|
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
|
|
20
24
|
require 'bullet'
|
|
25
|
+
extend Bullet::Dependency
|
|
21
26
|
Bullet.enable = true
|
|
22
|
-
ActiveRecord::Migration.verbose = false
|
|
23
27
|
|
|
24
28
|
MODELS = File.join(File.dirname(__FILE__), "models")
|
|
25
29
|
$LOAD_PATH.unshift(MODELS)
|
|
30
|
+
SUPPORT = File.join(File.dirname(__FILE__), "support")
|
|
31
|
+
Dir[ File.join(SUPPORT, "*.rb") ].reject { |filename| filename =~ /_seed.rb$/ }.sort.each { |file| require file }
|
|
32
|
+
|
|
33
|
+
require 'coveralls'
|
|
34
|
+
Coveralls.wear!
|
|
35
|
+
|
|
36
|
+
RSpec.configure do |config|
|
|
37
|
+
config.extend Bullet::Dependency
|
|
26
38
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
name = File.basename(filename, ".rb")
|
|
30
|
-
autoload name.camelize.to_sym, name
|
|
39
|
+
config.filter_run :focus => true
|
|
40
|
+
config.run_all_when_everything_filtered = true
|
|
31
41
|
end
|
|
32
42
|
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
if active_record?
|
|
44
|
+
ActiveRecord::Migration.verbose = false
|
|
35
45
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
# Autoload every active_record model for the test suite that sits in spec/models.
|
|
47
|
+
Dir[ File.join(MODELS, "*.rb") ].sort.each do |filename|
|
|
48
|
+
name = File.basename(filename, ".rb")
|
|
49
|
+
autoload name.camelize.to_sym, name
|
|
40
50
|
end
|
|
51
|
+
require File.join(SUPPORT, "sqlite_seed.rb")
|
|
52
|
+
|
|
53
|
+
RSpec.configure do |config|
|
|
54
|
+
config.before(:suite) do
|
|
55
|
+
Support::SqliteSeed.setup_db
|
|
56
|
+
Support::SqliteSeed.seed_db
|
|
57
|
+
end
|
|
41
58
|
|
|
42
|
-
|
|
43
|
-
|
|
59
|
+
config.before(:each) do
|
|
60
|
+
Bullet.start_request
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
config.after(:each) do
|
|
64
|
+
Bullet.end_request
|
|
65
|
+
end
|
|
44
66
|
end
|
|
45
67
|
|
|
46
|
-
|
|
47
|
-
|
|
68
|
+
if ENV["BULLET_LOG"]
|
|
69
|
+
require 'logger'
|
|
70
|
+
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
|
71
|
+
end
|
|
48
72
|
end
|
|
49
73
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
# Autoload every model for the test suite that sits in spec/models.
|
|
74
|
+
if mongoid?
|
|
75
|
+
# Autoload every mongoid model for the test suite that sits in spec/models.
|
|
54
76
|
Dir[ File.join(MODELS, "mongoid", "*.rb") ].sort.each { |file| require file }
|
|
55
77
|
require File.join(SUPPORT, "mongo_seed.rb")
|
|
56
78
|
|
|
@@ -61,8 +83,21 @@ begin
|
|
|
61
83
|
end
|
|
62
84
|
|
|
63
85
|
config.after(:suite) do
|
|
86
|
+
Support::MongoSeed.setup_db
|
|
64
87
|
Support::MongoSeed.teardown_db
|
|
65
88
|
end
|
|
89
|
+
|
|
90
|
+
config.before(:each) do
|
|
91
|
+
Bullet.start_request
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
config.after(:each) do
|
|
95
|
+
Bullet.end_request
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if ENV["BULLET_LOG"]
|
|
100
|
+
Mongoid.logger = Logger.new(STDOUT)
|
|
101
|
+
Moped.logger = Logger.new(STDOUT)
|
|
66
102
|
end
|
|
67
|
-
rescue LoadError
|
|
68
103
|
end
|
data/spec/support/bullet_ext.rb
CHANGED
|
@@ -33,7 +33,7 @@ module Bullet
|
|
|
33
33
|
|
|
34
34
|
# returns true if a given object has a specific association
|
|
35
35
|
def creating_object_association_for?(object, association)
|
|
36
|
-
object_associations[object.
|
|
36
|
+
object_associations[object.bullet_key].present? && object_associations[object.bullet_key].include?(association)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
# returns true if a given class includes the specific unpreloaded association
|
data/spec/support/mongo_seed.rb
CHANGED
|
@@ -8,6 +8,10 @@ module Support
|
|
|
8
8
|
post1a = category1.posts.create(:name => 'like first')
|
|
9
9
|
post2 = category2.posts.create(:name => 'second')
|
|
10
10
|
|
|
11
|
+
post1.users << Mongoid::User.create(:name => 'first')
|
|
12
|
+
post1.users << Mongoid::User.create(:name => 'another')
|
|
13
|
+
post2.users << Mongoid::User.create(:name => 'second')
|
|
14
|
+
|
|
11
15
|
comment1 = post1.comments.create(:name => 'first')
|
|
12
16
|
comment2 = post1.comments.create(:name => 'first2')
|
|
13
17
|
comment3 = post1.comments.create(:name => 'first3')
|
|
@@ -29,11 +33,31 @@ module Support
|
|
|
29
33
|
end
|
|
30
34
|
|
|
31
35
|
def setup_db
|
|
32
|
-
Mongoid
|
|
36
|
+
if Mongoid::VERSION =~ /\A2\.[4-8]/
|
|
37
|
+
Mongoid.configure do |config|
|
|
38
|
+
config.master = Mongo::Connection.new.db("bullet")
|
|
39
|
+
end
|
|
40
|
+
elsif Mongoid::VERSION =~ /\A3/
|
|
41
|
+
Mongoid.configure do |config|
|
|
42
|
+
config.connect_to("bullet")
|
|
43
|
+
end
|
|
44
|
+
elsif Mongoid::VERSION =~ /\A4/
|
|
45
|
+
Mongoid.configure do |config|
|
|
46
|
+
config.load_configuration(
|
|
47
|
+
sessions: {
|
|
48
|
+
default: {
|
|
49
|
+
database: "bullet",
|
|
50
|
+
hosts: [ "localhost:27017" ]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
33
56
|
end
|
|
34
57
|
|
|
35
58
|
def teardown_db
|
|
36
|
-
Mongoid.
|
|
59
|
+
Mongoid.purge!
|
|
60
|
+
Mongoid::IdentityMap.clear if Mongoid.const_defined?(:IdentityMap)
|
|
37
61
|
end
|
|
38
62
|
|
|
39
63
|
extend self
|
data/spec/support/sqlite_seed.rb
CHANGED
data/test.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#bundle update rails && bundle exec rspec spec
|
|
2
|
+
#BUNDLE_GEMFILE=Gemfile.mongoid bundle update mongoid && BUNDLE_GEMFILE=Gemfile.mongoid bundle exec rspec spec
|
|
3
|
+
BUNDLE_GEMFILE=Gemfile.rails-4.1 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.1 bundle exec rspec spec
|
|
4
|
+
BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle exec rspec spec
|
|
5
|
+
BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle exec rspec spec
|
|
6
|
+
BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle exec rspec spec
|
|
7
|
+
BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle exec rspec spec
|
|
8
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle exec rspec spec
|
|
9
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle exec rspec spec
|
|
10
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle exec rspec spec
|
|
11
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.8 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.8 bundle exec rspec spec
|
|
12
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.7 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.7 bundle exec rspec spec
|
|
13
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.6 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.6 bundle exec rspec spec
|
|
14
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.5 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.5 bundle exec rspec spec
|
|
15
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.4 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.4 bundle exec rspec spec
|
metadata
CHANGED
|
@@ -1,68 +1,92 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bullet
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 4.13.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: 2014-08-03 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: activesupport
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 3.0.0
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 3.0.0
|
|
14
27
|
- !ruby/object:Gem::Dependency
|
|
15
28
|
name: uniform_notifier
|
|
16
|
-
requirement:
|
|
17
|
-
none: false
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
18
30
|
requirements:
|
|
19
|
-
- -
|
|
31
|
+
- - ">="
|
|
20
32
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: 1.
|
|
33
|
+
version: 1.6.0
|
|
22
34
|
type: :runtime
|
|
23
35
|
prerelease: false
|
|
24
|
-
version_requirements:
|
|
25
|
-
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 1.6.0
|
|
41
|
+
description: help to kill N+1 queries and unused eager loading.
|
|
26
42
|
email:
|
|
27
43
|
- flyerhzm@gmail.com
|
|
28
44
|
executables: []
|
|
29
45
|
extensions: []
|
|
30
46
|
extra_rdoc_files: []
|
|
31
47
|
files:
|
|
32
|
-
- .gitignore
|
|
33
|
-
- .rspec
|
|
34
|
-
- .
|
|
35
|
-
- .
|
|
36
|
-
- .travis.yml
|
|
48
|
+
- ".gitignore"
|
|
49
|
+
- ".rspec"
|
|
50
|
+
- ".travis.yml"
|
|
51
|
+
- CHANGELOG.md
|
|
37
52
|
- Gemfile
|
|
38
|
-
- Gemfile.
|
|
39
|
-
- Gemfile.
|
|
40
|
-
- Gemfile.
|
|
41
|
-
- Gemfile.
|
|
42
|
-
- Gemfile.
|
|
43
|
-
- Gemfile.
|
|
44
|
-
- Gemfile.
|
|
53
|
+
- Gemfile.mongoid
|
|
54
|
+
- Gemfile.mongoid-2.4
|
|
55
|
+
- Gemfile.mongoid-2.5
|
|
56
|
+
- Gemfile.mongoid-2.6
|
|
57
|
+
- Gemfile.mongoid-2.7
|
|
58
|
+
- Gemfile.mongoid-2.8
|
|
59
|
+
- Gemfile.mongoid-3.0
|
|
60
|
+
- Gemfile.mongoid-3.1
|
|
61
|
+
- Gemfile.mongoid-4.0
|
|
62
|
+
- Gemfile.rails-3.0
|
|
63
|
+
- Gemfile.rails-3.1
|
|
64
|
+
- Gemfile.rails-3.2
|
|
65
|
+
- Gemfile.rails-4.0
|
|
66
|
+
- Gemfile.rails-4.1
|
|
45
67
|
- Guardfile
|
|
46
|
-
- Hacking.
|
|
68
|
+
- Hacking.md
|
|
47
69
|
- MIT-LICENSE
|
|
48
|
-
- README.
|
|
49
|
-
- README_for_rails2.textile
|
|
70
|
+
- README.md
|
|
50
71
|
- Rakefile
|
|
51
72
|
- bullet.gemspec
|
|
52
73
|
- lib/bullet.rb
|
|
53
|
-
- lib/bullet/action_controller2.rb
|
|
54
|
-
- lib/bullet/active_record2.rb
|
|
55
74
|
- lib/bullet/active_record3.rb
|
|
56
|
-
- lib/bullet/
|
|
75
|
+
- lib/bullet/active_record3x.rb
|
|
76
|
+
- lib/bullet/active_record4.rb
|
|
77
|
+
- lib/bullet/active_record41.rb
|
|
78
|
+
- lib/bullet/dependency.rb
|
|
57
79
|
- lib/bullet/detector.rb
|
|
58
80
|
- lib/bullet/detector/association.rb
|
|
59
81
|
- lib/bullet/detector/base.rb
|
|
60
|
-
- lib/bullet/detector/
|
|
82
|
+
- lib/bullet/detector/counter_cache.rb
|
|
61
83
|
- lib/bullet/detector/n_plus_one_query.rb
|
|
62
|
-
- lib/bullet/detector/
|
|
84
|
+
- lib/bullet/detector/unused_eager_loading.rb
|
|
63
85
|
- lib/bullet/ext/object.rb
|
|
64
86
|
- lib/bullet/ext/string.rb
|
|
65
|
-
- lib/bullet/
|
|
87
|
+
- lib/bullet/mongoid2x.rb
|
|
88
|
+
- lib/bullet/mongoid3x.rb
|
|
89
|
+
- lib/bullet/mongoid4x.rb
|
|
66
90
|
- lib/bullet/notification.rb
|
|
67
91
|
- lib/bullet/notification/base.rb
|
|
68
92
|
- lib/bullet/notification/counter_cache.rb
|
|
@@ -79,9 +103,9 @@ files:
|
|
|
79
103
|
- rails/init.rb
|
|
80
104
|
- spec/bullet/detector/association_spec.rb
|
|
81
105
|
- spec/bullet/detector/base_spec.rb
|
|
82
|
-
- spec/bullet/detector/
|
|
106
|
+
- spec/bullet/detector/counter_cache_spec.rb
|
|
83
107
|
- spec/bullet/detector/n_plus_one_query_spec.rb
|
|
84
|
-
- spec/bullet/detector/
|
|
108
|
+
- spec/bullet/detector/unused_eager_loading_spec.rb
|
|
85
109
|
- spec/bullet/ext/object_spec.rb
|
|
86
110
|
- spec/bullet/ext/string_spec.rb
|
|
87
111
|
- spec/bullet/notification/base_spec.rb
|
|
@@ -93,11 +117,11 @@ files:
|
|
|
93
117
|
- spec/bullet/registry/association_spec.rb
|
|
94
118
|
- spec/bullet/registry/base_spec.rb
|
|
95
119
|
- spec/bullet/registry/object_spec.rb
|
|
96
|
-
- spec/
|
|
97
|
-
- spec/integration/
|
|
120
|
+
- spec/bullet_spec.rb
|
|
121
|
+
- spec/integration/active_record3/association_spec.rb
|
|
122
|
+
- spec/integration/active_record4/association_spec.rb
|
|
123
|
+
- spec/integration/counter_cache_spec.rb
|
|
98
124
|
- spec/integration/mongoid/association_spec.rb
|
|
99
|
-
- spec/integration/rails2/association_spec.rb
|
|
100
|
-
- spec/integration/rails2/counter_spec.rb
|
|
101
125
|
- spec/models/address.rb
|
|
102
126
|
- spec/models/author.rb
|
|
103
127
|
- spec/models/base_user.rb
|
|
@@ -117,6 +141,7 @@ files:
|
|
|
117
141
|
- spec/models/mongoid/company.rb
|
|
118
142
|
- spec/models/mongoid/entry.rb
|
|
119
143
|
- spec/models/mongoid/post.rb
|
|
144
|
+
- spec/models/mongoid/user.rb
|
|
120
145
|
- spec/models/newspaper.rb
|
|
121
146
|
- spec/models/page.rb
|
|
122
147
|
- spec/models/person.rb
|
|
@@ -134,40 +159,37 @@ files:
|
|
|
134
159
|
- spec/support/rack_double.rb
|
|
135
160
|
- spec/support/sqlite_seed.rb
|
|
136
161
|
- tasks/bullet_tasks.rake
|
|
137
|
-
- test.
|
|
162
|
+
- test.sh
|
|
138
163
|
homepage: http://github.com/flyerhzm/bullet
|
|
139
|
-
licenses:
|
|
164
|
+
licenses:
|
|
165
|
+
- MIT
|
|
166
|
+
metadata: {}
|
|
140
167
|
post_install_message:
|
|
141
168
|
rdoc_options: []
|
|
142
169
|
require_paths:
|
|
143
170
|
- lib
|
|
144
171
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
|
-
none: false
|
|
146
172
|
requirements:
|
|
147
|
-
- -
|
|
173
|
+
- - ">="
|
|
148
174
|
- !ruby/object:Gem::Version
|
|
149
175
|
version: '0'
|
|
150
|
-
segments:
|
|
151
|
-
- 0
|
|
152
|
-
hash: -3387566190207483190
|
|
153
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
|
-
none: false
|
|
155
177
|
requirements:
|
|
156
|
-
- -
|
|
178
|
+
- - ">="
|
|
157
179
|
- !ruby/object:Gem::Version
|
|
158
180
|
version: 1.3.6
|
|
159
181
|
requirements: []
|
|
160
182
|
rubyforge_project:
|
|
161
|
-
rubygems_version:
|
|
183
|
+
rubygems_version: 2.2.2
|
|
162
184
|
signing_key:
|
|
163
|
-
specification_version:
|
|
164
|
-
summary:
|
|
185
|
+
specification_version: 4
|
|
186
|
+
summary: help to kill N+1 queries and unused eager loading.
|
|
165
187
|
test_files:
|
|
166
188
|
- spec/bullet/detector/association_spec.rb
|
|
167
189
|
- spec/bullet/detector/base_spec.rb
|
|
168
|
-
- spec/bullet/detector/
|
|
190
|
+
- spec/bullet/detector/counter_cache_spec.rb
|
|
169
191
|
- spec/bullet/detector/n_plus_one_query_spec.rb
|
|
170
|
-
- spec/bullet/detector/
|
|
192
|
+
- spec/bullet/detector/unused_eager_loading_spec.rb
|
|
171
193
|
- spec/bullet/ext/object_spec.rb
|
|
172
194
|
- spec/bullet/ext/string_spec.rb
|
|
173
195
|
- spec/bullet/notification/base_spec.rb
|
|
@@ -179,11 +201,11 @@ test_files:
|
|
|
179
201
|
- spec/bullet/registry/association_spec.rb
|
|
180
202
|
- spec/bullet/registry/base_spec.rb
|
|
181
203
|
- spec/bullet/registry/object_spec.rb
|
|
182
|
-
- spec/
|
|
183
|
-
- spec/integration/
|
|
204
|
+
- spec/bullet_spec.rb
|
|
205
|
+
- spec/integration/active_record3/association_spec.rb
|
|
206
|
+
- spec/integration/active_record4/association_spec.rb
|
|
207
|
+
- spec/integration/counter_cache_spec.rb
|
|
184
208
|
- spec/integration/mongoid/association_spec.rb
|
|
185
|
-
- spec/integration/rails2/association_spec.rb
|
|
186
|
-
- spec/integration/rails2/counter_spec.rb
|
|
187
209
|
- spec/models/address.rb
|
|
188
210
|
- spec/models/author.rb
|
|
189
211
|
- spec/models/base_user.rb
|
|
@@ -203,6 +225,7 @@ test_files:
|
|
|
203
225
|
- spec/models/mongoid/company.rb
|
|
204
226
|
- spec/models/mongoid/entry.rb
|
|
205
227
|
- spec/models/mongoid/post.rb
|
|
228
|
+
- spec/models/mongoid/user.rb
|
|
206
229
|
- spec/models/newspaper.rb
|
|
207
230
|
- spec/models/page.rb
|
|
208
231
|
- spec/models/person.rb
|
data/.rvmrc
DELETED
data/.rvmrc.example
DELETED
data/Gemfile.lock
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
bullet (4.0.0)
|
|
5
|
-
uniform_notifier (~> 1.0.0)
|
|
6
|
-
|
|
7
|
-
GEM
|
|
8
|
-
remote: http://rubygems.org/
|
|
9
|
-
specs:
|
|
10
|
-
actionmailer (3.2.3)
|
|
11
|
-
actionpack (= 3.2.3)
|
|
12
|
-
mail (~> 2.4.4)
|
|
13
|
-
actionpack (3.2.3)
|
|
14
|
-
activemodel (= 3.2.3)
|
|
15
|
-
activesupport (= 3.2.3)
|
|
16
|
-
builder (~> 3.0.0)
|
|
17
|
-
erubis (~> 2.7.0)
|
|
18
|
-
journey (~> 1.0.1)
|
|
19
|
-
rack (~> 1.4.0)
|
|
20
|
-
rack-cache (~> 1.2)
|
|
21
|
-
rack-test (~> 0.6.1)
|
|
22
|
-
sprockets (~> 2.1.2)
|
|
23
|
-
activemodel (3.2.3)
|
|
24
|
-
activesupport (= 3.2.3)
|
|
25
|
-
builder (~> 3.0.0)
|
|
26
|
-
activerecord (3.2.3)
|
|
27
|
-
activemodel (= 3.2.3)
|
|
28
|
-
activesupport (= 3.2.3)
|
|
29
|
-
arel (~> 3.0.2)
|
|
30
|
-
tzinfo (~> 0.3.29)
|
|
31
|
-
activerecord-import (0.2.9)
|
|
32
|
-
activerecord (~> 3.0)
|
|
33
|
-
activerecord (~> 3.0)
|
|
34
|
-
activeresource (3.2.3)
|
|
35
|
-
activemodel (= 3.2.3)
|
|
36
|
-
activesupport (= 3.2.3)
|
|
37
|
-
activesupport (3.2.3)
|
|
38
|
-
i18n (~> 0.6)
|
|
39
|
-
multi_json (~> 1.0)
|
|
40
|
-
arel (3.0.2)
|
|
41
|
-
bson (1.6.2)
|
|
42
|
-
bson_ext (1.6.2)
|
|
43
|
-
bson (~> 1.6.2)
|
|
44
|
-
builder (3.0.0)
|
|
45
|
-
diff-lcs (1.1.3)
|
|
46
|
-
erubis (2.7.0)
|
|
47
|
-
ffi (1.0.11)
|
|
48
|
-
guard (1.0.1)
|
|
49
|
-
ffi (>= 0.5.0)
|
|
50
|
-
thor (~> 0.14.6)
|
|
51
|
-
guard-rspec (0.6.0)
|
|
52
|
-
guard (>= 0.10.0)
|
|
53
|
-
hike (1.2.1)
|
|
54
|
-
i18n (0.6.0)
|
|
55
|
-
journey (1.0.3)
|
|
56
|
-
json (1.7.0)
|
|
57
|
-
mail (2.4.4)
|
|
58
|
-
i18n (>= 0.4.0)
|
|
59
|
-
mime-types (~> 1.16)
|
|
60
|
-
treetop (~> 1.4.8)
|
|
61
|
-
mime-types (1.18)
|
|
62
|
-
mongo (1.6.2)
|
|
63
|
-
bson (~> 1.6.2)
|
|
64
|
-
mongoid (2.4.9)
|
|
65
|
-
activemodel (~> 3.1)
|
|
66
|
-
mongo (~> 1.3)
|
|
67
|
-
tzinfo (~> 0.3.22)
|
|
68
|
-
multi_json (1.3.4)
|
|
69
|
-
mysql (2.8.1)
|
|
70
|
-
perftools.rb (2.0.0)
|
|
71
|
-
polyglot (0.3.3)
|
|
72
|
-
rack (1.4.1)
|
|
73
|
-
rack-cache (1.2)
|
|
74
|
-
rack (>= 0.4)
|
|
75
|
-
rack-ssl (1.3.2)
|
|
76
|
-
rack
|
|
77
|
-
rack-test (0.6.1)
|
|
78
|
-
rack (>= 1.0)
|
|
79
|
-
rails (3.2.3)
|
|
80
|
-
actionmailer (= 3.2.3)
|
|
81
|
-
actionpack (= 3.2.3)
|
|
82
|
-
activerecord (= 3.2.3)
|
|
83
|
-
activeresource (= 3.2.3)
|
|
84
|
-
activesupport (= 3.2.3)
|
|
85
|
-
bundler (~> 1.0)
|
|
86
|
-
railties (= 3.2.3)
|
|
87
|
-
railties (3.2.3)
|
|
88
|
-
actionpack (= 3.2.3)
|
|
89
|
-
activesupport (= 3.2.3)
|
|
90
|
-
rack-ssl (~> 1.3.2)
|
|
91
|
-
rake (>= 0.8.7)
|
|
92
|
-
rdoc (~> 3.4)
|
|
93
|
-
thor (~> 0.14.6)
|
|
94
|
-
rake (0.9.2.2)
|
|
95
|
-
rdoc (3.12)
|
|
96
|
-
json (~> 1.4)
|
|
97
|
-
rspec (2.9.0)
|
|
98
|
-
rspec-core (~> 2.9.0)
|
|
99
|
-
rspec-expectations (~> 2.9.0)
|
|
100
|
-
rspec-mocks (~> 2.9.0)
|
|
101
|
-
rspec-core (2.9.0)
|
|
102
|
-
rspec-expectations (2.9.0)
|
|
103
|
-
diff-lcs (~> 1.1.3)
|
|
104
|
-
rspec-mocks (2.9.0)
|
|
105
|
-
sprockets (2.1.3)
|
|
106
|
-
hike (~> 1.2)
|
|
107
|
-
rack (~> 1.0)
|
|
108
|
-
tilt (~> 1.1, != 1.3.0)
|
|
109
|
-
sqlite3 (1.3.5)
|
|
110
|
-
thor (0.14.6)
|
|
111
|
-
tilt (1.3.3)
|
|
112
|
-
treetop (1.4.10)
|
|
113
|
-
polyglot
|
|
114
|
-
polyglot (>= 0.3.1)
|
|
115
|
-
tzinfo (0.3.33)
|
|
116
|
-
uniform_notifier (1.0.2)
|
|
117
|
-
|
|
118
|
-
PLATFORMS
|
|
119
|
-
ruby
|
|
120
|
-
|
|
121
|
-
DEPENDENCIES
|
|
122
|
-
activerecord-import
|
|
123
|
-
bson_ext
|
|
124
|
-
bullet!
|
|
125
|
-
guard
|
|
126
|
-
guard-rspec
|
|
127
|
-
mongoid
|
|
128
|
-
mysql
|
|
129
|
-
perftools.rb
|
|
130
|
-
rails (= 3.2.3)
|
|
131
|
-
rspec
|
|
132
|
-
sqlite3
|
data/Gemfile.rails-2.3.14
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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', '2.3.14'
|
|
8
|
-
gem 'sqlite3'
|
|
9
|
-
gem 'mysql'
|
|
10
|
-
gem 'bson_ext'
|
|
11
|
-
|
|
12
|
-
gem "rspec"
|
|
13
|
-
gem "guard"
|
|
14
|
-
gem "guard-rspec"
|
|
15
|
-
|
|
16
|
-
gem "perftools.rb"
|
data/Gemfile.rails-2.3.14.lock
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
bullet (2.3.1)
|
|
5
|
-
uniform_notifier (~> 1.0.0)
|
|
6
|
-
|
|
7
|
-
GEM
|
|
8
|
-
remote: http://rubygems.org/
|
|
9
|
-
specs:
|
|
10
|
-
actionmailer (2.3.14)
|
|
11
|
-
actionpack (= 2.3.14)
|
|
12
|
-
actionpack (2.3.14)
|
|
13
|
-
activesupport (= 2.3.14)
|
|
14
|
-
rack (~> 1.1.0)
|
|
15
|
-
activerecord (2.3.14)
|
|
16
|
-
activesupport (= 2.3.14)
|
|
17
|
-
activeresource (2.3.14)
|
|
18
|
-
activesupport (= 2.3.14)
|
|
19
|
-
activesupport (2.3.14)
|
|
20
|
-
bson (1.6.2)
|
|
21
|
-
bson_ext (1.6.2)
|
|
22
|
-
bson (~> 1.6.2)
|
|
23
|
-
diff-lcs (1.1.3)
|
|
24
|
-
ffi (1.0.11)
|
|
25
|
-
guard (1.0.2)
|
|
26
|
-
ffi (>= 0.5.0)
|
|
27
|
-
thor (~> 0.14.6)
|
|
28
|
-
guard-rspec (0.7.0)
|
|
29
|
-
guard (>= 0.10.0)
|
|
30
|
-
mysql (2.8.1)
|
|
31
|
-
perftools.rb (2.0.0)
|
|
32
|
-
rack (1.1.3)
|
|
33
|
-
rails (2.3.14)
|
|
34
|
-
actionmailer (= 2.3.14)
|
|
35
|
-
actionpack (= 2.3.14)
|
|
36
|
-
activerecord (= 2.3.14)
|
|
37
|
-
activeresource (= 2.3.14)
|
|
38
|
-
activesupport (= 2.3.14)
|
|
39
|
-
rake (>= 0.8.3)
|
|
40
|
-
rake (0.9.2.2)
|
|
41
|
-
rspec (2.10.0)
|
|
42
|
-
rspec-core (~> 2.10.0)
|
|
43
|
-
rspec-expectations (~> 2.10.0)
|
|
44
|
-
rspec-mocks (~> 2.10.0)
|
|
45
|
-
rspec-core (2.10.0)
|
|
46
|
-
rspec-expectations (2.10.0)
|
|
47
|
-
diff-lcs (~> 1.1.3)
|
|
48
|
-
rspec-mocks (2.10.1)
|
|
49
|
-
sqlite3 (1.3.6)
|
|
50
|
-
thor (0.14.6)
|
|
51
|
-
uniform_notifier (1.0.2)
|
|
52
|
-
|
|
53
|
-
PLATFORMS
|
|
54
|
-
ruby
|
|
55
|
-
|
|
56
|
-
DEPENDENCIES
|
|
57
|
-
bson_ext
|
|
58
|
-
bullet!
|
|
59
|
-
guard
|
|
60
|
-
guard-rspec
|
|
61
|
-
mysql
|
|
62
|
-
perftools.rb
|
|
63
|
-
rails (= 2.3.14)
|
|
64
|
-
rspec
|
|
65
|
-
sqlite3
|