clientperf 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/clientperf.gemspec CHANGED
@@ -1,16 +1,16 @@
1
1
 
2
- # Gem::Specification for Clientperf-0.1.5
2
+ # Gem::Specification for Clientperf-0.1.6
3
3
  # Originally generated by Echoe
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = %q{clientperf}
7
- s.version = "0.1.5"
7
+ s.version = "0.1.6"
8
8
 
9
9
  s.specification_version = 2 if s.respond_to? :specification_version=
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Eric Falcao"]
13
- s.date = %q{2008-06-23}
13
+ s.date = %q{2008-06-29}
14
14
  s.default_executable = %q{clientperf}
15
15
  s.description = %q{Instrumentation for the FiveRuns TuneUp product.}
16
16
  s.email = %q{efalcao@gmail.com}
data/lib/clientperf.rb CHANGED
@@ -27,7 +27,7 @@ module Clientperf
27
27
  end
28
28
 
29
29
  def version
30
- "0.1.5"
30
+ "0.1.6"
31
31
  end
32
32
 
33
33
  private
@@ -1,12 +1,17 @@
1
1
  module ClientperfHelper
2
- def chart(data)
3
- "http://chart.apis.google.com/chart?cht=ls&chs=300x100&chm=B,e6f2fa,0,0,0|R,000000,0,0.998,1.0&chco=0f7fcf&chxt=r&chd=s:#{chart_data(data)}"
2
+ def chart_for(data)
3
+ if encoded = chart_data(data)
4
+ image_tag("http://chart.apis.google.com/chart?cht=ls&chs=300x100&chm=B,e6f2fa,0,0,0|R,000000,0,0.998,1.0&chco=0f7fcf&chxt=r&chd=s:#{encoded}")
5
+ else
6
+ content_tag('p', "no data for this chart")
7
+ end
4
8
  end
5
9
 
6
10
  private
7
11
 
8
12
  def chart_data(args)
9
13
  data, max = args
14
+ return nil if max == 0 || data.size == 0
10
15
  max += max * 0.1
11
16
  encode = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
12
17
 
@@ -1,5 +1,5 @@
1
1
  class ClientperfMigrations
2
- MIGRATION_NAMES = %w(add_clientperf_tables)
2
+ MIGRATION_NAMES = %w(add_clientperf_tables add_clientperf_indexes)
3
3
  MIGRATION_CONTENTS = {
4
4
  :add_clientperf_tables => %(
5
5
  class AddClientperfTables < ActiveRecord::Migration
@@ -20,6 +20,18 @@ class AddClientperfTables < ActiveRecord::Migration
20
20
  drop_table :clientperf_uris
21
21
  drop_table :clientperf_results
22
22
  end
23
+ end),
24
+ :add_clientperf_indexes => %(
25
+ class AddClientperfIndexes < ActiveRecord::Migration
26
+ def self.up
27
+ add_index :clientperf_uris, :uri
28
+ add_index :clientperf_results, :clientperf_uri_id
29
+ end
30
+
31
+ def self.down
32
+ remove_index :clientperf_uris, :uri
33
+ remove_index :clientperf_results, :clientperf_uri_id
34
+ end
23
35
  end)
24
36
  }
25
37
 
@@ -5,7 +5,7 @@
5
5
  <% @uris.each do |uri| %>
6
6
  <tr>
7
7
  <td class="vital-stats">[ <%= number_with_precision(uri.clientperf_results.average(:milliseconds) / 1000.to_f, 2) %>s | <%= uri.clientperf_results.count %> ]</td>
8
- <td><%= link_to uri.uri, "/clientperf/#{uri.id}" %></td>
8
+ <td><%= link_to h(uri.uri), "/clientperf/#{uri.id}" %></td>
9
9
  </tr>
10
10
  <% end %>
11
11
  </table>
@@ -17,11 +17,11 @@
17
17
  <% if @uris.size > 0 %>
18
18
  <div class="chart">
19
19
  <h4>24 hour</h4>
20
- <img src="<%= chart(ClientperfResult.last_24_hours) %>" />
20
+ <%= chart_for(ClientperfResult.last_24_hours) %>
21
21
  </div>
22
22
  <div class="chart">
23
23
  <h4>30 day</h4>
24
- <img src="<%= chart(ClientperfResult.last_30_days)%>" />
24
+ <%= chart_for(ClientperfResult.last_30_days) %>
25
25
  </div>
26
26
  <% else %>
27
27
  <p>no data yet.</p>
@@ -3,11 +3,11 @@
3
3
  <h2>trends</h2>
4
4
  <div class="chart">
5
5
  <h4>24 hour</h4>
6
- <img src="<%= chart(@uri.last_24_hours) %>" />
6
+ <%= chart_for(@uri.last_24_hours) %>
7
7
  </div>
8
8
  <div class="chart">
9
9
  <h4>30 day</h4>
10
- <img src="<%= chart(@uri.last_30_days)%>" />
10
+ <%= chart_for(@uri.last_30_days)%>
11
11
  </div>
12
12
  </div>
13
13
  </div>
@@ -1,6 +1,6 @@
1
1
  <html>
2
2
  <head>
3
- <title>clientperf <%= ": #{@page_title}" if @page_title %></title>
3
+ <title>clientperf <%= ": #{h(@page_title)}" if @page_title %></title>
4
4
  <style type="text/css">
5
5
  body {
6
6
  margin:0;
@@ -95,7 +95,7 @@
95
95
  <body>
96
96
  <div id="header">
97
97
  <h1><%= link_to "clientperf", :controller => 'clientperf', :action => 'index' %></h1>
98
- <%= "<h3><span>&raquo;</span>#{@uri.uri}</h3>" if @uri %>
98
+ <%= "<h3><span>&raquo;</span>#{h(@uri.uri)}</h3>" if @uri %>
99
99
  <div style="clear:both"></div>
100
100
  </div>
101
101
  <div id="content">
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clientperf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Falcao
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-23 00:00:00 -05:00
12
+ date: 2008-06-29 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15