rack-insight 0.5.30 → 0.6.2

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: 351bb41ae69905d1b03169864a4b0459220af8df
4
- data.tar.gz: ae9f529678066604e1d3cc2a62a72dd7167b8655
3
+ metadata.gz: 070825bb2f27f4947924252c50492aebadb203d2
4
+ data.tar.gz: 3fa8d5e8fdf4a4a10fbc1db449deef7e312676ad
5
5
  SHA512:
6
- metadata.gz: e06a61b347b4f0ec8c90d51ef67e078c4b5a445a28619c1abfa5e61df99a2c061529be0acb3d3a3a881cbd5d1d0263fec3e4050295dd6091f88cc8666d4be38a
7
- data.tar.gz: 5f1634ef97c2838a9e63910e264af6cfe1e29fa96b67d6f5fb04a02e591d3e7a95781e8b2df974eea0c47698a51fc9b988fefd1458eecf0777988ebbc75720b2
6
+ metadata.gz: ebccd9b683fdccc127585cc48e874c4eed6f85b270c8c0b41f91f206d498ca6b19920a26af0287139858cb3f39be01a1d469671f020e921fb13036fc813d09af
7
+ data.tar.gz: 94e99ba82b5105be008e8fcc40d595428aee16de061c3834f43515e7939a349d6b890872d09ea17780bbd4f503d67273a7192bc4225ae86a12ff4647f9e0bedd
@@ -1,4 +1,19 @@
1
- == 0.5.30 / 2015-01-07
1
+ ## 0.6 / 2015-03-08
2
+
3
+ * Bug Fixes
4
+
5
+ * Complete rewrite of `EnableButton` to ensure compatibility with all other Rack apps by Peter Boling
6
+ * Removed duplicate config entry for `:verbosity` by Peter Boling
7
+
8
+ * Other
9
+
10
+ * Added Sinatra example to Readme by Peter Boling
11
+ * spec improvements by Peter Boling
12
+ * upgrade to latest version of Ruby for development by Peter Boling
13
+ * Fixed Markdown syntax on CHANGELOG => CHANGELOG.md by Peter Boling
14
+ * added bin scripts, but do not include in gem package by Peter Boling
15
+
16
+ ## 0.5.30 / 2015-01-07
2
17
 
3
18
  * Bug Fixes
4
19
 
@@ -9,7 +24,7 @@
9
24
  * Added working example: https://github.com/pboling/x-cascade_header_rails/tree/rails3
10
25
 
11
26
 
12
- == 0.5.29 / 2014-11-06
27
+ ## 0.5.29 / 2014-11-06
13
28
 
14
29
  * Bug Fixes
15
30
 
@@ -27,7 +42,7 @@
27
42
 
28
43
  * Improved Readme by Peter Boling
29
44
 
30
- == 0.5.28 / 2014-01-14
45
+ ## 0.5.28 / 2014-01-14
31
46
 
32
47
  * Bug Fixes
33
48
 
@@ -57,7 +72,7 @@
57
72
 
58
73
 
59
74
 
60
- == 0.5.27 / 2013-09-03
75
+ ## 0.5.27 / 2013-09-03
61
76
 
62
77
  * Other
63
78
 
@@ -79,7 +94,7 @@
79
94
 
80
95
  * Add license and platform to gemspec by Peter Boling
81
96
 
82
- == 0.5.26 / 2013-08-06
97
+ ## 0.5.26 / 2013-08-06
83
98
 
84
99
  * Bug Fixes
85
100
 
@@ -93,13 +108,13 @@
93
108
 
94
109
  * Update README.md by Agis Anastasopoulos
95
110
 
96
- == 0.5.25 / 2013-03-15
111
+ ## 0.5.25 / 2013-03-15
97
112
 
98
113
  * Bug Fixes
99
114
 
100
115
  * active_record_panel is fixed! [(kjg - Kevin Glowacz)](https://github.com/kjg)
101
116
 
102
- == 0.5.24 / 2013-01-01
117
+ ## 0.5.24 / 2013-01-01
103
118
 
104
119
  * Bug Fixes
105
120
 
@@ -107,7 +122,7 @@
107
122
 
108
123
  * Changed event logging in the instrumentation from `:high` to `:debug` level.
109
124
 
110
- == 0.5.23 / 2012-09-14
125
+ ## 0.5.23 / 2012-09-14
111
126
 
112
127
  * New Features
113
128
 
@@ -129,13 +144,13 @@
129
144
  handle_error_for(method_name, ex)
130
145
  end
131
146
 
132
- == 0.5.22 / 2012-09-14
147
+ ## 0.5.22 / 2012-09-14
133
148
 
134
149
  * New Features
135
150
 
136
151
  * Improve handling of decoding and marshalling problems with new config options and implementation: (pboling - Peter Boling)
137
152
 
138
- :database => a hash. Keys :raise_encoding_errors, and :raise_decoding_errors are self explanatory
153
+ :database => a hash. Keys :raise_encoding_errors, and :raise_decoding_errors are self explanatory
139
154
  :raise_encoding_errors
140
155
  When set to true, if there is an encoding error (unlikely)
141
156
  it will cause a 500 error on your site. !!!WARNING!!!
@@ -155,18 +170,18 @@
155
170
 
156
171
  * Internal config validation system (pboling - Peter Boling)
157
172
 
158
- == 0.5.21 / 2012-09-13 - Peter Boling
173
+ ## 0.5.21 / 2012-09-13
159
174
 
160
- * Attempting to handle values that get stored in the sqlite db, but which can't be re-marshalled, without failing the entire panel
161
- * Much nicer error handling output in panel heading and panel content areas
175
+ * Attempting to handle values that get stored in the sqlite db, but which can't be re-marshalled, without failing the entire panel (pboling - Peter Boling)
176
+ * Much nicer error handling output in panel heading and panel content areas (pboling - Peter Boling)
162
177
 
163
- == 0.5.20 / 2012-09-13 - Peter Boling
178
+ ## 0.5.20 / 2012-09-13
164
179
 
165
180
  * Bug Fixes
166
181
 
167
182
  * Fix panel error handling (pboling - Peter Boling)
168
183
 
169
- == 0.5.19 / 2012-09-13 - Peter Boling
184
+ ## 0.5.19 / 2012-09-13
170
185
 
171
186
  * Other
172
187
 
@@ -177,7 +192,7 @@
177
192
 
178
193
  * Fix redis panel, maybe... (oggy - George Ogata)
179
194
 
180
- == 0.5.18 / 2012-09-13 - Peter Boling
195
+ ## 0.5.18 / 2012-09-13
181
196
 
182
197
  * Bug Fixes
183
198
 
@@ -187,11 +202,11 @@
187
202
 
188
203
  * Fix Typo in templates panel
189
204
 
190
- == 0.5.17 / 2012-09-13 - Peter Boling
205
+ ## 0.5.17 / 2012-09-13
191
206
 
192
207
  * New Features
193
208
 
194
- * MagicInsight! WARNING: Magic is dangerous.
209
+ * MagicInsight! WARNING: Magic is dangerous. (pboling - Peter Boling)
195
210
 
196
211
  * MagicInsight is a new mixin that can be used by any 'stat' type class built for Rack::Bug / LogicalInsight / Rack::Insight.
197
212
  Just include Rack::Insight::MagicInsight in your stat class and then to render call:
@@ -201,51 +216,51 @@
201
216
  Read the source for Rack::Insight::MagicInsight and heed the warnings.
202
217
  MagicInsight is used internally by Rack::Insight for magic panels and the templates panel.
203
218
 
204
- * panel content now stays out of your page content, by displaying below it.
219
+ * panel content now stays out of your page content, by displaying below it. (pboling - Peter Boling)
205
220
 
206
221
  * Bug Fixes
207
222
 
208
- * Fixed the hardly working TemplatesPanel (Issue 1)
209
- * Correct logging/debug statements
210
- * Better tracking of which panels are probing
223
+ * Fixed the hardly working TemplatesPanel (Issue 1) (pboling - Peter Boling)
224
+ * Correct logging/debug statements (pboling - Peter Boling)
225
+ * Better tracking of which panels are probing (pboling - Peter Boling)
211
226
 
212
227
  * Other
213
228
 
214
- * TemplatesPanel is now more aligned with the Rack::Insight Panel API.
229
+ * TemplatesPanel is now more aligned with the Rack::Insight Panel API. (pboling - Peter Boling)
215
230
 
216
- == 0.5.16 / 2012-09-11 - Peter Boling
231
+ ## 0.5.16 / 2012-09-11
217
232
 
218
233
  * Other
219
234
 
220
- * Improved handling of no content for a panel.
235
+ * Improved handling of no content for a panel. (pboling - Peter Boling)
221
236
 
222
- == 0.5.14-15 / 2012-09-11 - Peter Boling
237
+ ## 0.5.14-15 / 2012-09-11
223
238
 
224
239
  * New Features
225
240
 
226
- * Panel level configurations for :probes are now supported by default on all panels
227
- * Auto-magical panel names
228
- * Auto-magical panel probe detection and storage
229
- * Auto-magical panel content
230
- * Auto-magical table creation (skipped with self.has_table = false in a Panel class definition)
231
- * Under construction, or blank, panels have more scaffolding
241
+ * Panel level configurations for :probes are now supported by default on all panels (pboling - Peter Boling)
242
+ * Auto-magical panel names (pboling - Peter Boling)
243
+ * Auto-magical panel probe detection and storage (pboling - Peter Boling)
244
+ * Auto-magical panel content (pboling - Peter Boling)
245
+ * Auto-magical table creation (skipped with self.has_table = false in a Panel class definition) (pboling - Peter Boling)
246
+ * Under construction, or blank, panels have more scaffolding (pboling - Peter Boling)
232
247
 
233
- == 0.5.13 / 2012-09-10 - Peter Boling
248
+ ## 0.5.13 / 2012-09-10
234
249
 
235
250
  * Bug Fixes
236
251
 
237
- * Fixed the double logging of anything logged with ActiveSupport::BufferedLogger (via the new :panel_configs)
252
+ * Fixed the double logging of anything logged with ActiveSupport::BufferedLogger (via the new :panel_configs) (pboling - Peter Boling)
238
253
 
239
254
  * New Features
240
255
 
241
- * Panel level configuration options for all panels, including extension gems.
256
+ * Panel level configuration options for all panels, including extension gems. (pboling - Peter Boling)
242
257
  Currently this is implemented in the log_panel, and configured as:
243
258
  Rack::Insight::Config.configure do |config|
244
259
  config[:panel_configs][:log_panel] = {:watch => {'Logger' => :add}}
245
260
  end
246
- * Count number of Log Entries
261
+ * Count number of Log Entries (pboling - Peter Boling)
247
262
 
248
- == 0.5.12 / 2012-09-10
263
+ ## 0.5.12 / 2012-09-10
249
264
 
250
265
  * Other
251
266
 
@@ -255,69 +270,69 @@
255
270
 
256
271
  * persistent toolbar position by Alif Rachmawadi
257
272
 
258
- == 0.5.11 / 2012-09-05
273
+ ## 0.5.11 / 2012-09-05
259
274
 
260
275
  * Bug Fixes
261
276
 
262
277
  * Fixed Encoding::CompatibilityError by Michael Grosser
263
278
 
264
- == 0.5.10 / 2012-09-04 (Peter Boling)
279
+ ## 0.5.10 / 2012-09-04
265
280
 
266
281
  * Bug Fixes
267
282
 
268
- * Ajax requests for previously cached panel data now go to root (/), which allows it to work on non-root URLs.
283
+ * Ajax requests for previously cached panel data now go to root (/), which allows it to work on non-root URLs. (pboling - Peter Boling)
269
284
 
270
- == 0.5.9 / 2012-09-04 (Peter Boling)
285
+ ## 0.5.9 / 2012-09-04
271
286
 
272
287
  * New Features
273
288
 
274
- * FilteredBacktrace was disabled in LogicalInsight. It's now back. It is now configurable via the configure block.
289
+ * FilteredBacktrace was disabled in LogicalInsight. It's now back. It is now configurable via the configure block. (pboling - Peter Boling)
275
290
 
276
- == 0.5.8 / 2012-09-04 (Peter Boling)
291
+ ## 0.5.8 / 2012-09-04
277
292
 
278
293
  * Bug Fixes
279
294
 
280
- * working template_root for rack-insight extension libraries
295
+ * working template_root for rack-insight extension libraries (pboling - Peter Boling)
281
296
 
282
- == 0.5.7 / 2012-09-03 (Peter Boling)
297
+ ## 0.5.7 / 2012-09-03
283
298
 
284
299
  * Bug Fixes
285
300
 
286
- * require 'logger' important when using Ruby Logger
301
+ * require 'logger' important when using Ruby Logger (pboling - Peter Boling)
287
302
 
288
- == 0.5.6 / 2012-08-31 (Peter Boling)
303
+ ## 0.5.6 / 2012-08-31
289
304
 
290
305
  * Other
291
306
 
292
- * Wrap debug logging in verbose check
293
- * Documentation
307
+ * Wrap debug logging in verbose check (pboling - Peter Boling)
308
+ * Documentation (pboling - Peter Boling)
294
309
 
295
- == 0.5.5 / 2012-08-31 (Peter Boling)
310
+ ## 0.5.5 / 2012-08-31
296
311
 
297
312
  * New Features
298
313
 
299
314
  * Extension gems now automatically look for their view templates
300
- relative to the panel class file that tries to render them.
315
+ relative to the panel class file that tries to render them. (pboling - Peter Boling)
301
316
  * Two levels of log verbosity filtering to allow re-use of the Rails log, but to not force same level output from
302
317
  rack-insight as the rails log is set to for the env. It will never be more logging than Rails log's env level,
303
- but it can, and usually should, be less.
318
+ but it can, and usually should, be less. (pboling - Peter Boling)
304
319
 
305
- * Fixed a number of bugs, and refactored some things. Please let me know if you use it/break it!
320
+ * Fixed a number of bugs, and refactored some things. Please let me know if you use it/break it! (pboling - Peter Boling)
306
321
 
307
- == 0.5.0 / 2012-08-29 - transition to rack_insight (Peter Boling)
322
+ ## 0.5.0 / 2012-08-29 - transition to rack_insight
308
323
 
309
324
  * Compatibility
310
325
 
311
326
  * Restructure gem so Insight is inside a namespace, because I have classes named Insight that are obscured by
312
327
  logical_insight gem when loaded. Logical also seemed like it may be a class name somewhere, hence going back to
313
- the Rack namespace a la rack-bug. Keeping the (now nested) Insight namespace as well, because - genetics.
328
+ the Rack namespace a la rack-bug. Keeping the (now nested) Insight namespace as well, because - genetics. (pboling - Peter Boling)
314
329
 
315
- *Other
330
+ * Other
316
331
 
317
- * Fix spelling of retreive => retrieve
318
- * Remove redundant time method from cache_panel/stats.rb
332
+ * Fix spelling of retreive => retrieve (pboling - Peter Boling)
333
+ * Remove redundant time method from cache_panel/stats.rb (pboling - Peter Boling)
319
334
 
320
- == 0.4.X - last of logical_insight
335
+ ## 0.4.X - last of logical_insight
321
336
 
322
337
  * New features
323
338
 
@@ -341,7 +356,7 @@
341
356
  * Refactoring and code cleanup (Tim Connor)
342
357
  * Testing cleanup - better isolation of Rails vs. non-Rails in tests (Tim Connor)
343
358
 
344
- == 0.3.0 / 2010-05-28
359
+ ## 0.3.0 / 2010-05-28
345
360
 
346
361
  * New features
347
362
 
@@ -359,6 +374,6 @@
359
374
  * compatibility with current rack-test (Luke Melia & Joey Aghion)
360
375
  * update Sinatra sample app (Tim Conner)
361
376
 
362
- == 0.2.1
377
+ ## 0.2.1
363
378
 
364
379
  * The beginning of recorded history
data/README.md CHANGED
@@ -83,6 +83,28 @@ Using with non-Rails Rack apps
83
83
  Just 'use Rack::Insight' as any other middleware. See the SampleApp in the
84
84
  spec/fixtures folder for an example Sinatra app.
85
85
 
86
+ This is a minimal setup:
87
+
88
+ ```
89
+ class SinatraExample < Sinatra::Base
90
+ get '/' do
91
+ <<-HTML
92
+ <html>
93
+ <head>
94
+ </head>
95
+ <body>
96
+ <p>Stink o' Man</p>
97
+ </body>
98
+ </html>
99
+ HTML
100
+ end
101
+
102
+ use Rack::Insight::App
103
+
104
+ end
105
+ ```
106
+
107
+
86
108
  Configure Rack::Insight
87
109
  ---------------------
88
110
 
@@ -67,7 +67,6 @@ module Rack::Insight
67
67
  # end
68
68
  :panel_load_paths => [File::join('rack', 'insight', 'panels')],
69
69
  :logger => @logger,
70
- :verbosity => @verbosity,
71
70
  :log_file => @log_file,
72
71
  :log_level => @log_level,
73
72
  :rails_log_copy => @rails_log_copy, # Only has effect when logger is the Rack::Insight::Logger, or a logger behaving like it
@@ -1,47 +1,39 @@
1
1
  module Rack::Insight
2
- class EnableButton
2
+ class EnableButton < Struct.new :app, :insight
3
3
  include Render
4
4
 
5
- MIME_TYPES = ["text/plain", "text/html", "application/xhtml+xml"]
6
-
7
- def initialize(app, insight)
8
- @app = app
9
- @insight = insight
10
- end
5
+ CONTENT_TYPE_REGEX = /text\/(html|plain)|application\/xhtml\+xml/
11
6
 
12
7
  def call(env)
13
- @env = env
14
- status, headers, body = @app.call(@env)
15
-
16
- if !body.nil? && !body.empty?
17
- response = Rack::Response.new(body, status, headers)
18
- inject_button(response) if okay_to_modify?(env, response)
19
-
20
- response.to_a
21
- else
22
- # Do not inject into assets served by rails or other detritus without a body.
23
- [status, headers, body]
8
+ status, headers, response = app.call(env)
9
+
10
+ if okay_to_modify?(env, headers)
11
+ body = response.inject("") do |memo, part|
12
+ memo << part
13
+ memo
14
+ end
15
+ index = body.rindex("</body>")
16
+ if index
17
+ body.insert(index, render)
18
+ headers["Content-Length"] = body.bytesize.to_s
19
+ response = [body]
20
+ end
24
21
  end
25
- end
26
22
 
27
- def okay_to_modify?(env, response)
28
- return false unless response.ok?
29
-
30
- req = Rack::Request.new(env)
31
- content_type, charset = response.content_type.split(";")
32
- filters = (env['rack-insight.path_filters'] || []).map { |str| %r(^#{str}) }
33
- filter = filters.find { |filter| env['REQUEST_PATH'] =~ filter }
34
-
35
- !filter && MIME_TYPES.include?(content_type) && !req.xhr?
23
+ [status, headers, response]
36
24
  end
37
25
 
38
- def inject_button(response)
39
- full_body = response.body.join
40
- full_body.sub! /<\/body>/, render + "</body>"
26
+ def okay_to_modify?(env, headers)
27
+ return false unless headers["Content-Type"] =~ CONTENT_TYPE_REGEX
28
+ return !match_path_filters?(env["rack-insight.path_filters"], env["REQUEST_PATH"])
29
+ end
41
30
 
42
- response["Content-Length"] = full_body.bytesize.to_s
31
+ def match_path_filters?(path_filters, path)
32
+ to_regex(path_filters).find { |filter| path =~ filter }
33
+ end
43
34
 
44
- response.body = [full_body]
35
+ def to_regex(filters)
36
+ (filters || []).map { |str| %r(^#{str}) }
45
37
  end
46
38
 
47
39
  def render
@@ -1,7 +1,7 @@
1
1
  module Rack
2
2
  module Insight
3
3
 
4
- VERSION = '0.5.30'
4
+ VERSION = '0.6.2'
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.30
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-01-07 00:00:00.000000000 Z
14
+ date: 2015-03-08 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rack
@@ -153,8 +153,9 @@ dependencies:
153
153
  - - '='
154
154
  - !ruby/object:Gem::Version
155
155
  version: 1.6.3.1
156
- description: "Debugging toolbar for Rack applications implemented as middleware.\n
157
- \ Based on logical-insight and rack-bug. "
156
+ description: |-
157
+ Debugging toolbar for Rack applications implemented as middleware.
158
+ Based on logical-insight and rack-bug.
158
159
  email:
159
160
  - peter.boling@gmail.com
160
161
  executables: []
@@ -162,9 +163,9 @@ extensions: []
162
163
  extra_rdoc_files:
163
164
  - README.md
164
165
  - LICENSE
165
- - CHANGELOG
166
+ - CHANGELOG.md
166
167
  files:
167
- - CHANGELOG
168
+ - CHANGELOG.md
168
169
  - LICENSE
169
170
  - README.md
170
171
  - Rakefile
@@ -286,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
286
287
  version: '0'
287
288
  requirements: []
288
289
  rubyforge_project:
289
- rubygems_version: 2.4.2
290
+ rubygems_version: 2.4.6
290
291
  signing_key:
291
292
  specification_version: 4
292
293
  summary: Debugging toolbar for Rack applications implemented as middleware.