brakefast 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +48 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +21 -0
- data/Guardfile +8 -0
- data/Hacking.md +74 -0
- data/MIT-LICENSE +20 -0
- data/README.md +451 -0
- data/Rakefile +6 -0
- data/brakefast.gemspec +30 -0
- data/lib/brakefast/brakeman.rb +18 -0
- data/lib/brakefast/dependency.rb +7 -0
- data/lib/brakefast/detector/base.rb +58 -0
- data/lib/brakefast/detector/controller_warnings.rb +32 -0
- data/lib/brakefast/detector/generic_warnings.rb +27 -0
- data/lib/brakefast/detector/model_warnings.rb +26 -0
- data/lib/brakefast/detector.rb +8 -0
- data/lib/brakefast/notification/base.rb +61 -0
- data/lib/brakefast/notification/controller_warnings.rb +14 -0
- data/lib/brakefast/notification/generic_warnings.rb +14 -0
- data/lib/brakefast/notification/model_warnings.rb +14 -0
- data/lib/brakefast/notification.rb +10 -0
- data/lib/brakefast/notification_collector.rb +24 -0
- data/lib/brakefast/rack.rb +95 -0
- data/lib/brakefast/version.rb +4 -0
- data/lib/brakefast.rb +178 -0
- data/perf/benchmark.rb +121 -0
- data/rails/init.rb +1 -0
- data/tasks/bullet_tasks.rake +9 -0
- data/test.sh +17 -0
- data/update.sh +15 -0
- metadata +146 -0
data/perf/benchmark.rb
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
$: << 'lib'
|
2
|
+
require 'benchmark'
|
3
|
+
require 'rails'
|
4
|
+
require 'active_record'
|
5
|
+
require 'activerecord-import'
|
6
|
+
require 'bullet'
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'perftools'
|
10
|
+
rescue LoadError
|
11
|
+
puts "Could not load perftools.rb, profiling won't be possible"
|
12
|
+
end
|
13
|
+
|
14
|
+
class Post < ActiveRecord::Base
|
15
|
+
belongs_to :user
|
16
|
+
has_many :comments
|
17
|
+
end
|
18
|
+
|
19
|
+
class Comment < ActiveRecord::Base
|
20
|
+
belongs_to :user
|
21
|
+
belongs_to :post
|
22
|
+
end
|
23
|
+
|
24
|
+
class User < ActiveRecord::Base
|
25
|
+
has_many :posts
|
26
|
+
has_many :comments
|
27
|
+
end
|
28
|
+
|
29
|
+
# create database bullet_benchmark;
|
30
|
+
ActiveRecord::Base.establish_connection(:adapter => 'mysql2', :database => 'bullet_benchmark', :server => '/tmp/mysql.socket', :username => 'root')
|
31
|
+
|
32
|
+
ActiveRecord::Base.connection.tables.each do |table|
|
33
|
+
ActiveRecord::Base.connection.drop_table(table)
|
34
|
+
end
|
35
|
+
|
36
|
+
ActiveRecord::Schema.define(:version => 1) do
|
37
|
+
create_table :posts do |t|
|
38
|
+
t.column :title, :string
|
39
|
+
t.column :body, :string
|
40
|
+
t.column :user_id, :integer
|
41
|
+
end
|
42
|
+
|
43
|
+
create_table :comments do |t|
|
44
|
+
t.column :body, :string
|
45
|
+
t.column :post_id, :integer
|
46
|
+
t.column :user_id, :integer
|
47
|
+
end
|
48
|
+
|
49
|
+
create_table :users do |t|
|
50
|
+
t.column :name, :string
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
users_size = 100
|
55
|
+
posts_size = 1000
|
56
|
+
comments_size = 10000
|
57
|
+
users = []
|
58
|
+
users_size.times do |i|
|
59
|
+
users << User.new(:name => "user#{i}")
|
60
|
+
end
|
61
|
+
User.import users
|
62
|
+
users = User.all
|
63
|
+
|
64
|
+
posts = []
|
65
|
+
posts_size.times do |i|
|
66
|
+
posts << Post.new(:title => "Title #{i}", :body => "Body #{i}", :user => users[i%100])
|
67
|
+
end
|
68
|
+
Post.import posts
|
69
|
+
posts = Post.all
|
70
|
+
|
71
|
+
comments = []
|
72
|
+
comments_size.times do |i|
|
73
|
+
comments << Comment.new(:body => "Comment #{i}", :post => posts[i%1000], :user => users[i%100])
|
74
|
+
end
|
75
|
+
Comment.import comments
|
76
|
+
|
77
|
+
puts "Start benchmarking..."
|
78
|
+
|
79
|
+
|
80
|
+
Bullet.enable = true
|
81
|
+
|
82
|
+
Benchmark.bm(70) do |bm|
|
83
|
+
bm.report("Querying & Iterating #{posts_size} Posts with #{comments_size} Comments and #{users_size} Users") do
|
84
|
+
10.times do
|
85
|
+
Bullet.start_request
|
86
|
+
Post.select("SQL_NO_CACHE *").includes(:user, :comments => :user).each do |p|
|
87
|
+
p.title
|
88
|
+
p.user.name
|
89
|
+
p.comments.each do |c|
|
90
|
+
c.body
|
91
|
+
c.user.name
|
92
|
+
end
|
93
|
+
end
|
94
|
+
Bullet.end_request
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
puts "End benchmarking..."
|
100
|
+
|
101
|
+
|
102
|
+
# Run benchmark with bundler
|
103
|
+
#
|
104
|
+
# bundle exec ruby perf/benchmark.rb
|
105
|
+
#
|
106
|
+
# bullet 2.3.0 with rails 3.2.2
|
107
|
+
# user system total real
|
108
|
+
# Querying & Iterating 1000 Posts with 10000 Comments and 100 Users 16.460000 0.190000 16.650000 ( 16.968246)
|
109
|
+
#
|
110
|
+
# bullet 2.3.0 with rails 3.1.4
|
111
|
+
# user system total real
|
112
|
+
# Querying & Iterating 1000 Posts with 10000 Comments and 100 Users 14.600000 0.130000 14.730000 ( 14.937590)
|
113
|
+
#
|
114
|
+
# bullet 2.3.0 with rails 3.0.12
|
115
|
+
# user system total real
|
116
|
+
# Querying & Iterating 1000 Posts with 10000 Comments and 100 Users 26.120000 0.430000 26.550000 ( 27.179304)
|
117
|
+
#
|
118
|
+
#
|
119
|
+
# bullet 2.2.1 with rails 3.0.12
|
120
|
+
# user system total real
|
121
|
+
# Querying & Iterating 1000 Posts with 10000 Comments and 100 Users 29.970000 0.270000 30.240000 ( 30.452083)
|
data/rails/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bullet'
|
data/test.sh
ADDED
@@ -0,0 +1,17 @@
|
|
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.2 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.2 bundle exec rspec spec
|
4
|
+
BUNDLE_GEMFILE=Gemfile.rails-4.1 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.1 bundle exec rspec spec
|
5
|
+
BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle exec rspec spec
|
6
|
+
BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle exec rspec spec
|
7
|
+
BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle exec rspec spec
|
8
|
+
BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle exec rspec spec
|
9
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle exec rspec spec
|
10
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle exec rspec spec
|
11
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle exec rspec spec
|
12
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle exec rspec spec
|
13
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.8 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.8 bundle exec rspec spec
|
14
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.7 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.7 bundle exec rspec spec
|
15
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.6 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.6 bundle exec rspec spec
|
16
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.5 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.5 bundle exec rspec spec
|
17
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.4 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-2.4 bundle exec rspec spec
|
data/update.sh
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
BUNDLE_GEMFILE=Gemfile.rails-4.2 bundle update
|
2
|
+
BUNDLE_GEMFILE=Gemfile.rails-4.1 bundle update
|
3
|
+
BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle update
|
4
|
+
BUNDLE_GEMFILE=Gemfile.rails-3.2 bundle update
|
5
|
+
BUNDLE_GEMFILE=Gemfile.rails-3.1 bundle update
|
6
|
+
BUNDLE_GEMFILE=Gemfile.rails-3.0 bundle update
|
7
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle update
|
8
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle update
|
9
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-3.1 bundle update
|
10
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-3.0 bundle update
|
11
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.8 bundle update
|
12
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.7 bundle update
|
13
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.6 bundle update
|
14
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.5 bundle update
|
15
|
+
BUNDLE_GEMFILE=Gemfile.mongoid-2.4 bundle update
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: brakefast
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sho Hashimoto
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: uniform_notifier
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.9.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.9.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: brakeman
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.9'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.9'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: runtime brakeman notifier like bullet
|
84
|
+
email:
|
85
|
+
- sho.hsmt@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
93
|
+
- CHANGELOG.md
|
94
|
+
- Gemfile
|
95
|
+
- Guardfile
|
96
|
+
- Hacking.md
|
97
|
+
- MIT-LICENSE
|
98
|
+
- README.md
|
99
|
+
- Rakefile
|
100
|
+
- brakefast.gemspec
|
101
|
+
- lib/brakefast.rb
|
102
|
+
- lib/brakefast/brakeman.rb
|
103
|
+
- lib/brakefast/dependency.rb
|
104
|
+
- lib/brakefast/detector.rb
|
105
|
+
- lib/brakefast/detector/base.rb
|
106
|
+
- lib/brakefast/detector/controller_warnings.rb
|
107
|
+
- lib/brakefast/detector/generic_warnings.rb
|
108
|
+
- lib/brakefast/detector/model_warnings.rb
|
109
|
+
- lib/brakefast/notification.rb
|
110
|
+
- lib/brakefast/notification/base.rb
|
111
|
+
- lib/brakefast/notification/controller_warnings.rb
|
112
|
+
- lib/brakefast/notification/generic_warnings.rb
|
113
|
+
- lib/brakefast/notification/model_warnings.rb
|
114
|
+
- lib/brakefast/notification_collector.rb
|
115
|
+
- lib/brakefast/rack.rb
|
116
|
+
- lib/brakefast/version.rb
|
117
|
+
- perf/benchmark.rb
|
118
|
+
- rails/init.rb
|
119
|
+
- tasks/bullet_tasks.rake
|
120
|
+
- test.sh
|
121
|
+
- update.sh
|
122
|
+
homepage: https://github.com/sho-h/brakefast
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.2.3
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: runtime brakeman notifier like bullet
|
146
|
+
test_files: []
|