bullet 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,11 +16,11 @@ There is a large refactor from gem 1.4 to 1.5, so if you upgrade to 1.5 gem, ple
16
16
 
17
17
  ****************************************************************************
18
18
 
19
- h2. Thanks
19
+ h2. Contributors
20
20
 
21
- flipsasser added Growl, console.log and Rails.log support, very awesome. And he improved README.
22
- rainux add group style console.log.
23
- 2collegebums add some specs to generate red bar.
21
+ flipsasser added Growl, console.log and Rails.log support, very awesome. And he also improved README.
22
+ rainux added group style console.log.
23
+ 2collegebums added some great specs to generate red bar.
24
24
 
25
25
  ****************************************************************************
26
26
 
@@ -170,6 +170,14 @@ end
170
170
 
171
171
  ****************************************************************************
172
172
 
173
+ h2. Links
174
+
175
+ * "http://weblog.rubyonrails.org/2009/10/22/community-highlights":http://weblog.rubyonrails.org/2009/10/22/community-highlights
176
+ * "http://ruby5.envylabs.com/episodes/9-episode-8-september-8-2009":http://ruby5.envylabs.com/episodes/9-episode-8-september-8-2009
177
+ * "http://railslab.newrelic.com/2009/10/23/episode-19-on-the-edge-part-1":http://railslab.newrelic.com/2009/10/23/episode-19-on-the-edge-part-1
178
+
179
+ ****************************************************************************
180
+
173
181
  h2. Step by step example
174
182
 
175
183
  Bullet is designed to function as you browse through your application in development. It will alert you whenever it encounters N+1 queries or unused eager loading.
@@ -382,5 +390,7 @@ In the meanwhile, there's a log appended into <code>log/bullet.log</code> file.
382
390
  Post => [:comments]
383
391
  </code></pre>
384
392
 
393
+ ****************************************************************************
394
+
385
395
 
386
396
  Copyright (c) 2009 Richard Huang (flyerhzm@gmail.com), released under the MIT license
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.0
1
+ 1.7.1
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bullet}
8
- s.version = "1.7.0"
8
+ s.version = "1.7.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Richard Huang"]
12
- s.date = %q{2009-10-14}
12
+ s.date = %q{2009-11-13}
13
13
  s.description = %q{The Bullet plugin is designed to help you increase your application's performance by reducing the number of queries it makes. It will watch your queries while you develop your application and notify you when you should add eager loading (N+1 queries) or when you're using eager loading that isn't necessary.}
14
14
  s.email = %q{flyerhzm@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -30,8 +30,8 @@ Gem::Specification.new do |s|
30
30
  "lib/bullet/notification.rb",
31
31
  "lib/bulletware.rb",
32
32
  "rails/init.rb",
33
- "spec/bullet_association_spec.rb",
34
- "spec/bullet_counter_spec.rb",
33
+ "spec/bullet/association_spec.rb",
34
+ "spec/bullet/counter_spec.rb",
35
35
  "spec/spec.opts",
36
36
  "spec/spec_helper.rb",
37
37
  "tasks/bullet_tasks.rake"
@@ -42,9 +42,9 @@ Gem::Specification.new do |s|
42
42
  s.rubygems_version = %q{1.3.5}
43
43
  s.summary = %q{A plugin to kill N+1 queries and unused eager loading}
44
44
  s.test_files = [
45
- "spec/bullet_association_spec.rb",
46
- "spec/bullet_counter_spec.rb",
47
- "spec/spec_helper.rb"
45
+ "spec/spec_helper.rb",
46
+ "spec/bullet/counter_spec.rb",
47
+ "spec/bullet/association_spec.rb"
48
48
  ]
49
49
 
50
50
  if s.respond_to? :specification_version then
@@ -57,3 +57,4 @@ Gem::Specification.new do |s|
57
57
  else
58
58
  end
59
59
  end
60
+
@@ -11,7 +11,7 @@ class Bulletware
11
11
  return [status, headers, response] if empty?(response)
12
12
 
13
13
  if Bullet.notification?
14
- if check_html?(headers, response)
14
+ if !response.body.frozen? and check_html?(headers, response)
15
15
  response_body = response.body << Bullet.javascript_notification
16
16
  headers['Content-Length'] = response_body.length.to_s
17
17
  end
@@ -1,11 +1,9 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
4
4
 
5
5
  describe Bullet::Association, 'has_many' do
6
6
 
7
- include BulletTestHelper
8
-
9
7
  def setup_db
10
8
  ActiveRecord::Schema.define(:version => 1) do
11
9
  create_table :categories do |t|
@@ -86,7 +84,7 @@ describe Bullet::Association, 'has_many' do
86
84
  end
87
85
 
88
86
  before(:all) do
89
- silence_logger { setup_db }
87
+ setup_db
90
88
 
91
89
  newspaper1 = Newspaper.create(:name => "First Newspaper")
92
90
  newspaper2 = Newspaper.create(:name => "Second Newspaper")
@@ -481,7 +479,6 @@ end
481
479
 
482
480
  describe Bullet::Association, 'has_and_belongs_to_many' do
483
481
 
484
- include BulletTestHelper
485
482
  def setup_db
486
483
  ActiveRecord::Schema.define(:version => 1) do
487
484
  create_table :students do |t|
@@ -514,7 +511,7 @@ describe Bullet::Association, 'has_and_belongs_to_many' do
514
511
  end
515
512
 
516
513
  before(:all) do
517
- silence_logger { setup_db }
514
+ setup_db
518
515
  student1 = Student.create(:name => 'first')
519
516
  student2 = Student.create(:name => 'second')
520
517
  teacher1 = Teacher.create(:name => 'first')
@@ -566,8 +563,6 @@ end
566
563
 
567
564
  describe Bullet::Association, 'has_many :through' do
568
565
 
569
- include BulletTestHelper
570
-
571
566
  def setup_db
572
567
  ActiveRecord::Schema.define(:version => 1) do
573
568
  create_table :firms do |t|
@@ -607,7 +602,7 @@ describe Bullet::Association, 'has_many :through' do
607
602
  end
608
603
 
609
604
  before(:all) do
610
- silence_logger { setup_db }
605
+ setup_db
611
606
  firm1 = Firm.create(:name => 'first')
612
607
  firm2 = Firm.create(:name => 'second')
613
608
  client1 = Client.create(:name => 'first')
@@ -659,8 +654,6 @@ end
659
654
 
660
655
  describe Bullet::Association, 'has_many :as' do
661
656
 
662
- include BulletTestHelper
663
-
664
657
  def setup_db
665
658
  ActiveRecord::Schema.define(:version => 1) do
666
659
  create_table :votes do |t|
@@ -707,7 +700,7 @@ describe Bullet::Association, 'has_many :as' do
707
700
  end
708
701
 
709
702
  before(:all) do
710
- silence_logger { setup_db }
703
+ setup_db
711
704
  user1 = User.create(:name => 'first')
712
705
  user2 = User.create(:name => 'second')
713
706
  user3 = User.create(:name => 'third')
@@ -813,8 +806,6 @@ end
813
806
 
814
807
  describe Bullet::Association, "has_one" do
815
808
 
816
- include BulletTestHelper
817
-
818
809
  def setup_db
819
810
  ActiveRecord::Schema.define(:version => 1) do
820
811
  create_table :companies do |t|
@@ -843,7 +834,7 @@ describe Bullet::Association, "has_one" do
843
834
  end
844
835
 
845
836
  before(:all) do
846
- silence_logger { setup_db }
837
+ setup_db
847
838
 
848
839
  company1 = Company.create(:name => 'first')
849
840
  company2 = Company.create(:name => 'second')
@@ -892,7 +883,7 @@ describe Bullet::Association, "has_one" do
892
883
  end
893
884
 
894
885
  describe Bullet::Association, "call one association that in possible objects" do
895
- include BulletTestHelper
886
+
896
887
  def setup_db
897
888
  ActiveRecord::Schema.define(:version => 1) do
898
889
  create_table :contacts do |t|
@@ -921,7 +912,7 @@ describe Bullet::Association, "call one association that in possible objects" do
921
912
  end
922
913
 
923
914
  before(:all) do
924
- silence_logger { setup_db }
915
+ setup_db
925
916
 
926
917
  contact1 = Contact.create(:name => 'first')
927
918
  contact2 = Contact.create(:name => 'second')
@@ -952,7 +943,7 @@ describe Bullet::Association, "call one association that in possible objects" do
952
943
  end
953
944
 
954
945
  describe Bullet::Association, "STI" do
955
- include BulletTestHelper
946
+
956
947
  def setup_db
957
948
  ActiveRecord::Schema.define(:version => 1) do
958
949
  create_table :documents do |t|
@@ -991,7 +982,7 @@ describe Bullet::Association, "STI" do
991
982
  end
992
983
 
993
984
  before(:all) do
994
- silence_logger { setup_db }
985
+ setup_db
995
986
  author1 = Author.create(:name => 'author1')
996
987
  author2 = Author.create(:name => 'author2')
997
988
  folder1 = Folder.create(:name => 'folder1', :author_id => author1.id)
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
4
4
 
@@ -10,24 +10,11 @@ module Rails
10
10
  end
11
11
 
12
12
  RAILS_ROOT = File.expand_path(__FILE__).split('/')[0..-3].join('/') unless defined? RAILS_ROOT
13
- require File.expand_path(File.join(File.dirname(__FILE__), '../lib/bullet/notification'))
14
- require File.expand_path(File.join(File.dirname(__FILE__), '../lib/bullet/logger'))
15
- require File.expand_path(File.join(File.dirname(__FILE__), '../lib/bullet/active_record'))
16
- require File.expand_path(File.join(File.dirname(__FILE__), '../lib/bullet/action_controller'))
17
- require File.expand_path(File.join(File.dirname(__FILE__), '../lib/bullet/association'))
18
- require File.expand_path(File.join(File.dirname(__FILE__), '../lib/bullet/counter'))
19
- require File.expand_path(File.join(File.dirname(__FILE__), '../lib/bullet'))
20
- require File.expand_path(File.join(File.dirname(__FILE__), '../lib/bulletware'))
21
- Bullet.enable = true
22
13
 
23
- module BulletTestHelper
24
- def silence_logger(&block)
25
- orig_stdout = $stdout
26
- $stdout = StringIO.new
27
- block.call
28
- $stdout = orig_stdout
29
- end
30
- end
14
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
15
+ require 'bullet'
16
+ Bullet.enable = true
17
+ ActiveRecord::Migration.verbose = false
31
18
 
32
19
  module Bullet
33
20
  class Association
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: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-14 00:00:00 +08:00
12
+ date: 2009-11-13 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -36,8 +36,8 @@ files:
36
36
  - lib/bullet/notification.rb
37
37
  - lib/bulletware.rb
38
38
  - rails/init.rb
39
- - spec/bullet_association_spec.rb
40
- - spec/bullet_counter_spec.rb
39
+ - spec/bullet/association_spec.rb
40
+ - spec/bullet/counter_spec.rb
41
41
  - spec/spec.opts
42
42
  - spec/spec_helper.rb
43
43
  - tasks/bullet_tasks.rake
@@ -70,6 +70,6 @@ signing_key:
70
70
  specification_version: 3
71
71
  summary: A plugin to kill N+1 queries and unused eager loading
72
72
  test_files:
73
- - spec/bullet_association_spec.rb
74
- - spec/bullet_counter_spec.rb
75
73
  - spec/spec_helper.rb
74
+ - spec/bullet/counter_spec.rb
75
+ - spec/bullet/association_spec.rb