rack-insight 0.5.28 → 0.5.29

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a87d946c8f511bf3fc65fe32d7bed04f34a74fad
4
+ data.tar.gz: 6dce00ffabda1eadd05f74d75e8087125f5e7993
5
+ SHA512:
6
+ metadata.gz: 2353b459336b7964aea09b991d84e53d48383ff5770cfdee49e630426d64d77522c1e17652209d788d9d509259baf500f31b438126b7292cb69edd2357542d24
7
+ data.tar.gz: 82bfad2e59f9845ab372da3b88d6af5d42c41e5c3ebbbcd6feb45c44938693c13f78bc4ba9268ee607749e10cc8a56dc7cc0ac58aa6800b715e4c6341c8439a1
data/README.md CHANGED
@@ -23,7 +23,8 @@ stores debugging info over many requests, incuding AJAX requests.
23
23
  | version | [![Gem Version](https://badge.fury.io/rb/rack-insight.png)](http://badge.fury.io/rb/rack-insight) |
24
24
  | dependencies | [![Dependency Status](https://gemnasium.com/pboling/rack-insight.png)](https://gemnasium.com/pboling/rack-insight) |
25
25
  | code quality | [![Code Climate](https://codeclimate.com/github/pboling/rack-insight.png)](https://codeclimate.com/github/pboling/rack-insight) |
26
- | continuous integration | [![Build Status](https://secure.travis-ci.org/pboling/rack-insight.png?branch=master)](https://travis-ci.org/pboling/rack-insight) |
26
+ | inline documenation | [![Inline docs](http://inch-ci.org/github/pboling/rack-insight.png)](http://inch-ci.org/github/pboling/rack-insight) |
27
+ | continuous integration | [![Build Status](https://secure.travis-ci.org/pboling/rack-insight.png?branch=master)](https://travis-ci.org/pboling/rack-insight)|
27
28
  | test coverage | [![Coverage Status](https://coveralls.io/repos/pboling/rack-insight/badge.png)](https://coveralls.io/r/pboling/rack-insight) |
28
29
  | homepage | [https://github.com/pboling/rack-insight][homepage] |
29
30
  | documentation | [http://rdoc.info/github/pboling/rack-insight/frames][documentation] |
@@ -58,13 +59,6 @@ Features
58
59
  * Easy to add sub-applications for more detailed reports (c.f. SQLPanel)
59
60
  * Ask me (pboling) if you need help with this.
60
61
 
61
- Build Status
62
- ---------------------------
63
-
64
- Travis-ci: [![Build Status](https://secure.travis-ci.org/pboling/rack-insight.png?branch=master)](https://travis-ci.org/pboling/rack-insight) - Please help if you have time!
65
-
66
- CodeClimate: [![Code Climate](https://codeclimate.com/github/pboling/rack-insight.png)](https://codeclimate.com/github/pboling/rack-insight)
67
-
68
62
  Rails quick start
69
63
  ---------------------------
70
64
 
@@ -74,8 +68,8 @@ Add this to your Gemfile:
74
68
 
75
69
  In config/environments/development.rb, add:
76
70
 
77
- config.middleware.use "Rack::Insight::App",
78
- :secret_key => "someverylongandveryhardtoguesspreferablyrandomstring"
71
+ config.middleware.use 'Rack::Insight::App',
72
+ :secret_key => 'someverylongandveryhardtoguesspreferablyrandomstring'
79
73
 
80
74
  Any environment with Rack::Insight loaded will have a link to "Rack::Insight" added to as
81
75
  the last child of `<body>` to normal responses. Clicking that link will load the
@@ -52,9 +52,9 @@ module Rack::Insight
52
52
 
53
53
  def call(env)
54
54
  @original_request = Rack::Request.new(env)
55
+ @env = env
56
+ self.options = @default_options
55
57
  if insight_active?
56
- @env = env
57
- self.options = @default_options
58
58
  Rack::Insight.enable
59
59
  env["rack-insight.panels"] = []
60
60
  @debug_stack.call(env)
@@ -1,4 +1,9 @@
1
1
  require 'logger' # Require the standard Ruby Logger
2
+ begin
3
+ require 'redis'
4
+ rescue LoadError
5
+ warn "Could not load redis ruby gem. Some features are disabled."
6
+ end
2
7
 
3
8
  module Rack::Insight
4
9
  class Config
@@ -35,7 +40,7 @@ module Rack::Insight
35
40
  :sphinx => {:probes => {'Riddle::Client' => [:instance, :request]}},
36
41
  :sql => {:probes => Hash[%w{ PostgreSQLAdapter MysqlAdapter SQLiteAdapter
37
42
  Mysql2Adapter OracleEnhancedAdapter }.map do |adapter|
38
- ["ActiveRecord::ConnectionAdapters::#{adapter}", [:instance, :execute]]
43
+ ["ActiveRecord::ConnectionAdapters::#{adapter}", [:instance, :execute, :exec_query]]
39
44
  end ] },
40
45
  :templates => {:probes => {'ActionView::Template' => [:instance, :render]}},
41
46
  :redis => {:probes => defined?(Redis::Client) ?
@@ -43,6 +48,7 @@ module Rack::Insight
43
48
  { 'Redis' => [:instance, :call_command] } # Redis < 3.0.0
44
49
  }
45
50
  }
51
+
46
52
  @silence_magic_insight_warnings = false
47
53
  @database = {
48
54
  :raise_encoding_errors => false, # Either way will be logged
@@ -86,6 +86,7 @@ module Rack::Insight
86
86
 
87
87
  def open_database
88
88
  @db = SQLite3::Database.new(database_path)
89
+ @db.busy_timeout = 10000
89
90
  @db.execute("pragma foreign_keys = on")
90
91
  @db
91
92
  rescue StandardError => ex
@@ -13,17 +13,26 @@ module Rack::Insight
13
13
  @env = env
14
14
  status, headers, body = @app.call(@env)
15
15
 
16
- response = Rack::Response.new(body, status, headers)
17
-
18
- inject_button(response) if okay_to_modify?(env, response)
19
-
20
- return response.to_a
16
+ if body.present?
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]
24
+ end
21
25
  end
22
26
 
23
27
  def okay_to_modify?(env, response)
24
28
  return false unless response.ok?
29
+
25
30
  req = Rack::Request.new(env)
26
- return MIME_TYPES.include?(req.media_type) && !req.xhr?
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?
27
36
  end
28
37
 
29
38
  def inject_button(response)
@@ -18,7 +18,7 @@ module Rack::Insight
18
18
  method, key = args[0], args[1]
19
19
  end
20
20
  logger.info{ "Cache panel got #{method} #{key.inspect}" } if verbose(:high)
21
- @stats.record_call(method, timing.duration, !result.nil?, key)
21
+ @stats.record_call(method, timing.duration, !result.nil?, key) if method.present?
22
22
  end
23
23
 
24
24
  def panel_app
@@ -30,7 +30,7 @@ module Rack::Insight
30
30
 
31
31
  def record_call(time, command_args, method_call)
32
32
  @queries << Query.new(time, command_args, method_call)
33
- puts "Recorded Redis Call: #{@queries.inspect}"
33
+ #puts "Recorded Redis Call: #{@queries.inspect}"
34
34
  @calls += 1
35
35
  @time += time
36
36
  end
@@ -5,8 +5,10 @@ module Rack::Insight
5
5
  sections = {}
6
6
  sections["GET"] = sort(@request.GET) if @request.GET.any?
7
7
  sections["POST"] = sort(@request.POST) if @request.POST.any?
8
- # TODO: Fix for Rails 4 (as part of splitting panels into separate gems)
9
- unless defined?(ActionDispatch::Request::Session)
8
+ # TODO: Better Fix for Rails 4 (as part of splitting panels into separate gems)
9
+ if defined?(ActionDispatch::Request::Session)
10
+ sections["Session"] = sort(@request.env["rack.session"].to_hash) if @request.env["rack.session"] && @request.env["rack.session"].present?
11
+ else
10
12
  sections["Session"] = sort(@request.env["rack.session"]) if @request.env["rack.session"] && @request.env["rack.session"].any?
11
13
  end
12
14
  sections["Cookies"] = sort(@request.env["rack.request.cookie_hash"]) if @request.env["rack.request.cookie_hash"] && @request.env["rack.request.cookie_hash"].any?
@@ -1,13 +1,6 @@
1
- (function (factory) {
2
- if (typeof define === 'function' && define.amd) {
3
- // AMD. Register as anonymous module.
4
- define(['jquery'], factory);
5
- } else {
6
- // Browser globals.
7
- factory(jQuery);
8
- }
9
- }(function ($) {
10
-
1
+ var _$ = window.$;
2
+ jQuery.noConflict();
3
+ jQuery(function($) {
11
4
  function Insight() {
12
5
  this.current = null
13
6
  this.request_id = null
@@ -139,4 +132,5 @@
139
132
  },
140
133
  type: "numeric"
141
134
  });
142
- }));
135
+ });
136
+ $ = _$;
@@ -1,7 +1,7 @@
1
1
  module Rack
2
2
  module Insight
3
3
 
4
- VERSION = '0.5.28'
4
+ VERSION = '0.5.29'
5
5
 
6
6
  end
7
7
  end
@@ -7,11 +7,13 @@
7
7
  </tr>
8
8
  </thead>
9
9
  <tbody>
10
+ <% i = 1 %>
10
11
  <% records.each do |class_name, count| %>
11
- <tr>
12
+ <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
12
13
  <td><%= count %></td>
13
14
  <td><%= class_name %></td>
14
15
  </tr>
16
+ <% i += 1 %>
15
17
  <% end %>
16
18
  </tbody>
17
19
  </table>
@@ -3,7 +3,7 @@
3
3
  if (typeof jQuery == 'undefined') {
4
4
  var jquery_url = '/__insight__/jquery-1.3.2.js';
5
5
  document.write(unescape('%3Cscript src="' + jquery_url + '" type="text/javascript"%3E%3C/script%3E'));
6
- }
6
+ }
7
7
  </script>
8
8
  <script type="text/javascript" src="/__insight__/jquery.tablesorter.min.js"></script>
9
9
  <script type="text/javascript" src="/__insight__/bookmarklet.js"></script>
@@ -17,7 +17,7 @@
17
17
  $.insight.request_id = <%= request_id %>
18
18
  if(document.readCookie('rack-insight_position')) {
19
19
  $('#rack-insight').removeClass('rack-insight_top rack-insight_bottom')
20
- .addClass('rack-insight_' + document.readCookie('rack-insight_position'));
20
+ .addClass('rack-insight_' + document.readCookie('rack-insight_position'));
21
21
  }
22
22
  })
23
23
  </script>
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-insight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.28
5
- prerelease:
4
+ version: 0.5.29
6
5
  platform: ruby
7
6
  authors:
8
7
  - Peter Boling
@@ -12,169 +11,149 @@ authors:
12
11
  autorequire:
13
12
  bindir: bin
14
13
  cert_chain: []
15
- date: 2014-01-14 00:00:00.000000000 Z
14
+ date: 2014-11-06 00:00:00.000000000 Z
16
15
  dependencies:
17
16
  - !ruby/object:Gem::Dependency
18
17
  name: rack
19
18
  requirement: !ruby/object:Gem::Requirement
20
- none: false
21
19
  requirements:
22
- - - ! '>='
20
+ - - ">="
23
21
  - !ruby/object:Gem::Version
24
22
  version: '0'
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
- - - ! '>='
27
+ - - ">="
31
28
  - !ruby/object:Gem::Version
32
29
  version: '0'
33
30
  - !ruby/object:Gem::Dependency
34
31
  name: uuidtools
35
32
  requirement: !ruby/object:Gem::Requirement
36
- none: false
37
33
  requirements:
38
- - - ! '>='
34
+ - - ">="
39
35
  - !ruby/object:Gem::Version
40
36
  version: 2.1.2
41
37
  type: :runtime
42
38
  prerelease: false
43
39
  version_requirements: !ruby/object:Gem::Requirement
44
- none: false
45
40
  requirements:
46
- - - ! '>='
41
+ - - ">="
47
42
  - !ruby/object:Gem::Version
48
43
  version: 2.1.2
49
44
  - !ruby/object:Gem::Dependency
50
45
  name: sqlite3
51
46
  requirement: !ruby/object:Gem::Requirement
52
- none: false
53
47
  requirements:
54
- - - ! '>='
48
+ - - ">="
55
49
  - !ruby/object:Gem::Version
56
50
  version: 1.3.3
57
51
  type: :runtime
58
52
  prerelease: false
59
53
  version_requirements: !ruby/object:Gem::Requirement
60
- none: false
61
54
  requirements:
62
- - - ! '>='
55
+ - - ">="
63
56
  - !ruby/object:Gem::Version
64
57
  version: 1.3.3
65
58
  - !ruby/object:Gem::Dependency
66
59
  name: reek
67
60
  requirement: !ruby/object:Gem::Requirement
68
- none: false
69
61
  requirements:
70
- - - ! '>='
62
+ - - ">="
71
63
  - !ruby/object:Gem::Version
72
64
  version: 1.2.13
73
65
  type: :development
74
66
  prerelease: false
75
67
  version_requirements: !ruby/object:Gem::Requirement
76
- none: false
77
68
  requirements:
78
- - - ! '>='
69
+ - - ">="
79
70
  - !ruby/object:Gem::Version
80
71
  version: 1.2.13
81
72
  - !ruby/object:Gem::Dependency
82
73
  name: roodi
83
74
  requirement: !ruby/object:Gem::Requirement
84
- none: false
85
75
  requirements:
86
- - - ! '>='
76
+ - - ">="
87
77
  - !ruby/object:Gem::Version
88
78
  version: 2.2.0
89
79
  type: :development
90
80
  prerelease: false
91
81
  version_requirements: !ruby/object:Gem::Requirement
92
- none: false
93
82
  requirements:
94
- - - ! '>='
83
+ - - ">="
95
84
  - !ruby/object:Gem::Version
96
85
  version: 2.2.0
97
86
  - !ruby/object:Gem::Dependency
98
87
  name: rake
99
88
  requirement: !ruby/object:Gem::Requirement
100
- none: false
101
89
  requirements:
102
- - - ! '>='
90
+ - - ">="
103
91
  - !ruby/object:Gem::Version
104
92
  version: 10.1.0
105
93
  type: :development
106
94
  prerelease: false
107
95
  version_requirements: !ruby/object:Gem::Requirement
108
- none: false
109
96
  requirements:
110
- - - ! '>='
97
+ - - ">="
111
98
  - !ruby/object:Gem::Version
112
99
  version: 10.1.0
113
100
  - !ruby/object:Gem::Dependency
114
101
  name: rspec
115
102
  requirement: !ruby/object:Gem::Requirement
116
- none: false
117
103
  requirements:
118
- - - ! '>='
104
+ - - "~>"
119
105
  - !ruby/object:Gem::Version
120
106
  version: 2.14.1
121
107
  type: :development
122
108
  prerelease: false
123
109
  version_requirements: !ruby/object:Gem::Requirement
124
- none: false
125
110
  requirements:
126
- - - ! '>='
111
+ - - "~>"
127
112
  - !ruby/object:Gem::Version
128
113
  version: 2.14.1
129
114
  - !ruby/object:Gem::Dependency
130
115
  name: sinatra
131
116
  requirement: !ruby/object:Gem::Requirement
132
- none: false
133
117
  requirements:
134
- - - ! '>='
118
+ - - ">="
135
119
  - !ruby/object:Gem::Version
136
120
  version: 1.4.3
137
121
  type: :development
138
122
  prerelease: false
139
123
  version_requirements: !ruby/object:Gem::Requirement
140
- none: false
141
124
  requirements:
142
- - - ! '>='
125
+ - - ">="
143
126
  - !ruby/object:Gem::Version
144
127
  version: 1.4.3
145
128
  - !ruby/object:Gem::Dependency
146
129
  name: webrat
147
130
  requirement: !ruby/object:Gem::Requirement
148
- none: false
149
131
  requirements:
150
- - - ! '>='
132
+ - - ">="
151
133
  - !ruby/object:Gem::Version
152
134
  version: 0.7.3
153
135
  type: :development
154
136
  prerelease: false
155
137
  version_requirements: !ruby/object:Gem::Requirement
156
- none: false
157
138
  requirements:
158
- - - ! '>='
139
+ - - ">="
159
140
  - !ruby/object:Gem::Version
160
141
  version: 0.7.3
161
142
  - !ruby/object:Gem::Dependency
162
- name: gem-release
143
+ name: nokogiri
163
144
  requirement: !ruby/object:Gem::Requirement
164
- none: false
165
145
  requirements:
166
- - - ! '>='
146
+ - - '='
167
147
  - !ruby/object:Gem::Version
168
- version: 0.6.0
148
+ version: 1.6.3.1
169
149
  type: :development
170
150
  prerelease: false
171
151
  version_requirements: !ruby/object:Gem::Requirement
172
- none: false
173
152
  requirements:
174
- - - ! '>='
153
+ - - '='
175
154
  - !ruby/object:Gem::Version
176
- version: 0.6.0
177
- description: ! "Debugging toolbar for Rack applications implemented as middleware.\n
155
+ version: 1.6.3.1
156
+ description: "Debugging toolbar for Rack applications implemented as middleware.\n
178
157
  \ Based on logical-insight and rack-bug. "
179
158
  email:
180
159
  - peter.boling@gmail.com
@@ -185,12 +164,19 @@ extra_rdoc_files:
185
164
  - LICENSE
186
165
  - CHANGELOG
187
166
  files:
167
+ - CHANGELOG
168
+ - LICENSE
169
+ - README.md
170
+ - Rakefile
171
+ - lib/rack-insight.rb
172
+ - lib/rack/insight.rb
188
173
  - lib/rack/insight/app.rb
189
174
  - lib/rack/insight/config.rb
190
175
  - lib/rack/insight/database.rb
191
176
  - lib/rack/insight/default_invocation.rb
192
177
  - lib/rack/insight/enable-button.rb
193
178
  - lib/rack/insight/filtered_backtrace.rb
179
+ - lib/rack/insight/instrumentation.rb
194
180
  - lib/rack/insight/instrumentation/backstage.rb
195
181
  - lib/rack/insight/instrumentation/client.rb
196
182
  - lib/rack/insight/instrumentation/eigen_client.rb
@@ -199,42 +185,41 @@ files:
199
185
  - lib/rack/insight/instrumentation/probe-definition.rb
200
186
  - lib/rack/insight/instrumentation/probe.rb
201
187
  - lib/rack/insight/instrumentation/setup.rb
202
- - lib/rack/insight/instrumentation.rb
203
188
  - lib/rack/insight/logging.rb
204
189
  - lib/rack/insight/magic_insight.rb
205
190
  - lib/rack/insight/options.rb
206
191
  - lib/rack/insight/panel.rb
207
192
  - lib/rack/insight/panel_app.rb
193
+ - lib/rack/insight/panels-content.rb
194
+ - lib/rack/insight/panels-header.rb
208
195
  - lib/rack/insight/panels/active_record_panel.rb
209
- - lib/rack/insight/panels/active_resource_panel/query.rb
210
196
  - lib/rack/insight/panels/active_resource_panel.rb
197
+ - lib/rack/insight/panels/active_resource_panel/query.rb
198
+ - lib/rack/insight/panels/cache_panel.rb
211
199
  - lib/rack/insight/panels/cache_panel/panel_app.rb
212
200
  - lib/rack/insight/panels/cache_panel/stats.rb
213
- - lib/rack/insight/panels/cache_panel.rb
214
201
  - lib/rack/insight/panels/log_panel.rb
215
202
  - lib/rack/insight/panels/memory_panel.rb
203
+ - lib/rack/insight/panels/mongo_panel.rb
216
204
  - lib/rack/insight/panels/mongo_panel/mongo_extension.rb
217
205
  - lib/rack/insight/panels/mongo_panel/stats.rb
218
- - lib/rack/insight/panels/mongo_panel.rb
219
206
  - lib/rack/insight/panels/rails_info_panel.rb
220
- - lib/rack/insight/panels/redis_panel/stats.rb
221
207
  - lib/rack/insight/panels/redis_panel.rb
208
+ - lib/rack/insight/panels/redis_panel/stats.rb
222
209
  - lib/rack/insight/panels/request_variables_panel.rb
210
+ - lib/rack/insight/panels/speedtracer_panel.rb
223
211
  - lib/rack/insight/panels/speedtracer_panel/profiling.rb
224
212
  - lib/rack/insight/panels/speedtracer_panel/trace-app.rb
225
213
  - lib/rack/insight/panels/speedtracer_panel/tracer.rb
226
- - lib/rack/insight/panels/speedtracer_panel.rb
227
- - lib/rack/insight/panels/sphinx_panel/stats.rb
228
214
  - lib/rack/insight/panels/sphinx_panel.rb
215
+ - lib/rack/insight/panels/sphinx_panel/stats.rb
216
+ - lib/rack/insight/panels/sql_panel.rb
229
217
  - lib/rack/insight/panels/sql_panel/panel_app.rb
230
218
  - lib/rack/insight/panels/sql_panel/query.rb
231
- - lib/rack/insight/panels/sql_panel.rb
219
+ - lib/rack/insight/panels/templates_panel.rb
232
220
  - lib/rack/insight/panels/templates_panel/rendering.rb
233
221
  - lib/rack/insight/panels/templates_panel/stats.rb
234
- - lib/rack/insight/panels/templates_panel.rb
235
222
  - lib/rack/insight/panels/timer_panel.rb
236
- - lib/rack/insight/panels-content.rb
237
- - lib/rack/insight/panels-header.rb
238
223
  - lib/rack/insight/params_signature.rb
239
224
  - lib/rack/insight/path-filter.rb
240
225
  - lib/rack/insight/public/__insight__/bookmarklet.html
@@ -281,35 +266,28 @@ files:
281
266
  - lib/rack/insight/views/redirect.html.erb
282
267
  - lib/rack/insight/views/request_fragment.html.erb
283
268
  - lib/rack/insight/views/toolbar.html.erb
284
- - lib/rack/insight.rb
285
- - lib/rack-insight.rb
286
- - LICENSE
287
- - README.md
288
- - CHANGELOG
289
- - Rakefile
290
269
  homepage: https://github.com/pboling/rack-insight
291
270
  licenses:
292
271
  - MIT
272
+ metadata: {}
293
273
  post_install_message:
294
274
  rdoc_options: []
295
275
  require_paths:
296
276
  - lib
297
277
  required_ruby_version: !ruby/object:Gem::Requirement
298
- none: false
299
278
  requirements:
300
- - - ! '>='
279
+ - - ">="
301
280
  - !ruby/object:Gem::Version
302
281
  version: '0'
303
282
  required_rubygems_version: !ruby/object:Gem::Requirement
304
- none: false
305
283
  requirements:
306
- - - ! '>='
284
+ - - ">="
307
285
  - !ruby/object:Gem::Version
308
286
  version: '0'
309
287
  requirements: []
310
288
  rubyforge_project:
311
- rubygems_version: 1.8.25
289
+ rubygems_version: 2.4.2
312
290
  signing_key:
313
- specification_version: 3
291
+ specification_version: 4
314
292
  summary: Debugging toolbar for Rack applications implemented as middleware.
315
293
  test_files: []