rack-insight 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -90,6 +90,7 @@ Specify the set of panels you want, in the order you want them to appear:
90
90
  request_variables_panel
91
91
  redis_panel
92
92
  templates_panel
93
+ cache_panel
93
94
  log_panel
94
95
  memory_panel
95
96
  ]
@@ -99,7 +100,7 @@ Subclasses of Rack::Insight::Panel are loaded and added to the toolbar. This ma
99
100
  it easier to work with the configuration and extend Rack::Insight with plugin gems.
100
101
 
101
102
  If you need to customize the load paths where Rack::Insight will look for panels you can configure the load paths in an
102
- initializer. Example config/initializers/rack_insight.rb:
103
+ initializer, or in your gem prior to requiring your panels. Example config/initializers/rack_insight.rb:
103
104
 
104
105
  Rack::Insight::Config.configure do |config|
105
106
 
@@ -114,6 +115,12 @@ initializer. Example config/initializers/rack_insight.rb:
114
115
 
115
116
  end
116
117
 
118
+ When you create custom panels use the render_template method and pass it the path to the view to be rendered
119
+ *relative to the panel load path you added above*:
120
+
121
+ # with Example #2 from above, will try to render 'custom/panels/thunder_panel/views/thor.html.erb'
122
+ render_template 'thunder_panel/views/thor'
123
+
117
124
  Running Rack::Insight in staging or production
118
125
  ------------------------------------------
119
126
 
@@ -153,9 +160,10 @@ location (i.e. Heroku), you can pass a custom file path.
153
160
  Authors
154
161
  -------
155
162
 
156
- - Maintained by [Judson Lester](mailto:judson@lrdesign.com)
157
- - Contributions from Luke Melia, Joey Aghion, Tim Connor, and more
158
- - Based on Rack::Bug by Bryan Helmkamp
163
+ - Maintained by [Peter Boling](mailto:peter.boling@gmail.com)
164
+ - Based on LogicalInsight by Judson Lester
165
+ - Contributions from Luke Melia, Joey Aghion, Tim Connor, and more
166
+ - Which in turn was based on Rack::Bug by Bryan Helmkamp
159
167
 
160
168
  Thanks
161
169
  ------
@@ -169,21 +177,21 @@ and Rack::Cache
169
177
  License
170
178
  -------
171
179
 
172
- See LICENSE.txt in this directory.
180
+ See LICENSE in this directory.
173
181
 
174
182
  Notes
175
183
  -----
176
184
 
177
185
  Legacy files: would like to re-include them, but they need work
178
186
 
179
- lib/insight/views/panels/mongo.html.erb
180
- lib/insight/panels/mongo_panel/mongo_extension.rb
181
- lib/insight/panels/mongo_panel/stats.rb
182
- lib/insight/panels/mongo_panel.rb
187
+ lib/rack/insight/views/panels/mongo.html.erb
188
+ lib/rack/insight/panels/mongo_panel/mongo_extension.rb
189
+ lib/rack/insight/panels/mongo_panel/stats.rb
190
+ lib/rack/insight/panels/mongo_panel.rb
183
191
 
184
- lib/insight/views/panels/sphinx.html.erb
185
- lib/insight/panels/sphinx_panel/stats.rb
186
- lib/insight/panels/sphinx_panel.rb
192
+ lib/rack/insight/views/panels/sphinx.html.erb
193
+ lib/rack/insight/panels/sphinx_panel/stats.rb
194
+ lib/rack/insight/panels/sphinx_panel.rb
187
195
 
188
196
  This one is mostly just a curiosity
189
- lib/insight/panels/speedtracer_panel/profiling.rb
197
+ lib/rack/insight/panels/speedtracer_panel/profiling.rb
data/TODO CHANGED
@@ -4,4 +4,6 @@ Speedtracer call tagging: right now we just say "everything is either HTTP or ME
4
4
 
5
5
  Config: panels in required files automatically turned on - explicit exclude?
6
6
 
7
- Config: Explore other parts that may benefit from a config option.
7
+ Config: Explore other parts that may benefit from a config option.
8
+
9
+ UUID: Allow re-use of the Rails UUID set in middleware. How?
@@ -41,7 +41,7 @@ module Rack::Insight
41
41
  begin
42
42
  CompiledTemplates.module_eval(source, filename, 0)
43
43
  rescue Object => ex
44
- logger.debug do
44
+ logger.error do
45
45
  "#{ex.class.name}: #{ex.message} in\n" +
46
46
  source +
47
47
  ex.backtrace.join("\n")
@@ -50,7 +50,29 @@ module Rack::Insight
50
50
  end
51
51
 
52
52
  def compiled_source(filename)
53
- ::ERB.new(::File.read(::File.dirname(__FILE__) + "/views/#{filename}.html.erb"), nil, "-").src
53
+ primary_file_path = ::File.join(::File.dirname(__FILE__), "views/#{filename}.html.erb")
54
+ file = nil
55
+ begin
56
+ file = ::File.read(primary_file_path)
57
+ rescue Errno::ENOENT
58
+ end
59
+ if file.nil?
60
+ Rack::Insight::Config.config[:panel_load_paths].each do |load_path|
61
+ begin
62
+ file = ::File.read(::File.join(load_path, "#{filename}.html.erb"))
63
+ break # If no error is raised then the file was read!
64
+ rescue Errno::ENOENT
65
+ end
66
+ end
67
+ end
68
+ if file
69
+ message_src = ::ERB.new(file, nil, "-").src
70
+ else
71
+ message_src = "Rack::Insight: Unable to find expected view template #{primary_file_path} or a #{filename}.html.erb template in rack-insight's :panel_load_paths. Configured panel load paths are: #{Rack::Insight::Config.config[:panel_load_paths].inspect}"
72
+ logger.debug(message_src)
73
+ message_src = ('<p>' + message_src + '</p>').html_safe
74
+ end
75
+ message_src
54
76
  end
55
77
 
56
78
  def method_name(filename, local_assigns)
@@ -1,7 +1,7 @@
1
1
  module Rack
2
2
  module Insight
3
3
 
4
- VERSION = '0.5.0'
4
+ VERSION = '0.5.1'
5
5
 
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-insight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: