bullet 4.1.0 → 4.2.0

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/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 =~ /mongo_seed.rb$/ }.sort.each { |file| require file }
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.before(:suite) do
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
- begin
51
- require 'mongoid'
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
@@ -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')
data/test.sh CHANGED
@@ -1,4 +1,5 @@
1
1
  bundle && bundle exec rspec spec
2
- BUNDLE_GEMFILE=Gemfile.rails-3.1.4 bundle && bundle exec rspec spec
3
- BUNDLE_GEMFILE=Gemfile.rails-3.0.12 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
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
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.1.0
4
+ version: 4.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,19 +9,19 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-30 00:00:00.000000000 Z
12
+ date: 2012-09-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: uniform_notifier
16
- requirement: &70161212330380 !ruby/object:Gem::Requirement
16
+ requirement: &70294547787940 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.0.0
21
+ version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70161212330380
24
+ version_requirements: *70294547787940
25
25
  description: A rails plugin to kill N+1 queries and unused eager loading.
26
26
  email:
27
27
  - flyerhzm@gmail.com
@@ -35,13 +35,10 @@ files:
35
35
  - .rvmrc.example
36
36
  - .travis.yml
37
37
  - Gemfile
38
- - Gemfile.lock
39
38
  - Gemfile.rails-2.3.14
40
- - Gemfile.rails-2.3.14.lock
41
- - Gemfile.rails-3.0.12
42
- - Gemfile.rails-3.0.12.lock
43
- - Gemfile.rails-3.1.4
44
- - Gemfile.rails-3.1.4.lock
39
+ - Gemfile.rails-3.0.13
40
+ - Gemfile.rails-3.1.5
41
+ - Gemfile.rails-4-beta
45
42
  - Guardfile
46
43
  - Hacking.textile
47
44
  - MIT-LICENSE
@@ -54,6 +51,7 @@ files:
54
51
  - lib/bullet/active_record2.rb
55
52
  - lib/bullet/active_record3.rb
56
53
  - lib/bullet/active_record31.rb
54
+ - lib/bullet/dependency.rb
57
55
  - lib/bullet/detector.rb
58
56
  - lib/bullet/detector/association.rb
59
57
  - lib/bullet/detector/base.rb
@@ -118,6 +116,7 @@ files:
118
116
  - spec/models/mongoid/company.rb
119
117
  - spec/models/mongoid/entry.rb
120
118
  - spec/models/mongoid/post.rb
119
+ - spec/models/mongoid/user.rb
121
120
  - spec/models/newspaper.rb
122
121
  - spec/models/page.rb
123
122
  - spec/models/person.rb
@@ -135,7 +134,6 @@ files:
135
134
  - spec/support/rack_double.rb
136
135
  - spec/support/sqlite_seed.rb
137
136
  - tasks/bullet_tasks.rake
138
- - test.result
139
137
  - test.sh
140
138
  homepage: http://github.com/flyerhzm/bullet
141
139
  licenses: []
@@ -151,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
149
  version: '0'
152
150
  segments:
153
151
  - 0
154
- hash: 2670779275443337107
152
+ hash: -1372591245763188534
155
153
  required_rubygems_version: !ruby/object:Gem::Requirement
156
154
  none: false
157
155
  requirements:
@@ -205,6 +203,7 @@ test_files:
205
203
  - spec/models/mongoid/company.rb
206
204
  - spec/models/mongoid/entry.rb
207
205
  - spec/models/mongoid/post.rb
206
+ - spec/models/mongoid/user.rb
208
207
  - spec/models/newspaper.rb
209
208
  - spec/models/page.rb
210
209
  - spec/models/person.rb
data/Gemfile.lock DELETED
@@ -1,129 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- bullet (4.1.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
- builder (3.0.0)
42
- diff-lcs (1.1.3)
43
- erubis (2.7.0)
44
- ffi (1.0.11)
45
- guard (1.0.1)
46
- ffi (>= 0.5.0)
47
- thor (~> 0.14.6)
48
- guard-rspec (0.6.0)
49
- guard (>= 0.10.0)
50
- hike (1.2.1)
51
- i18n (0.6.0)
52
- journey (1.0.3)
53
- json (1.7.0)
54
- mail (2.4.4)
55
- i18n (>= 0.4.0)
56
- mime-types (~> 1.16)
57
- treetop (~> 1.4.8)
58
- mime-types (1.18)
59
- mongoid (3.0.0.rc)
60
- activemodel (~> 3.1)
61
- moped (~> 1.0.0.rc)
62
- origin (~> 1.0.0.rc)
63
- tzinfo (~> 0.3.22)
64
- moped (1.0.0.rc)
65
- multi_json (1.3.6)
66
- mysql (2.8.1)
67
- origin (1.0.0.rc)
68
- perftools.rb (2.0.0)
69
- polyglot (0.3.3)
70
- rack (1.4.1)
71
- rack-cache (1.2)
72
- rack (>= 0.4)
73
- rack-ssl (1.3.2)
74
- rack
75
- rack-test (0.6.1)
76
- rack (>= 1.0)
77
- rails (3.2.3)
78
- actionmailer (= 3.2.3)
79
- actionpack (= 3.2.3)
80
- activerecord (= 3.2.3)
81
- activeresource (= 3.2.3)
82
- activesupport (= 3.2.3)
83
- bundler (~> 1.0)
84
- railties (= 3.2.3)
85
- railties (3.2.3)
86
- actionpack (= 3.2.3)
87
- activesupport (= 3.2.3)
88
- rack-ssl (~> 1.3.2)
89
- rake (>= 0.8.7)
90
- rdoc (~> 3.4)
91
- thor (~> 0.14.6)
92
- rake (0.9.2.2)
93
- rdoc (3.12)
94
- json (~> 1.4)
95
- rspec (2.9.0)
96
- rspec-core (~> 2.9.0)
97
- rspec-expectations (~> 2.9.0)
98
- rspec-mocks (~> 2.9.0)
99
- rspec-core (2.9.0)
100
- rspec-expectations (2.9.0)
101
- diff-lcs (~> 1.1.3)
102
- rspec-mocks (2.9.0)
103
- sprockets (2.1.3)
104
- hike (~> 1.2)
105
- rack (~> 1.0)
106
- tilt (~> 1.1, != 1.3.0)
107
- sqlite3 (1.3.5)
108
- thor (0.14.6)
109
- tilt (1.3.3)
110
- treetop (1.4.10)
111
- polyglot
112
- polyglot (>= 0.3.1)
113
- tzinfo (0.3.33)
114
- uniform_notifier (1.0.2)
115
-
116
- PLATFORMS
117
- ruby
118
-
119
- DEPENDENCIES
120
- activerecord-import
121
- bullet!
122
- guard
123
- guard-rspec
124
- mongoid (= 3.0.0.rc)
125
- mysql
126
- perftools.rb
127
- rails (= 3.2.3)
128
- rspec
129
- sqlite3
@@ -1,65 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- bullet (4.1.0)
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
@@ -1,116 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- bullet (4.1.0)
5
- uniform_notifier (~> 1.0.0)
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- abstract (1.0.0)
11
- actionmailer (3.0.12)
12
- actionpack (= 3.0.12)
13
- mail (~> 2.2.19)
14
- actionpack (3.0.12)
15
- activemodel (= 3.0.12)
16
- activesupport (= 3.0.12)
17
- builder (~> 2.1.2)
18
- erubis (~> 2.6.6)
19
- i18n (~> 0.5.0)
20
- rack (~> 1.2.5)
21
- rack-mount (~> 0.6.14)
22
- rack-test (~> 0.5.7)
23
- tzinfo (~> 0.3.23)
24
- activemodel (3.0.12)
25
- activesupport (= 3.0.12)
26
- builder (~> 2.1.2)
27
- i18n (~> 0.5.0)
28
- activerecord (3.0.12)
29
- activemodel (= 3.0.12)
30
- activesupport (= 3.0.12)
31
- arel (~> 2.0.10)
32
- tzinfo (~> 0.3.23)
33
- activerecord-import (0.2.9)
34
- activerecord (~> 3.0)
35
- activerecord (~> 3.0)
36
- activeresource (3.0.12)
37
- activemodel (= 3.0.12)
38
- activesupport (= 3.0.12)
39
- activesupport (3.0.12)
40
- arel (2.0.10)
41
- bson (1.6.2)
42
- bson_ext (1.6.2)
43
- bson (~> 1.6.2)
44
- builder (2.1.2)
45
- diff-lcs (1.1.3)
46
- erubis (2.6.6)
47
- abstract (>= 1.0.0)
48
- ffi (1.0.11)
49
- guard (1.0.2)
50
- ffi (>= 0.5.0)
51
- thor (~> 0.14.6)
52
- guard-rspec (0.7.0)
53
- guard (>= 0.10.0)
54
- i18n (0.5.0)
55
- json (1.7.0)
56
- mail (2.2.19)
57
- activesupport (>= 2.3.6)
58
- i18n (>= 0.4.0)
59
- mime-types (~> 1.16)
60
- treetop (~> 1.4.8)
61
- mime-types (1.18)
62
- mysql (2.8.1)
63
- perftools.rb (2.0.0)
64
- polyglot (0.3.3)
65
- rack (1.2.5)
66
- rack-mount (0.6.14)
67
- rack (>= 1.0.0)
68
- rack-test (0.5.7)
69
- rack (>= 1.0)
70
- rails (3.0.12)
71
- actionmailer (= 3.0.12)
72
- actionpack (= 3.0.12)
73
- activerecord (= 3.0.12)
74
- activeresource (= 3.0.12)
75
- activesupport (= 3.0.12)
76
- bundler (~> 1.0)
77
- railties (= 3.0.12)
78
- railties (3.0.12)
79
- actionpack (= 3.0.12)
80
- activesupport (= 3.0.12)
81
- rake (>= 0.8.7)
82
- rdoc (~> 3.4)
83
- thor (~> 0.14.4)
84
- rake (0.9.2.2)
85
- rdoc (3.12)
86
- json (~> 1.4)
87
- rspec (2.10.0)
88
- rspec-core (~> 2.10.0)
89
- rspec-expectations (~> 2.10.0)
90
- rspec-mocks (~> 2.10.0)
91
- rspec-core (2.10.0)
92
- rspec-expectations (2.10.0)
93
- diff-lcs (~> 1.1.3)
94
- rspec-mocks (2.10.1)
95
- sqlite3 (1.3.6)
96
- thor (0.14.6)
97
- treetop (1.4.10)
98
- polyglot
99
- polyglot (>= 0.3.1)
100
- tzinfo (0.3.33)
101
- uniform_notifier (1.0.2)
102
-
103
- PLATFORMS
104
- ruby
105
-
106
- DEPENDENCIES
107
- activerecord-import
108
- bson_ext
109
- bullet!
110
- guard
111
- guard-rspec
112
- mysql
113
- perftools.rb
114
- rails (= 3.0.12)
115
- rspec
116
- sqlite3
@@ -1,134 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- bullet (4.1.0)
5
- uniform_notifier (~> 1.0.0)
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- actionmailer (3.1.4)
11
- actionpack (= 3.1.4)
12
- mail (~> 2.3.0)
13
- actionpack (3.1.4)
14
- activemodel (= 3.1.4)
15
- activesupport (= 3.1.4)
16
- builder (~> 3.0.0)
17
- erubis (~> 2.7.0)
18
- i18n (~> 0.6)
19
- rack (~> 1.3.6)
20
- rack-cache (~> 1.1)
21
- rack-mount (~> 0.8.2)
22
- rack-test (~> 0.6.1)
23
- sprockets (~> 2.0.3)
24
- activemodel (3.1.4)
25
- activesupport (= 3.1.4)
26
- builder (~> 3.0.0)
27
- i18n (~> 0.6)
28
- activerecord (3.1.4)
29
- activemodel (= 3.1.4)
30
- activesupport (= 3.1.4)
31
- arel (~> 2.2.3)
32
- tzinfo (~> 0.3.29)
33
- activerecord-import (0.2.9)
34
- activerecord (~> 3.0)
35
- activerecord (~> 3.0)
36
- activeresource (3.1.4)
37
- activemodel (= 3.1.4)
38
- activesupport (= 3.1.4)
39
- activesupport (3.1.4)
40
- multi_json (~> 1.0)
41
- arel (2.2.3)
42
- bson (1.6.2)
43
- bson_ext (1.6.2)
44
- bson (~> 1.6.2)
45
- builder (3.0.0)
46
- diff-lcs (1.1.3)
47
- erubis (2.7.0)
48
- ffi (1.0.11)
49
- guard (1.0.2)
50
- ffi (>= 0.5.0)
51
- thor (~> 0.14.6)
52
- guard-rspec (0.7.0)
53
- guard (>= 0.10.0)
54
- hike (1.2.1)
55
- i18n (0.6.0)
56
- json (1.7.1)
57
- mail (2.3.3)
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.10)
65
- activemodel (~> 3.1)
66
- mongo (~> 1.3)
67
- tzinfo (~> 0.3.22)
68
- multi_json (1.3.6)
69
- mysql (2.8.1)
70
- perftools.rb (2.0.0)
71
- polyglot (0.3.3)
72
- rack (1.3.6)
73
- rack-cache (1.2)
74
- rack (>= 0.4)
75
- rack-mount (0.8.3)
76
- rack (>= 1.0.0)
77
- rack-ssl (1.3.2)
78
- rack
79
- rack-test (0.6.1)
80
- rack (>= 1.0)
81
- rails (3.1.4)
82
- actionmailer (= 3.1.4)
83
- actionpack (= 3.1.4)
84
- activerecord (= 3.1.4)
85
- activeresource (= 3.1.4)
86
- activesupport (= 3.1.4)
87
- bundler (~> 1.0)
88
- railties (= 3.1.4)
89
- railties (3.1.4)
90
- actionpack (= 3.1.4)
91
- activesupport (= 3.1.4)
92
- rack-ssl (~> 1.3.2)
93
- rake (>= 0.8.7)
94
- rdoc (~> 3.4)
95
- thor (~> 0.14.6)
96
- rake (0.9.2.2)
97
- rdoc (3.12)
98
- json (~> 1.4)
99
- rspec (2.10.0)
100
- rspec-core (~> 2.10.0)
101
- rspec-expectations (~> 2.10.0)
102
- rspec-mocks (~> 2.10.0)
103
- rspec-core (2.10.0)
104
- rspec-expectations (2.10.0)
105
- diff-lcs (~> 1.1.3)
106
- rspec-mocks (2.10.1)
107
- sprockets (2.0.4)
108
- hike (~> 1.2)
109
- rack (~> 1.0)
110
- tilt (~> 1.1, != 1.3.0)
111
- sqlite3 (1.3.6)
112
- thor (0.14.6)
113
- tilt (1.3.3)
114
- treetop (1.4.10)
115
- polyglot
116
- polyglot (>= 0.3.1)
117
- tzinfo (0.3.33)
118
- uniform_notifier (1.0.2)
119
-
120
- PLATFORMS
121
- ruby
122
-
123
- DEPENDENCIES
124
- activerecord-import
125
- bson_ext
126
- bullet!
127
- guard
128
- guard-rspec
129
- mongoid (= 2.4.10)
130
- mysql
131
- perftools.rb
132
- rails (= 3.1.4)
133
- rspec
134
- sqlite3