Skip to content

Commit caa3992

Browse files
committed
Implement some features
1 parent 0bd2523 commit caa3992

8 files changed

+45
-9
lines changed

lib/speed_gun/app/views/report.slim

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ html
1313
= @report.id
1414
span.duration-ms= "% 4.1fms" % (@report.duration * 1000.0)
1515
.tabs
16-
a.tab-sources(href="#sources") Sources
1716
a.tab-events(href="#events") Events
17+
a.tab-sources(href="#sources") Sources
1818

1919
#details
20+
#events.active
21+
== partial('events', locals: { events: @events })
22+
2023
#sources
2124
#source-list
2225
- @report.sources.each do |source|
@@ -52,6 +55,3 @@ html
5255
- source.lines.each do |line|
5356
.line-code(id="line-code-#{line_id(source.file, line.line)}")= line.code
5457

55-
#events.active
56-
== partial('events', locals: { events: @events })
57-

lib/speed_gun/profiler/action_controller_profiler.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class SpeedGun::Profiler::ActionControllerProfiler < SpeedGun::Profiler::ActiveSupportNotificatiosProfiler
55
subscribe(
6-
%r{^(process_action|send_file|send_data|redirect_to)\.action_controller$},
6+
%r{\.action_controller$},
77
[:request]
88
)
99
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
require 'speed_gun/profiler/active_support_notifications_profiler'
3+
4+
class SpeedGun::Profiler::ActionMailerProfiler < SpeedGun::Profiler::ActiveSupportNotificatiosProfiler
5+
subscribe %r{\.action_mailer$}
6+
end
7+

lib/speed_gun/profiler/action_view_profiler.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
require 'speed_gun/profiler/active_support_notifications_profiler'
33

44
class SpeedGun::Profiler::ActionViewProfiler < SpeedGun::Profiler::ActiveSupportNotificatiosProfiler
5-
subscribe %r{^!(render_template|render_partial)\.action_view$}
5+
subscribe %r{\.action_view$}
66
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# frozen_string_literal: true
2+
require 'speed_gun/profiler/active_support_notifications_profiler'
3+
4+
class SpeedGun::Profiler::ActiveJobProfiler < SpeedGun::Profiler::ActiveSupportNotificatiosProfiler
5+
subscribe %r{\.active_job$}
6+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
require 'speed_gun/profiler/active_support_notifications_profiler'
3+
4+
class SpeedGun::Profiler::ActiveSupportProfiler < SpeedGun::Profiler::ActiveSupportNotificatiosProfiler
5+
subscribe %r{\.active_support$}
6+
end
7+
8+

lib/speed_gun/railtie.rb

+11
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ class SpeedGun::Railtie < ::Rails::Railtie
1111
SpeedGun.configure do |config|
1212
config.logger = Rails.logger
1313
config.store = SpeedGun::Store::FileStore.new(Rails.root.join('tmp/speed_gun').to_s)
14+
config.lineprof_paths.push(Rails.root.to_s)
1415
config.skip_paths.push(app.config.assets.prefix)
1516
end
1617

18+
require 'speed_gun/profiler/active_support_profiler'
19+
1720
ActiveSupport.on_load(:action_controller) do
1821
require 'speed_gun/profiler/action_controller_profiler'
1922
end
@@ -25,5 +28,13 @@ class SpeedGun::Railtie < ::Rails::Railtie
2528
ActiveSupport.on_load(:active_record) do
2629
require 'speed_gun/profiler/active_record_profiler'
2730
end
31+
32+
ActiveSupport.on_load(:action_mailer) do
33+
require 'speed_gun/profiler/action_mailer_profiler'
34+
end
35+
36+
ActiveSupport.on_load(:active_job) do
37+
require 'speed_gun/profiler/active_job_profiler'
38+
end
2839
end
2940
end

speed_gun.gemspec

+7-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ Gem::Specification.new do |spec|
2020
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
2121
spec.require_paths = ['lib']
2222

23-
spec.add_dependency 'semantic'
24-
spec.add_dependency 'rblineprof'
25-
spec.add_dependency 'rack'
2623
spec.add_dependency 'msgpack'
24+
spec.add_dependency 'rack'
25+
spec.add_dependency 'rblineprof'
26+
spec.add_dependency 'sass'
27+
spec.add_dependency 'semantic'
28+
spec.add_dependency 'sinatra'
29+
spec.add_dependency 'sinatra-partial'
30+
spec.add_dependency 'slim'
2731

2832
spec.add_development_dependency 'bundler', '~> 1.12'
2933
spec.add_development_dependency 'rake', '~> 11.0'

0 commit comments

Comments
 (0)