ghazel-rack-bug 0.3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/History.txt +45 -0
- data/MIT-LICENSE.txt +19 -0
- data/README.md +118 -0
- data/Rakefile +23 -0
- data/Thorfile +113 -0
- data/lib/rack/bug.rb +83 -0
- data/lib/rack/bug/autoloading.rb +24 -0
- data/lib/rack/bug/filtered_backtrace.rb +38 -0
- data/lib/rack/bug/options.rb +89 -0
- data/lib/rack/bug/panel.rb +50 -0
- data/lib/rack/bug/panel_app.rb +33 -0
- data/lib/rack/bug/panels/active_record_panel.rb +45 -0
- data/lib/rack/bug/panels/active_record_panel/activerecord_extensions.rb +18 -0
- data/lib/rack/bug/panels/cache_panel.rb +51 -0
- data/lib/rack/bug/panels/cache_panel/dalli_extension.rb +16 -0
- data/lib/rack/bug/panels/cache_panel/memcache_extension.rb +129 -0
- data/lib/rack/bug/panels/cache_panel/panel_app.rb +48 -0
- data/lib/rack/bug/panels/cache_panel/stats.rb +97 -0
- data/lib/rack/bug/panels/log_panel.rb +56 -0
- data/lib/rack/bug/panels/log_panel/logger_extension.rb +24 -0
- data/lib/rack/bug/panels/memory_panel.rb +27 -0
- data/lib/rack/bug/panels/rails_info_panel.rb +23 -0
- data/lib/rack/bug/panels/redis_panel.rb +44 -0
- data/lib/rack/bug/panels/redis_panel/redis_extension.rb +28 -0
- data/lib/rack/bug/panels/redis_panel/stats.rb +52 -0
- data/lib/rack/bug/panels/request_variables_panel.rb +52 -0
- data/lib/rack/bug/panels/sphinx_panel.rb +44 -0
- data/lib/rack/bug/panels/sphinx_panel/sphinx_extension.rb +25 -0
- data/lib/rack/bug/panels/sphinx_panel/stats.rb +96 -0
- data/lib/rack/bug/panels/sql_panel.rb +55 -0
- data/lib/rack/bug/panels/sql_panel/panel_app.rb +37 -0
- data/lib/rack/bug/panels/sql_panel/query.rb +63 -0
- data/lib/rack/bug/panels/sql_panel/sql_extension.rb +11 -0
- data/lib/rack/bug/panels/templates_panel.rb +44 -0
- data/lib/rack/bug/panels/templates_panel/actionview_extension.rb +12 -0
- data/lib/rack/bug/panels/templates_panel/rendering.rb +67 -0
- data/lib/rack/bug/panels/templates_panel/trace.rb +34 -0
- data/lib/rack/bug/panels/timer_panel.rb +40 -0
- data/lib/rack/bug/params_signature.rb +63 -0
- data/lib/rack/bug/public/__rack_bug__/bookmarklet.html +10 -0
- data/lib/rack/bug/public/__rack_bug__/bookmarklet.js +217 -0
- data/lib/rack/bug/public/__rack_bug__/bug.css +216 -0
- data/lib/rack/bug/public/__rack_bug__/bug.js +84 -0
- data/lib/rack/bug/public/__rack_bug__/jquery-1.3.2.js +4376 -0
- data/lib/rack/bug/public/__rack_bug__/jquery.tablesorter.min.js +1 -0
- data/lib/rack/bug/public/__rack_bug__/spinner.gif +0 -0
- data/lib/rack/bug/rack_static_bug_avoider.rb +16 -0
- data/lib/rack/bug/redirect_interceptor.rb +27 -0
- data/lib/rack/bug/render.rb +66 -0
- data/lib/rack/bug/toolbar.rb +66 -0
- data/lib/rack/bug/views/error.html.erb +16 -0
- data/lib/rack/bug/views/panels/active_record.html.erb +17 -0
- data/lib/rack/bug/views/panels/cache.html.erb +93 -0
- data/lib/rack/bug/views/panels/execute_sql.html.erb +32 -0
- data/lib/rack/bug/views/panels/explain_sql.html.erb +32 -0
- data/lib/rack/bug/views/panels/log.html.erb +21 -0
- data/lib/rack/bug/views/panels/profile_sql.html.erb +32 -0
- data/lib/rack/bug/views/panels/rails_info.html.erb +19 -0
- data/lib/rack/bug/views/panels/redis.html.erb +46 -0
- data/lib/rack/bug/views/panels/request_variables.html.erb +29 -0
- data/lib/rack/bug/views/panels/sphinx.html.erb +32 -0
- data/lib/rack/bug/views/panels/sql.html.erb +43 -0
- data/lib/rack/bug/views/panels/templates.html.erb +7 -0
- data/lib/rack/bug/views/panels/timer.html.erb +19 -0
- data/lib/rack/bug/views/panels/view_cache.html.erb +19 -0
- data/lib/rack/bug/views/redirect.html.erb +16 -0
- data/lib/rack/bug/views/toolbar.html.erb +42 -0
- data/rack-bug.gemspec +147 -0
- data/spec/fixtures/config.ru +8 -0
- data/spec/fixtures/dummy_panel.rb +2 -0
- data/spec/fixtures/sample_app.rb +46 -0
- data/spec/rack/bug/panels/active_record_panel_spec.rb +30 -0
- data/spec/rack/bug/panels/cache_panel_spec.rb +167 -0
- data/spec/rack/bug/panels/log_panel_spec.rb +43 -0
- data/spec/rack/bug/panels/memory_panel_spec.rb +22 -0
- data/spec/rack/bug/panels/rails_info_panel_spec.rb +40 -0
- data/spec/rack/bug/panels/redis_panel_spec.rb +69 -0
- data/spec/rack/bug/panels/sql_panel_spec.rb +146 -0
- data/spec/rack/bug/panels/templates_panel_spec.rb +71 -0
- data/spec/rack/bug/panels/timer_panel_spec.rb +38 -0
- data/spec/rack/bug_spec.rb +137 -0
- data/spec/rcov.opts +1 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +44 -0
- metadata +201 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
<h3>Redis Usage</h3>
|
2
|
+
<table id="redis_usage">
|
3
|
+
<tr>
|
4
|
+
<th>Total Calls</th>
|
5
|
+
<td><%= stats.calls %></td>
|
6
|
+
|
7
|
+
<th>Total Time</th>
|
8
|
+
<td><%= stats.display_time %></td>
|
9
|
+
</tr>
|
10
|
+
</table>
|
11
|
+
|
12
|
+
<% if stats.queries.any? %>
|
13
|
+
<h3>Breakdown</h3>
|
14
|
+
<table id="redis_breakdown">
|
15
|
+
<thead>
|
16
|
+
<tr>
|
17
|
+
<th>Time (ms)</th>
|
18
|
+
<th>Command</th>
|
19
|
+
<th class="backtrace"></th>
|
20
|
+
</tr>
|
21
|
+
</thead>
|
22
|
+
<tbody>
|
23
|
+
<% i = 1 %>
|
24
|
+
<% stats.queries.each do |query| %>
|
25
|
+
<tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
|
26
|
+
<td><%= query.display_time %></td>
|
27
|
+
<td><%= query.command %></td>
|
28
|
+
<td><%= "<a href='#' class='reveal_backtrace'>Show Backtrace</a>" if query.has_backtrace? %></td>
|
29
|
+
</tr>
|
30
|
+
<% if query.has_backtrace? %>
|
31
|
+
<tr style="display:none">
|
32
|
+
<td></td>
|
33
|
+
<td colspan="2">
|
34
|
+
<ul>
|
35
|
+
<% query.filtered_backtrace.each do |line| %>
|
36
|
+
<li><%=h line %></li>
|
37
|
+
<% end %>
|
38
|
+
</ul>
|
39
|
+
</td>
|
40
|
+
</tr>
|
41
|
+
<% end %>
|
42
|
+
<% i += 1 %>
|
43
|
+
<% end %>
|
44
|
+
</tbody>
|
45
|
+
</table>
|
46
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<% ["GET", "POST", "Session", "Cookies", "SERVER VARIABLES", "Rack ENV"].each do |header|
|
2
|
+
next unless sections.has_key?(header)
|
3
|
+
%>
|
4
|
+
<h3><%=header%></h3>
|
5
|
+
<table id="request_variables">
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th>Variable</th>
|
9
|
+
<th>Value</th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
<tbody>
|
13
|
+
<% i = 1 %>
|
14
|
+
<% sections[header].each do |key, val| %>
|
15
|
+
<tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
|
16
|
+
<td><%=h key %></td>
|
17
|
+
<td class="code"><div>
|
18
|
+
<% if val.is_a?(Hash) %>
|
19
|
+
<%=h val.inspect %>
|
20
|
+
<% else %>
|
21
|
+
<%=h val.to_s %>
|
22
|
+
<% end %>
|
23
|
+
</div></td>
|
24
|
+
</tr>
|
25
|
+
<% i += 1 %>
|
26
|
+
<% end %>
|
27
|
+
</tbody>
|
28
|
+
</table>
|
29
|
+
<% end %>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<h3>Sphinx Usage</h3>
|
2
|
+
<table id="Sphinx_usage">
|
3
|
+
<tr>
|
4
|
+
<th>Total Calls</th>
|
5
|
+
<td><%= stats.calls %></td>
|
6
|
+
|
7
|
+
<th>Total Time</th>
|
8
|
+
<td><%= stats.display_time %></td>
|
9
|
+
</tr>
|
10
|
+
</table>
|
11
|
+
|
12
|
+
<% if stats.queries.any? %>
|
13
|
+
<h3>Breakdown</h3>
|
14
|
+
<table id="Sphinx_breakdown">
|
15
|
+
<thead>
|
16
|
+
<tr>
|
17
|
+
<th>Time (ms)</th>
|
18
|
+
<th>Command</th>
|
19
|
+
</tr>
|
20
|
+
</thead>
|
21
|
+
<tbody>
|
22
|
+
<% i = 1 %>
|
23
|
+
<% stats.queries.each do |query| %>
|
24
|
+
<tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
|
25
|
+
<td><%= query.display_time %></td>
|
26
|
+
<td><%= query.command %></td>
|
27
|
+
</tr>
|
28
|
+
<% i += 1 %>
|
29
|
+
<% end %>
|
30
|
+
</tbody>
|
31
|
+
</table>
|
32
|
+
<% end %>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<h3>SQL Queries</h3>
|
2
|
+
<table class="sortable">
|
3
|
+
<thead>
|
4
|
+
<tr>
|
5
|
+
<th class="time">Time (ms)</th>
|
6
|
+
<th class="query">Query</th>
|
7
|
+
<th class="backtrace"></th>
|
8
|
+
<th class="actions"></th>
|
9
|
+
</tr>
|
10
|
+
</thead>
|
11
|
+
<tbody>
|
12
|
+
<% i = 1 %>
|
13
|
+
<% queries.each do |query| %>
|
14
|
+
<tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
|
15
|
+
<td><%= query.human_time %></td>
|
16
|
+
<td class="syntax"><%= query.sql %></td>
|
17
|
+
<td>
|
18
|
+
<% if query.has_backtrace? %>
|
19
|
+
<a href="#" class="reveal_backtrace">Show Backtrace</a>
|
20
|
+
<% end %>
|
21
|
+
</td>
|
22
|
+
<td>
|
23
|
+
<% if query.inspectable? %>
|
24
|
+
<a href="/__rack_bug__/execute_sql?<%= signed_params("query" => query.sql, "time" => query.time) %>" class="remote_call">SELECT</a> |
|
25
|
+
<a href="/__rack_bug__/explain_sql?<%= signed_params("query" => query.sql, "time" => query.time) %>" class="remote_call">EXPLAIN</a> |
|
26
|
+
<a href="/__rack_bug__/profile_sql?<%= signed_params("query" => query.sql, "time" => query.time) %>" class="remote_call">Profile</a>
|
27
|
+
<% end %>
|
28
|
+
</td>
|
29
|
+
</tr>
|
30
|
+
<tr style="display:none">
|
31
|
+
<td></td>
|
32
|
+
<td colspan="3">
|
33
|
+
<ul>
|
34
|
+
<% query.filtered_backtrace.each do |line| %>
|
35
|
+
<li><%=h line %></li>
|
36
|
+
<% end %>
|
37
|
+
</ul>
|
38
|
+
</td>
|
39
|
+
</tr>
|
40
|
+
<% i += 1 %>
|
41
|
+
<% end %>
|
42
|
+
</tbody>
|
43
|
+
</table>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<h3>Resource Usage</h3>
|
2
|
+
<table class="sortable">
|
3
|
+
<thead>
|
4
|
+
<tr>
|
5
|
+
<th>Key</th>
|
6
|
+
<th>Value</th>
|
7
|
+
</tr>
|
8
|
+
</thead>
|
9
|
+
<tbody>
|
10
|
+
<% i = 1 %>
|
11
|
+
<% measurements.each do |key, val| %>
|
12
|
+
<tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
|
13
|
+
<td><%=h key %></td>
|
14
|
+
<td><%=h val %></td>
|
15
|
+
</tr>
|
16
|
+
<% i += 1 %>
|
17
|
+
<% end %>
|
18
|
+
</tbody>
|
19
|
+
</table>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<a class="back" href="">« Back</a>
|
2
|
+
|
3
|
+
<h3>Cache Read</h3>
|
4
|
+
|
5
|
+
<dl>
|
6
|
+
<dt>Key</dt>
|
7
|
+
<dd><pre><%=h key %></pre></dd>
|
8
|
+
|
9
|
+
<dt>Time</dt>
|
10
|
+
<dd><%=h "%.2f" % (0.0 * 1_000) %>ms</dd>
|
11
|
+
</dl>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<% if value.is_a?(String )%>
|
15
|
+
<%=h value %>
|
16
|
+
<% else %>
|
17
|
+
<%=h value.inspect %>
|
18
|
+
<% end %>
|
19
|
+
</p>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
</head>
|
4
|
+
<body>
|
5
|
+
<h1>Redirect</h1>
|
6
|
+
|
7
|
+
<p>Location: <a href="<%= redirect_to %>"><%= redirect_to %></a></p>
|
8
|
+
|
9
|
+
<p class="notice">
|
10
|
+
Rack::Bug has intercepted a redirect to the above URL for debug viewing
|
11
|
+
purposes. You can click the above link to continue with the redirect as
|
12
|
+
normal. If you'd like to disable this feature, set the Rack::Bug
|
13
|
+
<code>internal_redirects</code> option to <code>false</code>.
|
14
|
+
</p>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<script type="text/javascript" charset="utf-8">
|
2
|
+
if (typeof jQuery == 'undefined') {
|
3
|
+
var jquery_url = '/__rack_bug__/jquery-1.3.2.js';
|
4
|
+
document.write(unescape('%3Cscript src="' + jquery_url + '" type="text/javascript"%3E%3C/script%3E'));
|
5
|
+
}
|
6
|
+
</script>
|
7
|
+
<script type="text/javascript" src="/__rack_bug__/jquery.tablesorter.min.js"></script>
|
8
|
+
<script type="text/javascript" src="/__rack_bug__/bug.js"></script>
|
9
|
+
<style type="text/css" media="screen">
|
10
|
+
@import url(/__rack_bug__/bug.css);
|
11
|
+
</style>
|
12
|
+
|
13
|
+
<div id="rack_bug" class="rb_top">
|
14
|
+
<div id="rack_bug_toolbar">
|
15
|
+
<ul class="panels">
|
16
|
+
<li id="rb_debug_button">Rack::Bug</li>
|
17
|
+
|
18
|
+
<% panels.each do |panel| %>
|
19
|
+
<li>
|
20
|
+
<% if panel.has_content? %>
|
21
|
+
<a href="#" class="<%= panel.name %>">
|
22
|
+
<%= panel.heading %>
|
23
|
+
</a>
|
24
|
+
<% else %>
|
25
|
+
<%= panel.heading %>
|
26
|
+
<% end %>
|
27
|
+
</li>
|
28
|
+
<% end %>
|
29
|
+
</ul>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<% panels.each do |panel| %>
|
33
|
+
<% if panel.has_content? %>
|
34
|
+
<div class="panel_content" id="<%= panel.name %>">
|
35
|
+
<a href="" class="rack_bug_close">Close</a>
|
36
|
+
<%= panel.content %>
|
37
|
+
</div>
|
38
|
+
<% end %>
|
39
|
+
<% end %>
|
40
|
+
|
41
|
+
<div id="rack_bug_debug_window" class="panel_content"></div>
|
42
|
+
</div>
|
data/rack-bug.gemspec
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{ghazel-rack-bug}
|
5
|
+
s.version = "0.3.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Bryan Helmkamp"]
|
9
|
+
s.date = %q{2010-09-03}
|
10
|
+
s.email = %q{bryan@brynary.com}
|
11
|
+
s.extra_rdoc_files = [
|
12
|
+
"README.md",
|
13
|
+
"MIT-LICENSE.txt"
|
14
|
+
]
|
15
|
+
s.files = [
|
16
|
+
".gitignore",
|
17
|
+
"History.txt",
|
18
|
+
"MIT-LICENSE.txt",
|
19
|
+
"README.md",
|
20
|
+
"Rakefile",
|
21
|
+
"Thorfile",
|
22
|
+
"lib/rack/bug.rb",
|
23
|
+
"lib/rack/bug/autoloading.rb",
|
24
|
+
"lib/rack/bug/filtered_backtrace.rb",
|
25
|
+
"lib/rack/bug/options.rb",
|
26
|
+
"lib/rack/bug/panel.rb",
|
27
|
+
"lib/rack/bug/panel_app.rb",
|
28
|
+
"lib/rack/bug/panels/active_record_panel.rb",
|
29
|
+
"lib/rack/bug/panels/active_record_panel/activerecord_extensions.rb",
|
30
|
+
"lib/rack/bug/panels/cache_panel.rb",
|
31
|
+
"lib/rack/bug/panels/cache_panel/dalli_extension.rb",
|
32
|
+
"lib/rack/bug/panels/cache_panel/memcache_extension.rb",
|
33
|
+
"lib/rack/bug/panels/cache_panel/panel_app.rb",
|
34
|
+
"lib/rack/bug/panels/cache_panel/stats.rb",
|
35
|
+
"lib/rack/bug/panels/log_panel.rb",
|
36
|
+
"lib/rack/bug/panels/log_panel/logger_extension.rb",
|
37
|
+
"lib/rack/bug/panels/memory_panel.rb",
|
38
|
+
"lib/rack/bug/panels/rails_info_panel.rb",
|
39
|
+
"lib/rack/bug/panels/redis_panel.rb",
|
40
|
+
"lib/rack/bug/panels/redis_panel/redis_extension.rb",
|
41
|
+
"lib/rack/bug/panels/redis_panel/stats.rb",
|
42
|
+
"lib/rack/bug/panels/request_variables_panel.rb",
|
43
|
+
"lib/rack/bug/panels/sphinx_panel.rb",
|
44
|
+
"lib/rack/bug/panels/sphinx_panel/sphinx_extension.rb",
|
45
|
+
"lib/rack/bug/panels/sphinx_panel/stats.rb",
|
46
|
+
"lib/rack/bug/panels/sql_panel.rb",
|
47
|
+
"lib/rack/bug/panels/sql_panel/panel_app.rb",
|
48
|
+
"lib/rack/bug/panels/sql_panel/query.rb",
|
49
|
+
"lib/rack/bug/panels/sql_panel/sql_extension.rb",
|
50
|
+
"lib/rack/bug/panels/templates_panel.rb",
|
51
|
+
"lib/rack/bug/panels/templates_panel/actionview_extension.rb",
|
52
|
+
"lib/rack/bug/panels/templates_panel/rendering.rb",
|
53
|
+
"lib/rack/bug/panels/templates_panel/trace.rb",
|
54
|
+
"lib/rack/bug/panels/timer_panel.rb",
|
55
|
+
"lib/rack/bug/params_signature.rb",
|
56
|
+
"lib/rack/bug/public/__rack_bug__/bookmarklet.html",
|
57
|
+
"lib/rack/bug/public/__rack_bug__/bookmarklet.js",
|
58
|
+
"lib/rack/bug/public/__rack_bug__/bug.css",
|
59
|
+
"lib/rack/bug/public/__rack_bug__/bug.js",
|
60
|
+
"lib/rack/bug/public/__rack_bug__/jquery-1.3.2.js",
|
61
|
+
"lib/rack/bug/public/__rack_bug__/jquery.tablesorter.min.js",
|
62
|
+
"lib/rack/bug/public/__rack_bug__/spinner.gif",
|
63
|
+
"lib/rack/bug/rack_static_bug_avoider.rb",
|
64
|
+
"lib/rack/bug/redirect_interceptor.rb",
|
65
|
+
"lib/rack/bug/render.rb",
|
66
|
+
"lib/rack/bug/toolbar.rb",
|
67
|
+
"lib/rack/bug/views/error.html.erb",
|
68
|
+
"lib/rack/bug/views/panels/active_record.html.erb",
|
69
|
+
"lib/rack/bug/views/panels/cache.html.erb",
|
70
|
+
"lib/rack/bug/views/panels/execute_sql.html.erb",
|
71
|
+
"lib/rack/bug/views/panels/explain_sql.html.erb",
|
72
|
+
"lib/rack/bug/views/panels/log.html.erb",
|
73
|
+
"lib/rack/bug/views/panels/profile_sql.html.erb",
|
74
|
+
"lib/rack/bug/views/panels/rails_info.html.erb",
|
75
|
+
"lib/rack/bug/views/panels/redis.html.erb",
|
76
|
+
"lib/rack/bug/views/panels/request_variables.html.erb",
|
77
|
+
"lib/rack/bug/views/panels/sphinx.html.erb",
|
78
|
+
"lib/rack/bug/views/panels/sql.html.erb",
|
79
|
+
"lib/rack/bug/views/panels/templates.html.erb",
|
80
|
+
"lib/rack/bug/views/panels/timer.html.erb",
|
81
|
+
"lib/rack/bug/views/panels/view_cache.html.erb",
|
82
|
+
"lib/rack/bug/views/redirect.html.erb",
|
83
|
+
"lib/rack/bug/views/toolbar.html.erb",
|
84
|
+
"rack-bug.gemspec",
|
85
|
+
"spec/fixtures/config.ru",
|
86
|
+
"spec/fixtures/dummy_panel.rb",
|
87
|
+
"spec/fixtures/sample_app.rb",
|
88
|
+
"spec/rack/bug/panels/active_record_panel_spec.rb",
|
89
|
+
"spec/rack/bug/panels/cache_panel_spec.rb",
|
90
|
+
"spec/rack/bug/panels/log_panel_spec.rb",
|
91
|
+
"spec/rack/bug/panels/memory_panel_spec.rb",
|
92
|
+
"spec/rack/bug/panels/rails_info_panel_spec.rb",
|
93
|
+
"spec/rack/bug/panels/redis_panel_spec.rb",
|
94
|
+
"spec/rack/bug/panels/sql_panel_spec.rb",
|
95
|
+
"spec/rack/bug/panels/templates_panel_spec.rb",
|
96
|
+
"spec/rack/bug/panels/timer_panel_spec.rb",
|
97
|
+
"spec/rack/bug_spec.rb",
|
98
|
+
"spec/rcov.opts",
|
99
|
+
"spec/spec.opts",
|
100
|
+
"spec/spec_helper.rb"
|
101
|
+
]
|
102
|
+
s.homepage = %q{http://github.com/brynary/rack-bug}
|
103
|
+
s.require_paths = ["lib"]
|
104
|
+
s.rubyforge_project = %q{rack-bug}
|
105
|
+
s.rubygems_version = %q{1.3.7}
|
106
|
+
s.summary = %q{Debugging toolbar for Rack applications implemented as middleware}
|
107
|
+
s.test_files = [
|
108
|
+
"spec/fixtures/dummy_panel.rb",
|
109
|
+
"spec/fixtures/sample_app.rb",
|
110
|
+
"spec/rack/bug/panels/active_record_panel_spec.rb",
|
111
|
+
"spec/rack/bug/panels/cache_panel_spec.rb",
|
112
|
+
"spec/rack/bug/panels/log_panel_spec.rb",
|
113
|
+
"spec/rack/bug/panels/memory_panel_spec.rb",
|
114
|
+
"spec/rack/bug/panels/rails_info_panel_spec.rb",
|
115
|
+
"spec/rack/bug/panels/redis_panel_spec.rb",
|
116
|
+
"spec/rack/bug/panels/sql_panel_spec.rb",
|
117
|
+
"spec/rack/bug/panels/templates_panel_spec.rb",
|
118
|
+
"spec/rack/bug/panels/timer_panel_spec.rb",
|
119
|
+
"spec/rack/bug_spec.rb",
|
120
|
+
"spec/spec_helper.rb"
|
121
|
+
]
|
122
|
+
|
123
|
+
if s.respond_to? :specification_version then
|
124
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
125
|
+
s.specification_version = 3
|
126
|
+
|
127
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
128
|
+
s.add_runtime_dependency(%q<rack>, [">= 1.0"])
|
129
|
+
s.add_development_dependency(%q<webrat>, [">= 0"])
|
130
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
131
|
+
s.add_development_dependency(%q<sinatra>, [">= 0"])
|
132
|
+
s.add_development_dependency(%q<git>, [">= 0"])
|
133
|
+
else
|
134
|
+
s.add_dependency(%q<rack>, [">= 1.0"])
|
135
|
+
s.add_dependency(%q<webrat>, [">= 0"])
|
136
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
137
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
138
|
+
s.add_dependency(%q<git>, [">= 0"])
|
139
|
+
end
|
140
|
+
else
|
141
|
+
s.add_dependency(%q<rack>, [">= 1.0"])
|
142
|
+
s.add_dependency(%q<webrat>, [">= 0"])
|
143
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
144
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
145
|
+
s.add_dependency(%q<git>, [">= 0"])
|
146
|
+
end
|
147
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib'
|
2
|
+
require "rack/bug"
|
3
|
+
|
4
|
+
require "sinatra/base"
|
5
|
+
require 'logger'
|
6
|
+
|
7
|
+
RAILS_ENV = "development" unless defined?(RAILS_ENV)
|
8
|
+
log_to = RAILS_ENV == "test" ? StringIO.new : STDOUT
|
9
|
+
LOGGER = Logger.new(log_to)
|
10
|
+
|
11
|
+
class SampleApp < Sinatra::Base
|
12
|
+
use Rack::Bug#, :intercept_redirects => true, :password => 'secret'
|
13
|
+
set :environment, 'test'
|
14
|
+
|
15
|
+
configure :test do
|
16
|
+
set :raise_errors, true
|
17
|
+
end
|
18
|
+
|
19
|
+
get "/redirect" do
|
20
|
+
redirect "/"
|
21
|
+
end
|
22
|
+
|
23
|
+
get "/error" do
|
24
|
+
raise "Error!"
|
25
|
+
end
|
26
|
+
|
27
|
+
get "/" do
|
28
|
+
if params[:content_type]
|
29
|
+
headers["Content-Type"] = params[:content_type]
|
30
|
+
end
|
31
|
+
LOGGER.error "I am a log message"
|
32
|
+
<<-HTML
|
33
|
+
<html>
|
34
|
+
<head>
|
35
|
+
</head>
|
36
|
+
<body>
|
37
|
+
<p>Hello</p>
|
38
|
+
<p><a href="__rack_bug__/bookmarklet.html">Page with bookmarklet for enabling Rack::Bug</a></p>
|
39
|
+
<p><a href="/redirect">Page with a redirect - turn on intercept_redirects to see Rack::Bug catch it</a></p>
|
40
|
+
<p><a href="/error">Page with an error to check rack-bug not rescuing errors</a></p>
|
41
|
+
</body>
|
42
|
+
</html>
|
43
|
+
HTML
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|