rack-mini-profiler 0.1.25 → 0.1.26
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.
- checksums.yaml +4 -4
- data/Ruby/CHANGELOG +5 -0
- data/Ruby/lib/mini_profiler_rails/railtie.rb +44 -40
- data/rack-mini-profiler.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 943d309dfe7e69d839ea284e6c9d525e61e5411e
|
|
4
|
+
data.tar.gz: bdf30a92d384c74ab69e5d5c19ca853135100d77
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: db02f40f91da2a44a6e0d001d24e5d12946499a1e152a20068e252ff551c57627196648ee3b101fa4d746a0752e431497658c74610b37fb36b8e4e4061c4e71a
|
|
7
|
+
data.tar.gz: 5ca22681b6b47bdb4b0e1d5929a9199e7b4b8974d144a9d318b737e6c5988929d11aeff8dd06f890f7975093c63c3eeb8c8ebbc799121aca290f713306eb0f03
|
data/Ruby/CHANGELOG
CHANGED
|
@@ -1,61 +1,65 @@
|
|
|
1
1
|
require 'fileutils'
|
|
2
2
|
|
|
3
|
-
module MiniProfilerRails
|
|
3
|
+
module Rack::MiniProfilerRails
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# call direct if needed to do a defer init
|
|
6
|
+
def self.initialize!(app)
|
|
7
|
+
c = Rack::MiniProfiler.config
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
# By default, only show the MiniProfiler in development mode, in production allow profiling if post_authorize_cb is set
|
|
10
|
+
c.pre_authorize_cb = lambda { |env|
|
|
11
|
+
!Rails.env.test?
|
|
12
|
+
}
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
c.pre_authorize_cb = lambda { |env|
|
|
12
|
-
!Rails.env.test?
|
|
13
|
-
}
|
|
14
|
+
c.skip_paths ||= []
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
if Rails.env.development?
|
|
17
|
+
c.skip_paths << "/assets/"
|
|
18
|
+
c.skip_schema_queries = true
|
|
19
|
+
end
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
end
|
|
21
|
+
if Rails.env.production?
|
|
22
|
+
c.authorization_mode = :whitelist
|
|
23
|
+
end
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
# The file store is just so much less flaky
|
|
26
|
+
tmp = Rails.root.to_s + "/tmp/miniprofiler"
|
|
27
|
+
FileUtils.mkdir_p(tmp) unless File.exists?(tmp)
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
FileUtils.mkdir_p(tmp) unless File.exists?(tmp)
|
|
29
|
+
c.storage_options = {:path => tmp}
|
|
30
|
+
c.storage = Rack::MiniProfiler::FileStore
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
# Quiet the SQL stack traces
|
|
33
|
+
c.backtrace_remove = Rails.root.to_s + "/"
|
|
34
|
+
c.backtrace_includes = [/^\/?(app|config|lib|test)/]
|
|
35
|
+
c.skip_schema_queries = Rails.env != 'production'
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
c.backtrace_includes = [/^\/?(app|config|lib|test)/]
|
|
36
|
-
c.skip_schema_queries = Rails.env != 'production'
|
|
37
|
+
# Install the Middleware
|
|
38
|
+
app.middleware.insert(0, Rack::MiniProfiler)
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
# Attach to various Rails methods
|
|
41
|
+
::Rack::MiniProfiler.profile_method(ActionController::Base, :process) {|action| "Executing action: #{action}"}
|
|
42
|
+
::Rack::MiniProfiler.profile_method(ActionView::Template, :render) {|x,y| "Rendering: #{@virtual_path}"}
|
|
43
|
+
end
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
::Rack::MiniProfiler.profile_method(ActionController::Base, :process) {|action| "Executing action: #{action}"}
|
|
43
|
-
::Rack::MiniProfiler.profile_method(ActionView::Template, :render) {|x,y| "Rendering: #{@virtual_path}"}
|
|
45
|
+
class Railtie < ::Rails::Railtie
|
|
44
46
|
|
|
47
|
+
initializer "rack_mini_profiler.configure_rails_initialization" do |app|
|
|
48
|
+
Rack::MiniProfilerRails.initialize!(app)
|
|
45
49
|
end
|
|
46
50
|
|
|
47
51
|
# TODO: Implement something better here
|
|
48
|
-
# config.after_initialize do
|
|
49
|
-
#
|
|
50
|
-
# class ::ActionView::Helpers::AssetTagHelper::JavascriptIncludeTag
|
|
52
|
+
# config.after_initialize do
|
|
53
|
+
#
|
|
54
|
+
# class ::ActionView::Helpers::AssetTagHelper::JavascriptIncludeTag
|
|
51
55
|
# alias_method :asset_tag_orig, :asset_tag
|
|
52
56
|
# def asset_tag(source,options)
|
|
53
|
-
# current = Rack::MiniProfiler.current
|
|
54
|
-
# return asset_tag_orig(source,options) unless current
|
|
57
|
+
# current = Rack::MiniProfiler.current
|
|
58
|
+
# return asset_tag_orig(source,options) unless current
|
|
55
59
|
# wrapped = ""
|
|
56
60
|
# unless current.mpt_init
|
|
57
61
|
# current.mpt_init = true
|
|
58
|
-
# wrapped << Rack::MiniProfiler::ClientTimerStruct.init_instrumentation
|
|
62
|
+
# wrapped << Rack::MiniProfiler::ClientTimerStruct.init_instrumentation
|
|
59
63
|
# end
|
|
60
64
|
# name = source.split('/')[-1]
|
|
61
65
|
# wrapped << Rack::MiniProfiler::ClientTimerStruct.instrument(name, asset_tag_orig(source,options)).html_safe
|
|
@@ -63,15 +67,15 @@ module MiniProfilerRails
|
|
|
63
67
|
# end
|
|
64
68
|
# end
|
|
65
69
|
|
|
66
|
-
# class ::ActionView::Helpers::AssetTagHelper::StylesheetIncludeTag
|
|
70
|
+
# class ::ActionView::Helpers::AssetTagHelper::StylesheetIncludeTag
|
|
67
71
|
# alias_method :asset_tag_orig, :asset_tag
|
|
68
72
|
# def asset_tag(source,options)
|
|
69
|
-
# current = Rack::MiniProfiler.current
|
|
70
|
-
# return asset_tag_orig(source,options) unless current
|
|
73
|
+
# current = Rack::MiniProfiler.current
|
|
74
|
+
# return asset_tag_orig(source,options) unless current
|
|
71
75
|
# wrapped = ""
|
|
72
76
|
# unless current.mpt_init
|
|
73
77
|
# current.mpt_init = true
|
|
74
|
-
# wrapped << Rack::MiniProfiler::ClientTimerStruct.init_instrumentation
|
|
78
|
+
# wrapped << Rack::MiniProfiler::ClientTimerStruct.init_instrumentation
|
|
75
79
|
# end
|
|
76
80
|
# name = source.split('/')[-1]
|
|
77
81
|
# wrapped << Rack::MiniProfiler::ClientTimerStruct.instrument(name, asset_tag_orig(source,options)).html_safe
|
data/rack-mini-profiler.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "rack-mini-profiler"
|
|
3
|
-
s.version = "0.1.
|
|
3
|
+
s.version = "0.1.26"
|
|
4
4
|
s.summary = "Profiles loading speed for rack applications."
|
|
5
5
|
s.authors = ["Sam Saffron", "Robin Ward","Aleks Totic"]
|
|
6
6
|
s.description = "Profiling toolkit for Rack applications with Rails integration. Client Side profiling, DB profiling and Server profiling."
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rack-mini-profiler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.26
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sam Saffron
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2013-04-
|
|
13
|
+
date: 2013-04-11 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rack
|