mini-mini-profiler 0.1 → 0.1.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.
data/Ruby/lib/html/includes.js
CHANGED
@@ -36,35 +36,38 @@ module Rack::MiniProfilerRails
|
|
36
36
|
|
37
37
|
# Install the Middleware
|
38
38
|
app.middleware.insert(0, Rack::MiniProfiler)
|
39
|
+
end
|
40
|
+
|
41
|
+
class Railtie < ::Rails::Railtie
|
42
|
+
|
43
|
+
initializer "rack_mini_profiler.configure_rails_initialization" do |app|
|
44
|
+
Rack::MiniProfilerRails.initialize!(app)
|
45
|
+
end
|
39
46
|
|
40
|
-
|
41
|
-
|
42
|
-
|
47
|
+
config.after_initialize do
|
48
|
+
# Attach to various Rails methods
|
49
|
+
::Rack::MiniProfiler.profile_method(ActionController::Base, :process) {|action| "Controller: #{self.class.name} Action: #{action}"}
|
50
|
+
::Rack::MiniProfiler.profile_method(ActionView::Template, :render) {|x,y| "View: #{@virtual_path}"}
|
43
51
|
|
44
|
-
|
45
|
-
|
52
|
+
# preload all model classes
|
53
|
+
Dir.glob("#{Rails.root}/app/models/**/*.rb").map{|file| file.match(/([^\/]+).rb/)[1].camelize.constantize}
|
46
54
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
55
|
+
ActiveRecord::Base.subclasses.each do |model_class|
|
56
|
+
(model_class.instance_methods - ActiveRecord::Base.instance_methods + [:save, :update_attributes, :initialize]).each do |method|
|
57
|
+
# ::Rack::MiniProfiler.profile_method(model_class, method){ |*args| "Model: #{self.class.name} Method: #{method}" }
|
58
|
+
unless method.to_s =~ /^_.*/
|
59
|
+
::Rack::MiniProfiler.profile_method(model_class, method){ |*args| "Model: #{ self.class.name } Method: #{ method }" }
|
60
|
+
end
|
52
61
|
end
|
53
|
-
end
|
54
62
|
|
55
|
-
|
56
|
-
|
57
|
-
|
63
|
+
((model_class.public_methods - ActiveRecord::Base.public_methods) + [:find, :where, :order, :all]).each do |method|
|
64
|
+
unless method.to_s =~ /^_.*/
|
65
|
+
::Rack::MiniProfiler.profile_method(model_class, method, true){ |*args| "Model: #{ self.name } Method: #{ method }" }
|
66
|
+
end
|
58
67
|
end
|
59
68
|
end
|
60
69
|
end
|
61
|
-
end
|
62
|
-
|
63
|
-
class Railtie < ::Rails::Railtie
|
64
70
|
|
65
|
-
initializer "rack_mini_profiler.configure_rails_initialization" do |app|
|
66
|
-
Rack::MiniProfilerRails.initialize!(app)
|
67
|
-
end
|
68
71
|
|
69
72
|
# TODO: Implement something better here
|
70
73
|
# config.after_initialize do
|
data/mini-mini-profiler.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "mini-mini-profiler"
|
3
|
-
s.version = "0.1"
|
3
|
+
s.version = "0.1.1"
|
4
4
|
s.summary = "Simple Profiler for learning about Rails Development"
|
5
5
|
s.authors = ["Aubrey Rhodes"]
|
6
6
|
s.description = "Simple Profiler for learning about Rails Development"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini-mini-profiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -135,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
segments:
|
137
137
|
- 0
|
138
|
-
hash:
|
138
|
+
hash: -724534221415535854
|
139
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
140
|
none: false
|
141
141
|
requirements:
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
segments:
|
146
146
|
- 0
|
147
|
-
hash:
|
147
|
+
hash: -724534221415535854
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
150
|
rubygems_version: 1.8.25
|