speedup-rails 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/app/views/speedup_rails/collectors/_bullet.html.erb +7 -3
  4. data/app/views/speedup_rails/collectors/_partials.html.erb +6 -4
  5. data/app/views/speedup_rails/collectors/_queries.html.erb +6 -4
  6. data/app/views/speedup_rails/collectors/_request.html.erb +4 -2
  7. data/app/views/speedup_rails/collectors/_rubyprof.html.erb +3 -1
  8. data/app/views/speedup_rails/results/show.html.erb +1 -29
  9. data/lib/speedup/middleware.rb +20 -9
  10. data/lib/speedup/version.rb +1 -1
  11. data/spec/dummy/config/environments/development.rb +3 -1
  12. data/spec/dummy/log/development.log +598 -0
  13. data/spec/dummy/log/production.log +0 -0
  14. data/spec/dummy/log/test.log +108 -0
  15. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/3YSkPSYNGQ2BDooXYwcCbf-oz1OZnmHxIa8JTCz78vY.cache +2 -0
  16. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/3bsZzwjvDbNIWMUX8giKWzdfkqBRyEfHS403ctuHDmg.cache +0 -0
  17. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/4N2sexgUg5SVotPG0yWoKJ1wD87vFO5DjixEqyLrhdo.cache +1 -0
  18. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8Qtx6fVlRvUSQghEYkNOtWDcjVeC57jgPMhGz4-0oEY.cache +2 -0
  19. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/9nJltQmKLYGjIzKcA6v4_jbB6XTszGX5mSD_W30Ohbk.cache +3 -0
  20. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Dr3B6TxfLxEZ3pbMVISPXeI-nhhWrcecIh_ng9dlKeQ.cache +2 -0
  21. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/EhBKQOrOKrZ8rDAKYh5uoe7gb6rY1evBFbq-UdNeIgA.cache +0 -0
  22. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/FYuMMhHtlBsoYnF944Ee94KbimxB644HZlBUSmD31Ug.cache +1 -0
  23. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/HjoX3AhIw0VuB2FPEvBpx37c5w6zoyLazXKX4dNO97s.cache +1 -0
  24. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ILNtHkESSSQbyBjEfW-LIRYYHCllbzUmUbL_cS8sAp8.cache +2 -0
  25. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/KtEU0IkJK73W5hrhze6bnZg4syqloPSxZki_VdX3AXU.cache +1 -0
  26. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Mzr--mmXipATd3huo5JJ56L4AZLp6Ymz8tOJmU0Dr38.cache +2 -0
  27. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/PJV4XJpYA-RcYCSpwpZmorvCPG7sx12HqVyQ8ND12bo.cache +2 -0
  28. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/RA6F5f-RPWzMIcDkfr_xQnA9a94V1o1A_zrHlJt1zOU.cache +1 -0
  29. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/T05TbQ8ghlu83lcwx4aLk8bBerNaHl-UIxQZYohG1oY.cache +3 -0
  30. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/USkydV94SUPnILJI63KVIneruvmJseCKaRn6LfdSvqY.cache +0 -0
  31. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/VXVv2A6lbi8e3MK9LGhOzWLxoKpL8XXcMRxXNkMHJOc.cache +1 -0
  32. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/W6SCXOfjna12llC4KZ4OyL8J7GMLkTYXZM4lN2X_toc.cache +3 -0
  33. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/XZE6WadNhljT7uukkfIOi7wLIBTsn3ndNWsXkA6ewcU.cache +1 -0
  34. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ZDRN75TgGifAzxN_AdgEfifXQpLH_PA2snKnV7AdzHI.cache +0 -0
  35. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/_MDj4cuQwwQetXLHJqrpDuqlm_UEayujIHUNz1LYT1E.cache +2 -0
  36. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/_l7liki8UjVjQO9uXRaBUk3KwEeObGmdKQTjaTS_Aqk.cache +1 -0
  37. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/a0CNf1jTEeNh9Ie1ekXb3V58IRQNyIy9S8aS_FuFa6o.cache +2 -0
  38. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/b-giWmtfRbUh13iQ5-cBtRXiO2qe7Y1UZSPSGQ2o13U.cache +2 -0
  39. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/bj8ZfYtA_qebu_NfIXND9YZNeGUi7SXGYcetFnvf3ek.cache +4 -0
  40. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/fcpaPfH9xKjiXsyc_e_L3HX5uopYuplC--o31UU-kec.cache +1 -0
  41. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/gstAGhb7aKezlJ7sHr8sYKnZgHTZhBOIv9WO61w-B_Q.cache +4 -0
  42. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/kqEhGr7XzBpcFVcZMQ-s7AVCpcj6cqx112agQvd4MAs.cache +1 -0
  43. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/lKDtOr66Q8TgRXB1NWNFmaw__i23HF9QPF90dosqCGI.cache +2 -0
  44. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/nJNmvYfTTH1ibrNty9OsJ8NtDRVAGly9hZrAia5swSc.cache +2 -0
  45. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/oGT_KQRqXzv30y6i2O98FCU9Mjh7fPHuvA7MCdUwrx0.cache +1 -0
  46. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/slnWIzG5Tuc4X6HkoTiaQqLtSDbv72OVyaOQEpeVDYc.cache +0 -0
  47. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ux6hfUdZIPXSt1MctpVlyMH-IfFt5UXJUt2IIM3TLog.cache +0 -0
  48. data/spec/spec_helper.rb +7 -1
  49. metadata +85 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 044447ec3251c52f24c7a0b4e64042e3901ec607
4
- data.tar.gz: ab4985167d7d03b7fc692cf62435cc6768962068
3
+ metadata.gz: e20b0e2c53cfa6c365ee4130ec61313c490dab7f
4
+ data.tar.gz: 3c71390f34b1e23c53a6d351f2a4455886277ce7
5
5
  SHA512:
6
- metadata.gz: 52c26516e25e567c43005676df1b586ee636f8834edbb76efadc48c8e0425c813dfde50e3474150a491c6748bfeebd25453e4864108fe0f2f41831f3795d4dc2
7
- data.tar.gz: 53167a44a1dbf30f7b142ac879511db5d3b3af651acdd7d9f1855a7a14cd22abe9b7015b14694c7c9180699887e397b0f34878d51355754ff362377206ee34a8
6
+ metadata.gz: 9df81c075bda9ecce97d80336232ff0d1690651e6ff102125ea2941ea29c7e66b767fb0f68c519ea4bdeff683f91142eb0198b84cb28789ba0d470200dccc535
7
+ data.tar.gz: c73178b30a4f83c81085562090f4122bc3c5154449c12d188f11d1bc76000f9a4cd5a5c5bb5c3ee60ddad83b631a6601d0ccb82468a4fff31c4d3f987dd8033a
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ require 'rdoc/task'
8
8
 
9
9
  RDoc::Task.new(:rdoc) do |rdoc|
10
10
  rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'SpeedUpRails'
11
+ rdoc.title = 'SpeedupRails'
12
12
  rdoc.options << '--line-numbers'
13
13
  rdoc.rdoc_files.include('README.rdoc')
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
@@ -1,8 +1,12 @@
1
- <%= image_tag('speedup_rails/alert.jpg', alt: '') %><%= data.count %> problems
2
- <% content_for(:speed_up_additional_bars) do %>
1
+ <span class="speedup_rails_<%= key %>" data-key="<%= key %>">
2
+ <%= image_tag('speedup_rails/alert.jpg', alt: '') %><%= data.count %> problems
3
+ </span>
4
+ <% if data.any? %>
5
+ <div class="additional_info">
3
6
  <div class="<%= key %>">
4
7
  <% data.each do |problem| %>
5
8
  <div><%= problem[:caller].gsub(/\n/, '<br />').html_safe %></div>
6
9
  <% end %>
7
10
  </div>
8
- <% end if data.any? %>
11
+ </div>
12
+ <% end %>
@@ -1,11 +1,13 @@
1
- <%= image_tag('speedup_rails/file-icon.png', alt: '') %><%= data.count %> partials (<%= render_ms(data.sum{|t| t[:duration] }) %>)
2
- <% content_for(:speed_up_additional_bars) do %>
1
+ <span class="speedup_rails_<%= key %>" data-key="<%= key %>">
2
+ <%= image_tag('speedup_rails/file-icon.png', alt: '') %><%= data.count %> partials (<%= render_ms(request_data[:view_duration]) %>)
3
+ </span>
4
+ <div class="additional_info">
3
5
  <div class="partials">
4
6
  <% data.each do |template| %>
5
7
  <div>
6
- <span class="duration"><%= render_ms(template[:duration]) %></span>
8
+ <span class="duration <%= template[:duration] > 100 ? 'duration-warning' : 'duration-info' %>"><%= render_ms(template[:duration]) %></span>
7
9
  <span class="template"><%= template[:identifier] %></span>
8
10
  </div>
9
11
  <% end %>
10
12
  </div>
11
- <% end %>
13
+ </div>
@@ -1,11 +1,13 @@
1
- <%= image_tag('speedup_rails/database.png', alt: '') %><%= data.count %> queries
2
- <% content_for(:speed_up_additional_bars) do %>
1
+ <span class="speedup_rails_<%= key %>" data-key="<%= key %>">
2
+ <%= image_tag('speedup_rails/database.png', alt: '') %><%= data.count %> queries (<%= render_ms(data.sum{|t| t[:duration] }) %>)
3
+ </span>
4
+ <div class="additional_info">
3
5
  <div class="queries">
4
6
  <% data.each do |query| %>
5
7
  <div>
6
- <span class="duration"><%= (query[:duration] * 100).round.to_f / 100 %> ms</span>
8
+ <span class="duration <%= query[:duration] > 10 ? 'duration-warning' : 'duration-info' %>"><%= render_ms(query[:duration])%></span>
7
9
  <span class="query"><%= query[:query] %></span>
8
10
  </div>
9
11
  <% end %>
10
12
  </div>
11
- <% end %>
13
+ </div>
@@ -1,3 +1,5 @@
1
+ <span class="speedup_rails_<%= key %>" data-key="<%= key %>">
1
2
 
2
- <%= image_tag('speedup_rails/input.png', alt: '') %> <%= data[:controller] %>#<%= data[:action] %>
3
- <%= image_tag('speedup_rails/time.png', alt: '') %> <%= (data[:duration] * 100).round.to_f / 100 %> ms
3
+ <%= image_tag('speedup_rails/input.png', alt: '') %> <%= data[:controller] %>#<%= data[:action] %>
4
+ <%= image_tag('speedup_rails/time.png', alt: '') %> <%= (data[:duration] * 100).round.to_f / 100 %> ms
5
+ </span>
@@ -1 +1,3 @@
1
- <%= link_to 'ruby-prof', rubyprof_result_path(@request_id) %>
1
+ <span class="speedup_rails_<%= key %>" data-key="<%= key %>">
2
+ <%= link_to 'ruby-prof', rubyprof_result_path(@request_id) %>
3
+ </span>
@@ -1,36 +1,8 @@
1
- <% info_class = 'additional_info' + ( @redirect ? "-#{@redirect}" : '' ) %>
2
1
  <ul class="speedup_main_bar speedup_main_bar_<%= @redirect %><%= ' redirect' if @redirect %>">
3
2
  <% @collectors.each do |col| %>
4
3
  <% next unless col.render? %>
5
4
  <li>
6
- <span class="speedup_rails_<%= col.key %>" data-key="<%= col.key %>">
7
- <%= render "speedup_rails/collectors/#{col.key}", data: @request[col.key] || [], key: col.key %>
8
- </span>
5
+ <%= render "speedup_rails/collectors/#{col.key}", data: @request[col.key] || [], key: col.key, request_data: @request[:request] %>
9
6
  </li>
10
7
  <% end %>
11
8
  </ul>
12
- <div class="additional_info <%= info_class %>">
13
- <% if content_for?(:speed_up_additional_bars) %>
14
- <%= yield :speed_up_additional_bars %>
15
- <% end %>
16
- </div>
17
-
18
- <script type="text/javascript">
19
- elements = document.querySelectorAll("#speedup_rails_bar .speedup_main_bar_<%= @redirect %> > li > span");
20
- function handlerOver() {
21
- elem = document.querySelector('#speedup_rails_bar .<%= info_class %> .' + this.dataset.key );
22
- if( elem ) {
23
- elem.style.display = 'block';
24
- elem.style.bottom = '' + ( window.innerHeight - this.offsetParent.offsetTop + 2) + 'px';
25
- }
26
- }
27
- function handlerOut() {
28
- elem = document.querySelector('#speedup_rails_bar .<%= info_class %> .' + this.dataset.key );
29
- if( elem )
30
- elem.style.display = 'none';
31
- }
32
- for( i = 0; i < elements.length; ++i) {
33
- elements[i].onmouseover = handlerOver;
34
- elements[i].onmouseout = handlerOut;
35
- }
36
- </script>
@@ -95,18 +95,18 @@ module Speedup
95
95
  def styles
96
96
  <<-END_STYLES
97
97
  <style type="text/css">
98
- #speedup_rails_bar,
99
- #speedup_rails_bar .additional_info > div {
98
+ #speedup_rails_bar {
100
99
  position: fixed;
101
100
  bottom: 5px;
102
101
  right: 5px;
103
102
  min-width: 250px;
103
+ z-index: 100;
104
104
  }
105
105
  #speedup_rails_bar .redirect {
106
106
  color: #444;
107
107
  }
108
108
  #speedup_rails_bar .speedup_main_bar,
109
- #speedup_rails_bar .additional_info > div
109
+ #speedup_rails_bar .additional_info
110
110
  {
111
111
  border: 1px solid #c9c9c9;
112
112
  background-color: #EDEAE0;
@@ -117,6 +117,15 @@ module Speedup
117
117
  }
118
118
  #speedup_rails_bar > ul { list-style: none; clear: left; margin: 0; padding: 0; margin-left: 4px; }
119
119
  #speedup_rails_bar > ul > li { float: left; overflow: visible; }
120
+ #speedup_rails_bar .additional_info {
121
+ position: absolute;
122
+ bottom: 100%;
123
+ right: 0;
124
+ padding: 5px;
125
+ display: none;
126
+ height: 500px;
127
+ }
128
+ #speedup_rails_bar > ul > li:hover .additional_info { display: block; max-width: 200%; }
120
129
  #speedup_rails_bar li > span { padding: 0 4px; }
121
130
  #speedup_rails_bar img {
122
131
  vertical-align: middle;
@@ -125,16 +134,18 @@ module Speedup
125
134
  margin-right: 3px;
126
135
  width: 18px;
127
136
  }
128
- #speedup_rails_bar .additional_info > div {
129
- padding: 5px;
130
- display: none;
131
- }
132
137
  #speedup_rails_bar .additional_info > div > div {
133
138
  border-bottom: 1px solid #c9c9c9;
134
139
  }
135
140
  #speedup_rails_bar .additional_info > div > div:last-child {
136
141
  border-bottom: none;
137
142
  }
143
+ #speedup_rails_bar .additional_info .duration {
144
+ font-weight: bold;
145
+ }
146
+ #speedup_rails_bar .additional_info .duration.duration-warning {
147
+ color: red;
148
+ }
138
149
  </style>
139
150
  END_STYLES
140
151
  end
@@ -145,7 +156,7 @@ module Speedup
145
156
  speedup_rails_ajax( url , function(xhr) {
146
157
  res = stripScript( xhr.responseText );
147
158
  appendHtml(document.getElementById('speedup_rails_bar'), res[0]);
148
- executeScript(res[1])
159
+ executeScript(res[1]);
149
160
  });
150
161
  }
151
162
  function appendHtml(el, str) {
@@ -171,7 +182,7 @@ module Speedup
171
182
  var head = document.getElementsByTagName('head')[0];
172
183
  var scriptElement = document.createElement('script');
173
184
  scriptElement.setAttribute('type', 'text/javascript');
174
- scriptElement.innerText = scripts;
185
+ scriptElement.innerHTML = scripts;
175
186
  head.appendChild(scriptElement);
176
187
  head.removeChild(scriptElement);
177
188
  }
@@ -1,3 +1,3 @@
1
1
  module Speedup
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -1,3 +1,5 @@
1
+ WebMock.allow_net_connect! #temporary fix
2
+
1
3
  Rails.application.configure do
2
4
  # Settings specified here will take precedence over those in config/application.rb.
3
5
 
@@ -41,6 +43,6 @@ Rails.application.configure do
41
43
 
42
44
  # config.speedup.adapter = :memory
43
45
  # config.speedup.adapter = :influxdb, { database: 'speeduprails', username: 'ezrondre', password: 'agent', host: 'sandbox.influxdb.com' }
44
- # config.speedup.adapter = :server, { url: 'http://localhost:8080', api_key: '4e557137390141bea520da8cb78e1ca2' }
46
+ # config.speedup.adapter = :server, { url: 'http://localhost:3030', api_key: 'ca8956557c40d4716cca5ac6278aa651' }
45
47
  # config.speedup.adapter = :file
46
48
  end