rack-webprofiler 0.1.0.pre.beta1 → 0.1.0.pre.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +7 -17
- data/lib/rack/templates/assets/css/profiler.css +1 -1
- data/lib/rack/templates/assets/css/rwpt.css +1 -1
- data/lib/rack/templates/assets/sass/_highlight.scss +63 -0
- data/lib/rack/templates/assets/sass/_variables.scss +1 -0
- data/lib/rack/templates/assets/sass/profiler.scss +1 -1
- data/lib/rack/templates/assets/sass/rwpt.scss +27 -9
- data/lib/rack/templates/async.erb +8 -8
- data/lib/rack/templates/panel/_sidebar.erb +3 -23
- data/lib/rack/templates/panel/index.erb +18 -6
- data/lib/rack/templates/panel/layout.erb +9 -5
- data/lib/rack/templates/panel/show.erb +25 -7
- data/lib/rack/templates/profiler.erb +15 -12
- data/lib/rack/web_profiler/collector/rack/request_collector.rb +38 -35
- data/lib/rack/web_profiler/collector/ruby_collector.rb +9 -7
- data/lib/rack/web_profiler/collector/time_collector.rb +2 -2
- data/lib/rack/web_profiler/collector/view.rb +44 -0
- data/lib/rack/web_profiler/collector.rb +29 -16
- data/lib/rack/web_profiler/config.rb +0 -10
- data/lib/rack/web_profiler/controller.rb +69 -64
- data/lib/rack/web_profiler/engine.rb +15 -6
- data/lib/rack/web_profiler/model/collection_record.rb +1 -0
- data/lib/rack/web_profiler/request.rb +5 -1
- data/lib/rack/web_profiler/router.rb +1 -1
- data/lib/rack/web_profiler/version.rb +1 -1
- data/lib/rack/web_profiler/view.rb +236 -0
- data/lib/rack/web_profiler.rb +34 -17
- data/rack-webprofiler.gemspec +1 -0
- metadata +19 -10
- data/lib/rack/web_profiler/auto_configure/rails.rb +0 -12
- data/lib/rack/web_profiler/collector/rails/active_record_collector.rb +0 -25
- data/lib/rack/web_profiler/collector/rails/logger_collector.rb +0 -22
- data/lib/rack/web_profiler/collector/rails/rails_collector.rb +0 -25
- data/lib/rack/web_profiler/collector/rails/request_collector.rb +0 -50
- data/lib/rack/web_profiler/collector/sinatra/request_collector.rb +0 -216
- data/lib/rack/web_profiler/collector/sinatra/sinatra_collector.rb +0 -25
- data/lib/rack/web_profiler/erb.rb +0 -9
@@ -1,216 +0,0 @@
|
|
1
|
-
module Rack
|
2
|
-
class WebProfiler::Collector::Sinatra::RequestCollector < WebProfiler::Collector::Rack::RequestCollector
|
3
|
-
include Rack::WebProfiler::Collector::DSL
|
4
|
-
|
5
|
-
icon <<-'ICON'
|
6
|
-
data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+ICAgICAgICA8dGl0bGU+T3ZhbCA3IENvcHkgMjwvdGl0bGU+ICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPiAgICA8ZGVmcz48L2RlZnM+ICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPiAgICAgICAgPGcgaWQ9IkRlc2t0b3AtMiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEwLjAwMDAwMCwgLTEzMC4wMDAwMDApIiBmaWxsPSIjNTg1NDczIj4gICAgICAgICAgICA8ZyBpZD0iUmVxdWVzdCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMC4wMDAwMDAsIDEyMC4wMDAwMDApIj4gICAgICAgICAgICAgICAgPHBhdGggZD0iTTE3LjY3OTE5MTIsMTMuNDA2NDMyMiBDMTguMTAzNzAxMiwxMy4yNTUzNzMzIDE4LjU0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zUgTDExLjIzMzU5NzgsMTUuMTMxNjE3OSBMMTIuMzc1MjA4LDEzLjUwMTIyOTYgTDE0Ljg4NjQwMTgsMTUuMjU5NTg2NCBDMTUuMTk5NDA5NywxNC45MTg5MDYzIDE1LjU0NTU0OCwxNC42MDk1NjU1IDE1LjkxOTY1OTMsMTQuMzM2NzU5NiBMMTQuNDc2MDk4NSwxMS42MjE4MTY1IEwxNi4yMzM0NjE0LDEwLjY4NzQxIEwxNy42NzkxOTEyLDEzLjQwNjQzMjIgWiBNMjAsMjMuMDMyNzYxMiBDMjEuNjQ4ODQ4OSwyMy4wMzI3NjEyIDIyLjk4NTUwNSwyMS42ODYyMzA2IDIyLjk4NTUwNSwyMC4wMjUyMDA5IEMyMi45ODU1MDUsMTguMzY0MTcxMyAyMS42NDg4NDg5LDE3LjAxNzY0MDYgMjAsMTcuMDE3NjQwNiBDMTguMzUxMTUxMSwxNy4wMTc2NDA2IDE3LjAxNDQ5NSwxOC4zNjQxNzEzIDE3LjAxNDQ5NSwyMC4wMjUyMDA5IEMxNy4wMTQ0OTUsMjEuNjg2MjMwNiAxOC4zNTExNTExLDIzLjAzMjc2MTIgMjAsMjMuMDMyNzYxMiBaIiBpZD0iT3ZhbC03LUNvcHktMiI+PC9wYXRoPiAgICAgICAgICAgIDwvZz4gICAgICAgIDwvZz4gICAgPC9nPjwvc3ZnPg==
|
7
|
-
ICON
|
8
|
-
|
9
|
-
collector_name "sinatra_request"
|
10
|
-
position 2
|
11
|
-
|
12
|
-
collect do |request, response|
|
13
|
-
store :request_headers, get_request_headers(request)
|
14
|
-
store :request_path, request.path
|
15
|
-
store :request_method, request.request_method
|
16
|
-
store :request_cookies, request.cookies
|
17
|
-
store :request_get, request.GET
|
18
|
-
store :request_post, request.POST
|
19
|
-
store :request_session, request.session
|
20
|
-
store :request_cookies, request.cookies
|
21
|
-
store :request_body, request.body.gets
|
22
|
-
|
23
|
-
# store :rack_env, get_env(request) #request.env.each { |k, v| v.to_s }
|
24
|
-
|
25
|
-
store :response_status, response.status
|
26
|
-
store :response_headers, response.headers
|
27
|
-
|
28
|
-
if response.successful?
|
29
|
-
status :success
|
30
|
-
elsif response.redirection?
|
31
|
-
status :warning
|
32
|
-
else
|
33
|
-
status :error
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
template __FILE__, type: :DATA
|
38
|
-
|
39
|
-
is_enabled? -> { defined? Sinatra }
|
40
|
-
|
41
|
-
class << self
|
42
|
-
# Get request headers.
|
43
|
-
#
|
44
|
-
# @return [Hash]
|
45
|
-
def get_request_headers(request)
|
46
|
-
request.env.select {|k,v| k.start_with? 'HTTP_'}
|
47
|
-
.collect {|k,v| [k.sub(/^HTTP_/, ''), v]}
|
48
|
-
.collect {|k,v| [k.split('_').collect(&:capitalize).join('-'), v]}
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
__END__
|
55
|
-
<% content_for :tab do %>
|
56
|
-
<%= data[:response_status] %>
|
57
|
-
<div style="display: none">
|
58
|
-
<%= data[:request_method] %> <%= data[:request_path] %>
|
59
|
-
<%= data[:response_status] %> | <%= Rack::Utils::HTTP_STATUS_CODES[data[:response_status].to_i] %>
|
60
|
-
</div>
|
61
|
-
<% end %>
|
62
|
-
|
63
|
-
<% content_for :panel do %>
|
64
|
-
<div class="block">
|
65
|
-
<h3>GET</h3>
|
66
|
-
<% unless data[:request_get].empty? %>
|
67
|
-
<table>
|
68
|
-
<thead>
|
69
|
-
<tr>
|
70
|
-
<th>Key</th>
|
71
|
-
<th>Value</th>
|
72
|
-
</tr>
|
73
|
-
<thead>
|
74
|
-
<tbody>
|
75
|
-
<% data[:request_get].each do |k, v| %>
|
76
|
-
<tr>
|
77
|
-
<th><%= k %></th>
|
78
|
-
<td class="code"><%= v %></td>
|
79
|
-
</tr>
|
80
|
-
<% end %>
|
81
|
-
</tbody>
|
82
|
-
</table>
|
83
|
-
<% else %>
|
84
|
-
<p><span class="text__no-value">No GET parameters</span></p>
|
85
|
-
<% end %>
|
86
|
-
</div>
|
87
|
-
|
88
|
-
<div class="block">
|
89
|
-
<h3>POST</h3>
|
90
|
-
<% unless data[:request_post].empty? %>
|
91
|
-
<table>
|
92
|
-
<thead>
|
93
|
-
<tr>
|
94
|
-
<th>Key</th>
|
95
|
-
<th>Value</th>
|
96
|
-
</tr>
|
97
|
-
<thead>
|
98
|
-
<tbody>
|
99
|
-
<% data[:request_post].each do |k, v| %>
|
100
|
-
<tr>
|
101
|
-
<th><%= k %></th>
|
102
|
-
<td class="code"><%= v %></td>
|
103
|
-
</tr>
|
104
|
-
<% end %>
|
105
|
-
</tbody>
|
106
|
-
</table>
|
107
|
-
<% else %>
|
108
|
-
<p><span class="text__no-value">No POST parameters</span></p>
|
109
|
-
<% end %>
|
110
|
-
</div>
|
111
|
-
|
112
|
-
<div class="block">
|
113
|
-
<h3>Request headers</h3>
|
114
|
-
<% unless data[:request_headers].empty? %>
|
115
|
-
<table>
|
116
|
-
<thead>
|
117
|
-
<tr>
|
118
|
-
<th>Name</th>
|
119
|
-
<th>Version</th>
|
120
|
-
</tr>
|
121
|
-
<thead>
|
122
|
-
<tbody>
|
123
|
-
<% data[:request_headers].sort.each do |k, v| %>
|
124
|
-
<tr>
|
125
|
-
<th><%= k %></th>
|
126
|
-
<td class="code"><%= v %></td>
|
127
|
-
</tr>
|
128
|
-
<% end %>
|
129
|
-
</tbody>
|
130
|
-
</table>
|
131
|
-
<% else %>
|
132
|
-
<p><span class="text__no-value">No request headers</span></p>
|
133
|
-
<% end %>
|
134
|
-
</div>
|
135
|
-
|
136
|
-
<div class="block">
|
137
|
-
<h3>Request content</h3>
|
138
|
-
<% unless data[:request_body].nil? %>
|
139
|
-
<code><%= data[:request_body] %></code>
|
140
|
-
<% else %>
|
141
|
-
<p><span class="text__no-value">No request content</span></p>
|
142
|
-
<% end %>
|
143
|
-
</div>
|
144
|
-
|
145
|
-
<div class="block">
|
146
|
-
<h3>Response headers</h3>
|
147
|
-
<% unless data[:response_headers].empty? %>
|
148
|
-
<table>
|
149
|
-
<thead>
|
150
|
-
<tr>
|
151
|
-
<th>Name</th>
|
152
|
-
<th>Version</th>
|
153
|
-
</tr>
|
154
|
-
<thead>
|
155
|
-
<tbody>
|
156
|
-
<% data[:response_headers].sort.each do |k, v| %>
|
157
|
-
<tr>
|
158
|
-
<th><%= k %></th>
|
159
|
-
<td class="code"><%= v %></td>
|
160
|
-
</tr>
|
161
|
-
<% end %>
|
162
|
-
</tbody>
|
163
|
-
</table>
|
164
|
-
<% else %>
|
165
|
-
<p><span class="text__no-value">No response headers</span></p>
|
166
|
-
<% end %>
|
167
|
-
</div>
|
168
|
-
|
169
|
-
<div class="block">
|
170
|
-
<h3>Session</h3>
|
171
|
-
<% unless data[:request_session].empty? %>
|
172
|
-
<table>
|
173
|
-
<thead>
|
174
|
-
<tr>
|
175
|
-
<th>Name</th>
|
176
|
-
<th>Version</th>
|
177
|
-
</tr>
|
178
|
-
<thead>
|
179
|
-
<tbody>
|
180
|
-
<% data[:request_session].each do |k, v| %>
|
181
|
-
<tr>
|
182
|
-
<th><%= k %></th>
|
183
|
-
<td class="code"><%= v %></td>
|
184
|
-
</tr>
|
185
|
-
<% end %>
|
186
|
-
</tbody>
|
187
|
-
</table>
|
188
|
-
<% else %>
|
189
|
-
<p><span class="text__no-value">No session data</span></p>
|
190
|
-
<% end %>
|
191
|
-
</div>
|
192
|
-
|
193
|
-
<div class="block">
|
194
|
-
<h3>Cookies</h3>
|
195
|
-
<% unless data[:request_cookies].empty? %>
|
196
|
-
<table>
|
197
|
-
<thead>
|
198
|
-
<tr>
|
199
|
-
<th>Name</th>
|
200
|
-
<th>Version</th>
|
201
|
-
</tr>
|
202
|
-
<thead>
|
203
|
-
<tbody>
|
204
|
-
<% data[:request_cookies].each do |k, v| %>
|
205
|
-
<tr>
|
206
|
-
<th><%= k %></th>
|
207
|
-
<td class="code"><%= v %></td>
|
208
|
-
</tr>
|
209
|
-
<% end %>
|
210
|
-
</tbody>
|
211
|
-
</table>
|
212
|
-
<% else %>
|
213
|
-
<p><span class="text__no-value">No cookies data</span></p>
|
214
|
-
<% end %>
|
215
|
-
</div>
|
216
|
-
<% end %>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module Rack
|
2
|
-
class WebProfiler::Collector::Sinatra::SinatraCollector
|
3
|
-
include Rack::WebProfiler::Collector::DSL
|
4
|
-
|
5
|
-
icon nil
|
6
|
-
|
7
|
-
collector_name "sinatra"
|
8
|
-
position 1
|
9
|
-
|
10
|
-
collect do |_request, _response|
|
11
|
-
store :sinatra_version, Sinatra::VERSION
|
12
|
-
store :sinatra_env, Sinatra::Base.environment
|
13
|
-
store :sinatra_doc_url, "http://www.sinatrarb.com/documentation.html"
|
14
|
-
end
|
15
|
-
|
16
|
-
template __FILE__, type: :DATA
|
17
|
-
|
18
|
-
is_enabled? -> { defined? Sinatra }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
__END__
|
23
|
-
<% content_for :tab do %>
|
24
|
-
<%= data[:sinatra_version] %> | <%= data[:sinatra_env] %>
|
25
|
-
<% end %>
|