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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b5ea4acbaf4d5efec150414455d875c5503fca4
4
- data.tar.gz: 536e12f73b856176c7c30ef90e208f7612348d89
3
+ metadata.gz: 943d309dfe7e69d839ea284e6c9d525e61e5411e
4
+ data.tar.gz: bdf30a92d384c74ab69e5d5c19ca853135100d77
5
5
  SHA512:
6
- metadata.gz: 5cff4678b233ae68fd4d1c92b2549bdcd78c9771d47970330fce8067543dd2894313e985310aeda89e07d28b53b708182714fd4ee3ac45d5126da0cf99c93e6f
7
- data.tar.gz: 84d598d7329983f0d92931e05c2306df30ee02ff580e6d8f1cd5c7a633cbf542a3acf353ca9bb87cf67259ccb8bf838ef18b01e7ba1b4387f63f3426a03a9c75
6
+ metadata.gz: db02f40f91da2a44a6e0d001d24e5d12946499a1e152a20068e252ff551c57627196648ee3b101fa4d746a0752e431497658c74610b37fb36b8e4e4061c4e71a
7
+ data.tar.gz: 5ca22681b6b47bdb4b0e1d5929a9199e7b4b8974d144a9d318b737e6c5988929d11aeff8dd06f890f7975093c63c3eeb8c8ebbc799121aca290f713306eb0f03
@@ -127,4 +127,9 @@
127
127
  * 1.25
128
128
  * Missed flamegraph.html from build
129
129
 
130
+ 11-April-2013
131
+ * 1.26
132
+ * (minor) allow Rack::MiniProfilerRails.initialize!(Rails.application), for post config intialization
133
+
134
+
130
135
 
@@ -1,61 +1,65 @@
1
1
  require 'fileutils'
2
2
 
3
- module MiniProfilerRails
3
+ module Rack::MiniProfilerRails
4
4
 
5
- class Railtie < ::Rails::Railtie
5
+ # call direct if needed to do a defer init
6
+ def self.initialize!(app)
7
+ c = Rack::MiniProfiler.config
6
8
 
7
- initializer "rack_mini_profiler.configure_rails_initialization" do |app|
8
- c = Rack::MiniProfiler.config
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
- # By default, only show the MiniProfiler in development mode, in production allow profiling if post_authorize_cb is set
11
- c.pre_authorize_cb = lambda { |env|
12
- !Rails.env.test?
13
- }
14
+ c.skip_paths ||= []
14
15
 
15
- c.skip_paths ||= []
16
+ if Rails.env.development?
17
+ c.skip_paths << "/assets/"
18
+ c.skip_schema_queries = true
19
+ end
16
20
 
17
- if Rails.env.development?
18
- c.skip_paths << "/assets/"
19
- c.skip_schema_queries = true
20
- end
21
+ if Rails.env.production?
22
+ c.authorization_mode = :whitelist
23
+ end
21
24
 
22
- if Rails.env.production?
23
- c.authorization_mode = :whitelist
24
- end
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
- # The file store is just so much less flaky
27
- tmp = Rails.root.to_s + "/tmp/miniprofiler"
28
- FileUtils.mkdir_p(tmp) unless File.exists?(tmp)
29
+ c.storage_options = {:path => tmp}
30
+ c.storage = Rack::MiniProfiler::FileStore
29
31
 
30
- c.storage_options = {:path => tmp}
31
- c.storage = Rack::MiniProfiler::FileStore
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
- # Quiet the SQL stack traces
34
- c.backtrace_remove = Rails.root.to_s + "/"
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
- # Install the Middleware
39
- app.middleware.insert(0, Rack::MiniProfiler)
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
- # Attach to various Rails methods
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "rack-mini-profiler"
3
- s.version = "0.1.25"
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.25
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-07 00:00:00.000000000 Z
13
+ date: 2013-04-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack