rack-webprofiler 0.1.0.pre.alpha1 → 0.1.0.pre.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +13 -5
  2. data/README.md +2 -0
  3. data/lib/rack/templates/assets/css/profiler.css +1 -0
  4. data/lib/rack/templates/assets/css/rwpt.css +1 -0
  5. data/lib/rack/templates/assets/sass/_fonts.scss +60 -0
  6. data/lib/rack/templates/assets/sass/_normalize.scss +4 -0
  7. data/lib/rack/templates/assets/sass/_variables.scss +11 -0
  8. data/lib/rack/templates/assets/sass/profiler.scss +186 -0
  9. data/lib/rack/templates/assets/sass/rwpt.scss +266 -0
  10. data/lib/rack/templates/panel/_sidebar.erb +36 -0
  11. data/lib/rack/templates/panel/index.erb +26 -28
  12. data/lib/rack/templates/panel/layout.erb +23 -7
  13. data/lib/rack/templates/panel/show.erb +6 -17
  14. data/lib/rack/templates/profiler.erb +12 -58
  15. data/lib/rack/web_profiler/auto_configure/rails.rb +1 -1
  16. data/lib/rack/web_profiler/collector/rack/request_collector.rb +221 -5
  17. data/lib/rack/web_profiler/collector/ruby_collector.rb +39 -3
  18. data/lib/rack/web_profiler/collector/sinatra/request_collector.rb +186 -8
  19. data/lib/rack/web_profiler/collector/sinatra/sinatra_collector.rb +2 -2
  20. data/lib/rack/web_profiler/collector/time_collector.rb +5 -3
  21. data/lib/rack/web_profiler/collector.rb +5 -4
  22. data/lib/rack/web_profiler/collectors.rb +10 -2
  23. data/lib/rack/web_profiler/controller.rb +25 -4
  24. data/lib/rack/web_profiler/router.rb +40 -5
  25. data/lib/rack/web_profiler/version.rb +1 -1
  26. data/rack-webprofiler.gemspec +7 -2
  27. metadata +30 -38
  28. data/.editorconfig +0 -27
  29. data/.gitignore +0 -11
  30. data/.rspec +0 -2
  31. data/.rubocop.yml +0 -34
  32. data/.travis.yml +0 -23
  33. data/Gemfile +0 -15
  34. data/Rakefile +0 -17
  35. data/bin/ci-prepare +0 -16
  36. data/bin/console +0 -10
  37. data/bin/setup +0 -8
  38. data/examples/README.md +0 -56
  39. data/examples/rack/config.ru +0 -52
  40. data/examples/sinatra/app.rb +0 -37
  41. data/examples/sinatra/config.ru +0 -3
  42. data/lib/rack/templates/assets/rwpt.css +0 -9
  43. /data/lib/rack/templates/assets/{rwpt.js → js/rwpt.js} +0 -0
  44. /data/{.rubocop_todo.yml → lib/rack/templates/assets/js/rwpt.min.js} +0 -0
@@ -1,29 +1,27 @@
1
- # TODO list the 20 lastest requests
2
1
 
3
- <table>
4
- <thead>
5
- <tr>
6
- <th>token</th>
7
- <th>method</th>
8
- <th>status</th>
9
- <th>url</th>
10
- <th>ip</th>
11
- <th>date</th>
12
- </tr>
13
- </thead>
14
- <tbody>
15
- <% @collections.each do |r| %>
16
- <tr>
17
- <td><a href="<%= WebProfiler::Router.url_for_profiler(r.token) %>"><%= r.token %></a></td>
18
- <td><%= r.http_method %></td>
19
- <td><%= r.http_status %></td>
20
- <td><%= r.url %></td>
21
- <td><%= r.ip %></td>
22
- <td><span title="<%= r.created_at %>"><%= r.created_at.strftime('%Y-%m-%d %H:%M:%S') %></span></td>
23
- </tr>
24
- <% end %>
25
- </tbody>
26
- </table>
27
-
28
-
29
- <a href="<%= WebProfiler::Router.url_for_clean_profiler %>">Cleanup database</a>
2
+ <div class="block">
3
+ <table>
4
+ <thead>
5
+ <tr>
6
+ <th>token</th>
7
+ <th>method</th>
8
+ <th>status</th>
9
+ <th>url</th>
10
+ <th>ip</th>
11
+ <th>date</th>
12
+ </tr>
13
+ </thead>
14
+ <tbody>
15
+ <% @collections.each do |r| %>
16
+ <tr>
17
+ <td><a href="<%= WebProfiler::Router.url_for_profiler(r.token) %>"><%= r.token %></a></td>
18
+ <td><%= r.http_method %></td>
19
+ <td><%= r.http_status %></td>
20
+ <td><%= r.url %></td>
21
+ <td><%= r.ip %></td>
22
+ <td><span title="<%= r.created_at %>"><%= r.created_at.strftime('%Y-%m-%d %H:%M:%S') %></span></td>
23
+ </tr>
24
+ <% end %>
25
+ </tbody>
26
+ </table>
27
+ </div>
@@ -2,16 +2,32 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Rack WebProfiler</title>
5
- <style>
6
- <%= partial 'assets/rwpt.css' %>
7
- </style>
8
- <script type="text/javascript">
9
- <%= partial 'assets/rwpt.js' %>
10
- </script>
5
+ <link rel="stylesheet" href="<%= WebProfiler::Router.url_for_asset('css/rwpt.css') %>" />
11
6
  </head>
12
7
  <body>
8
+ <div id="rack-webprofiler">
9
+ <%= partial 'panel/_sidebar.erb' %>
13
10
 
14
- <%= yield %>
11
+ <main id="main">
12
+ <header id="header">
13
+ <div class="header__section">
14
+ <span><a href="<%= !@collection.nil? ? @collection.url : nil %>"><%= !@collection.nil? ? @collection.url : nil %></a></span>
15
+ </div>
16
+ <div class="header__section header__section--blank"></div>
17
+ </header>
15
18
 
19
+ <div id="wrapper">
20
+ <div class="wrapper__container">
21
+ <%= yield %>
22
+ </div>
23
+ </div>
24
+ </main>
25
+ </div>
26
+
27
+ <script src="<%= WebProfiler::Router.url_for_asset('js/rwpt.min.js') %>"></script>
28
+
29
+ <% unless @collection.nil? %>
30
+ <%= partial 'profiler.erb' %>
31
+ <% end %>
16
32
  </body>
17
33
  </html>
@@ -1,19 +1,8 @@
1
- <%= partial 'profiler.erb' %>
2
-
3
- <% @collection.datas.each do |name, datas| %>
1
+ <%
2
+ datas = @collection.datas
3
+ token = @collection.token
4
+ %>
4
5
  <div class="">
5
- <h2><%= name %></h2>
6
-
7
- <table>
8
- <% datas[:datas].each do |k, v| %>
9
- <tr>
10
- <th><%= k %></th>
11
- <td><%= v.inspect %></td>
12
- </tr>
13
- <% end %>
14
- </table>
6
+ <% render_collector(@collector, datas[@collector.name.to_sym][:datas]) %>
7
+ <%= content_for :panel %>
15
8
  </div>
16
- <% end %>
17
-
18
-
19
- <a href="<%= WebProfiler::Router.url_for_profiler %>">All requests</a>
@@ -1,69 +1,23 @@
1
1
  <style>
2
- #rack-webprofiler {
3
- position: fixed;
4
- bottom: 0;
5
- left: 0;
6
- width: 100%;
7
- height: 40px;
8
-
9
- background-color: #1c1f33;
10
- color: #f3fcf0;
11
- font-family: "Helvetica Neue", Arial, sans-serif;
12
- font-size: 14px;
13
- }
14
-
15
- #rack-webprofiler * {
16
- margin: 0;
17
- padding: 0;
18
- }
19
-
20
- #rack-webprofiler .rack-webprofiler_collectors {
21
- height: 40px;
22
- }
23
-
24
- #rack-webprofiler .rack-webprofiler_collectors > .rack-webprofiler_collector {
25
- float: left;
26
- padding: 0 10px;
27
- border: 1px solid #282f4c;
28
- height: 38px;
29
- line-height: 40px;
30
- }
31
-
32
- #rack-webprofiler .rack-webprofiler_collectors .rack-webprofiler_collector img {
33
- width: 20px;
34
- height: 20px;
35
- position: relative;
36
- top: 4px;
37
- }
38
- #rack-webprofiler .rack-webprofiler_collectors .rack-webprofiler_collector.error,
39
- #rack-webprofiler .rack-webprofiler_collectors .rack-webprofiler_collector.success {
40
- height: 35px;
41
- border-bottom-style: solid;
42
- border-bottom-width: 4px;
43
- }
44
- #rack-webprofiler .rack-webprofiler_collectors .rack-webprofiler_collector.error {
45
- border-bottom-color: #ff2851;
46
- }
47
- #rack-webprofiler .rack-webprofiler_collectors .rack-webprofiler_collector.success {
48
- border-bottom-color: #44db5e;
49
- }
2
+ <%= partial 'assets/css/profiler.css' %>
50
3
  </style>
51
4
  <%
52
5
  datas = @collection.datas
53
6
  token = @collection.token
54
7
  %>
55
- <div id="rack-webprofiler">
56
- <div class="rack-webprofiler_collectors">
57
-
8
+ <div id="rack-webprofiler-bar" class="rack-webprofiler--long">
9
+ <div class="rack-webprofiler__wrapper">
58
10
  <% @collectors.each do |name, collector| %>
59
- <div class="rack-webprofiler_collector rack-webprofiler_collectors_<%= name %> <%= datas[name.to_sym][:status] %>">
60
- <% unless collector.icon.nil? %>
61
- <img alt="" src="<%= collector.icon %>" />
62
- <% end %>
11
+ <div class="rack-webprofiler__item rack-webprofiler_collectors_<%= name %>">
12
+ <a href="<%= WebProfiler::Router.url_for_profiler(token, name) %>">
13
+ <% unless collector.icon.nil? %>
14
+ <i class="icn"><img alt="" src="<%= collector.icon %>" /></i>
15
+ <% end %>
63
16
 
64
- <%= render_collector(collector.template, datas[name.to_sym][:datas]) %>
65
- <%#= yield :tab %>
66
- <a href="<%= WebProfiler::Router.url_for_profiler(token) %>">+</a>
17
+ <% render_collector(collector, datas[name.to_sym][:datas]) %>
18
+ <span class="rack-webprofiler__item__value"><%= content_for :tab %></span>
19
+ <span class="rack-webprofiler__item__status-color <%= datas[name.to_sym][:status] %>"></span>
20
+ </a>
67
21
  </div>
68
22
  <% end %>
69
23
  </div>
@@ -4,7 +4,7 @@ module Rack
4
4
  class Engine < ::Rails::Engine # :nodoc:
5
5
  initializer "rack-web_profiler.configure_middleware" do |app|
6
6
  app.middleware.use Rack::WebProfiler do |c|
7
- c.tmp_dir = File.expand_path(File.join(Rails.root, "tmp"), __FILE__)
7
+ c.tmp_dir = ::File.expand_path(::File.join(Rails.root, "tmp"), __FILE__)
8
8
  end
9
9
  end
10
10
  end
@@ -2,15 +2,30 @@ module Rack
2
2
  class WebProfiler::Collector::Rack::RequestCollector
3
3
  include Rack::WebProfiler::Collector::DSL
4
4
 
5
- icon nil
5
+ icon <<-'ICON'
6
+ data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+ICAgICAgICA8dGl0bGU+T3ZhbCA3IENvcHkgMjwvdGl0bGU+ICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPiAgICA8ZGVmcz48L2RlZnM+ICAgIDxnI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ZD0iT3ZhbC03LUNvcHktMiI+PC9wYXRoPiAgICAgICAgICAgIDwvZz4gICAgICAgIDwvZz4gICAgPC9nPjwvc3ZnPg==
7
+ ICON
6
8
 
7
9
  collector_name "rack_request"
10
+ # collector_key "rack_request"
11
+ # collector_name "Request"
8
12
  position 2
9
13
 
10
14
  collect do |request, response|
15
+ store :request_headers, get_request_headers(request)
11
16
  store :request_path, request.path
12
17
  store :request_method, request.request_method
13
- store :response_status, response.status
18
+ store :request_cookies, request.cookies
19
+ store :request_get, request.GET
20
+ store :request_post, get_request_post(request)
21
+ store :request_session, request.session
22
+ store :request_cookies, request.cookies
23
+ store :request_body, get_request_body(request)
24
+
25
+ store :rack_env, {} # request.env.each { |k, v| v.inspect }
26
+
27
+ store :response_status, response.status
28
+ store :response_headers, response.headers
14
29
 
15
30
  if response.successful?
16
31
  status :success
@@ -23,11 +38,212 @@ module Rack
23
38
 
24
39
  template __FILE__, type: :DATA
25
40
 
26
- is_enabled? -> { !defined?(Rails) && !defined?(Sinatra) }
41
+ is_enabled? -> { defined?(Rack) && !defined?(Rails) && !defined?(Sinatra) }
42
+
43
+ class << self
44
+ # Get request headers.
45
+ #
46
+ # @return [Hash]
47
+ def get_request_headers(request)
48
+ request.env.select {|k,v| k.start_with? 'HTTP_'}
49
+ .collect {|k,v| [k.sub(/^HTTP_/, ''), v]}
50
+ .collect {|k,v| [k.split('_').collect(&:capitalize).join('-'), v]}
51
+ end
52
+
53
+ def get_request_post(request)
54
+ request.POST if request.POST && !request.POST.empty?
55
+ rescue Exception
56
+ nil
57
+ end
58
+
59
+ def get_request_body(request)
60
+ return nil if request.body.nil?
61
+ request.body.gets
62
+ end
63
+ end
27
64
  end
28
65
  end
29
66
 
30
67
  __END__
31
- <%# content_for :tab do %>
68
+ <% content_for :tab do %>
32
69
  <%= data[:response_status] %> | <%= data[:request_method] %> <%= data[:request_path] %>
33
- <%# end %>
70
+ <% end %>
71
+
72
+ <% content_for :panel do %>
73
+ <div class="block">
74
+ <h3>GET</h3>
75
+ <% unless data[:request_get].empty? %>
76
+ <table>
77
+ <thead>
78
+ <tr>
79
+ <th>Key</th>
80
+ <th>Value</th>
81
+ </tr>
82
+ <thead>
83
+ <tbody>
84
+ <% data[:request_get].each do |k, v| %>
85
+ <tr>
86
+ <th><%= k %></th>
87
+ <td class="code"><%= v %></td>
88
+ </tr>
89
+ <% end %>
90
+ </tbody>
91
+ </table>
92
+ <% else %>
93
+ <p><span class="text__no-value">No GET parameters</span></p>
94
+ <% end %>
95
+ </div>
96
+
97
+ <div class="block">
98
+ <h3>POST</h3>
99
+ <% if data[:request_post] && !data[:request_post].empty? %>
100
+ <table>
101
+ <thead>
102
+ <tr>
103
+ <th>Key</th>
104
+ <th>Value</th>
105
+ </tr>
106
+ <thead>
107
+ <tbody>
108
+ <% data[:request_post].each do |k, v| %>
109
+ <tr>
110
+ <th><%= k %></th>
111
+ <td class="code"><%= v %></td>
112
+ </tr>
113
+ <% end %>
114
+ </tbody>
115
+ </table>
116
+ <% else %>
117
+ <p><span class="text__no-value">No POST parameters</span></p>
118
+ <% end %>
119
+ </div>
120
+
121
+ <div class="block">
122
+ <h3>Request headers</h3>
123
+ <% unless data[:request_headers].empty? %>
124
+ <table>
125
+ <thead>
126
+ <tr>
127
+ <th>Name</th>
128
+ <th>Version</th>
129
+ </tr>
130
+ <thead>
131
+ <tbody>
132
+ <% data[:request_headers].sort.each do |k, v| %>
133
+ <tr>
134
+ <th><%= k %></th>
135
+ <td class="code"><%= v %></td>
136
+ </tr>
137
+ <% end %>
138
+ </tbody>
139
+ </table>
140
+ <% else %>
141
+ <p><span class="text__no-value">No request headers</span></p>
142
+ <% end %>
143
+ </div>
144
+
145
+ <div class="block">
146
+ <h3>Request content</h3>
147
+ <% unless data[:request_body].nil? %>
148
+ <code><%= data[:request_body] %></code>
149
+ <% else %>
150
+ <p><span class="text__no-value">No request content</span></p>
151
+ <% end %>
152
+ </div>
153
+
154
+ <div class="block">
155
+ <h3>Response headers</h3>
156
+ <% unless data[:response_headers].empty? %>
157
+ <table>
158
+ <thead>
159
+ <tr>
160
+ <th>Name</th>
161
+ <th>Version</th>
162
+ </tr>
163
+ <thead>
164
+ <tbody>
165
+ <% data[:response_headers].sort.each do |k, v| %>
166
+ <tr>
167
+ <th><%= k %></th>
168
+ <td class="code"><%= v %></td>
169
+ </tr>
170
+ <% end %>
171
+ </tbody>
172
+ </table>
173
+ <% else %>
174
+ <p><span class="text__no-value">No response headers</span></p>
175
+ <% end %>
176
+ </div>
177
+
178
+ <div class="block">
179
+ <h3>Session</h3>
180
+ <% unless data[:request_session].empty? %>
181
+ <table>
182
+ <thead>
183
+ <tr>
184
+ <th>Name</th>
185
+ <th>Version</th>
186
+ </tr>
187
+ <thead>
188
+ <tbody>
189
+ <% data[:request_session].each do |k, v| %>
190
+ <tr>
191
+ <th><%= k %></th>
192
+ <td class="code"><%= v %></td>
193
+ </tr>
194
+ <% end %>
195
+ </tbody>
196
+ </table>
197
+ <% else %>
198
+ <p><span class="text__no-value">No session data</span></p>
199
+ <% end %>
200
+ </div>
201
+
202
+ <div class="block">
203
+ <h3>Cookies</h3>
204
+ <% unless data[:request_cookies].empty? %>
205
+ <table>
206
+ <thead>
207
+ <tr>
208
+ <th>Name</th>
209
+ <th>Version</th>
210
+ </tr>
211
+ <thead>
212
+ <tbody>
213
+ <% data[:request_cookies].each do |k, v| %>
214
+ <tr>
215
+ <th><%= k %></th>
216
+ <td class="code"><%= v %></td>
217
+ </tr>
218
+ <% end %>
219
+ </tbody>
220
+ </table>
221
+ <% else %>
222
+ <p><span class="text__no-value">No cookies data</span></p>
223
+ <% end %>
224
+ </div>
225
+
226
+ <div class="block">
227
+ <h3>Env</h3>
228
+ <% if data[:rack_env] && !data[:rack_env].empty? %>
229
+ <table>
230
+ <thead>
231
+ <tr>
232
+ <th>Key</th>
233
+ <th>Value</th>
234
+ </tr>
235
+ <thead>
236
+ <tbody>
237
+ <% data[:rack_env].each do |k, v| %>
238
+ <tr>
239
+ <th><%= k %></th>
240
+ <td class="code"><%= v %></td>
241
+ </tr>
242
+ <% end %>
243
+ </tbody>
244
+ </table>
245
+ <% else %>
246
+ <p><span class="text__no-value">No rack env datas</span></p>
247
+ <% end %>
248
+ </div>
249
+ <% end %>
@@ -3,7 +3,7 @@ module Rack
3
3
  include Rack::WebProfiler::Collector::DSL
4
4
 
5
5
  icon <<-'ICON'
6
- data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAB1ElEQVR4XqWTTWsTURSGn3tnpqJYbbKImjaV1IVEgwqpYKNuxK0tRCku/MK/oOBv8L904we4r+10Y0FdWEKsVrAZic2kxDZNwkyOlw51cDal9IXDGYZ5nvfexSgR4TBRxMHNIYMQBEBFozTRjoepb6ikgIUzyIV7T0mVbgGAV4f1ddAWvQ2Pthlt2bTbdX7Vv1D+HrF6Dy5UHpMqlqHzB/wGfK1Cf8dMhyMjaZRlEQQ9jg+fJpMt4OYRAO2Omea7T0gXr0O3A2EAtRoAiMAg3H2Xzo4TmudAQoZPZMmMXsSdQNRiFim/rcLWJqYCbAvm5sBxQCuA6OK2A+9eRVtp0EMsNeaxlQ2tl89InS1C0I8+rlWjrXUsMNBat4u2A7SBOoFHCE0FlBbG+FC4eYd0/goMAvA8aLYiQSQyB/TxfzewtMN24NPs/aC8ymUNLN/4yeTK+zf4a5/AGYLMKRD+a2/7LQOb5hieBD5rgH+S+df4qx/h6DEYOblnoLe9xSAMd5s3YniZZKLrIM0HMyLPX4hMV0Qqs9K4OiXVQk7ccwhQIhmSkpyRPDTw/UciM7Oycn5U3IkEvK9kHNmcvi31a5dkMX8gOJa4BlxKNB9Ysh986N/5L2oi0DPAz3KGAAAAAElFTkSuQmCC
6
+ data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+ICAgICAgICA8dGl0bGU+VHJpYW5nbGUgMTwvdGl0bGU+ICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPiAgICA8ZGVmcz48L2RlZnM+ICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPiAgICAgICAgPGcgaWQ9IkRlc2t0b3AtMiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTcxLjAwMDAwMCwgLTEwLjAwMDAwMCkiIGZpbGw9IiM1ODU0NzMiPiAgICAgICAgICAgIDxwYXRoIGQ9Ik04MSwzMCBMNzEsMTUgTDkxLDE1IEw4MSwzMCBaIE05MSwxNCBMNzEsMTQgTDc1LDEwIEw4NywxMCBMOTEsMTQgWiIgaWQ9IlRyaWFuZ2xlLTEiPjwvcGF0aD4gICAgICAgIDwvZz4gICAgPC9nPjwvc3ZnPg==
7
7
  ICON
8
8
 
9
9
  collector_name "ruby"
@@ -41,6 +41,42 @@ ICON
41
41
  end
42
42
 
43
43
  __END__
44
- <%# content_for :tab do %>
44
+ <% content_for :tab do %>
45
45
  <%= data[:ruby_version] %>
46
- <%# end %>
46
+ <% end %>
47
+
48
+ <% content_for :panel do %>
49
+ <div class="block">
50
+ <h3>Ruby informations</h3>
51
+ <table>
52
+ <tr>
53
+ <th>Version</th>
54
+ <td><%= "#{data[:ruby_version]}p#{data[:ruby_patchlevel]} (#{data[:ruby_release_date]} revision #{data[:ruby_revision]}) [#{data[:ruby_platform]}]" %></td>
55
+ </tr>
56
+ <tr>
57
+ <th>Documentation</th>
58
+ <td><a href="<%= data[:ruby_doc_url] %>"><%= data[:ruby_doc_url] %></a></td>
59
+ </tr>
60
+ </table>
61
+ </div>
62
+
63
+ <div class="block">
64
+ <h3>Gems</h3>
65
+ <table>
66
+ <thead>
67
+ <tr>
68
+ <th>Name</th>
69
+ <th>Version</th>
70
+ </tr>
71
+ <thead>
72
+ <tbody>
73
+ <% data[:gems_list].sort!{|a,b| a[:name] <=> b[:name] }.each do |g| %>
74
+ <tr>
75
+ <th><%= g[:name] %></th>
76
+ <td><%= g[:version] %></td>
77
+ </tr>
78
+ <% end %>
79
+ </tbody>
80
+ </table>
81
+ </div>
82
+ <% end %>