fiveruns_tuneup 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/History.rdoc +3 -0
  2. data/Manifest +57 -0
  3. data/README.rdoc +44 -0
  4. data/Rakefile +15 -0
  5. data/assets/images/arrows.gif +0 -0
  6. data/assets/images/edit.png +0 -0
  7. data/assets/images/fade.png +0 -0
  8. data/assets/images/fade_down.png +0 -0
  9. data/assets/images/head.gif +0 -0
  10. data/assets/images/logo.gif +0 -0
  11. data/assets/images/logo_clear.png +0 -0
  12. data/assets/images/magnify.png +0 -0
  13. data/assets/images/pip.gif +0 -0
  14. data/assets/images/pointer.gif +0 -0
  15. data/assets/images/schema.png +0 -0
  16. data/assets/images/signin.gif +0 -0
  17. data/assets/images/spinner.gif +0 -0
  18. data/assets/images/warning.gif +0 -0
  19. data/assets/javascripts/prototype.js +2515 -0
  20. data/assets/javascripts/tuneup.js +30 -0
  21. data/assets/stylesheets/tuneup.css +204 -0
  22. data/bin/fiveruns_tuneup +26 -0
  23. data/fiveruns_tuneup.gemspec +49 -0
  24. data/init.rb +2 -0
  25. data/install.rb +18 -0
  26. data/lib/bumpspark_helper.rb +52 -0
  27. data/lib/fiveruns/tuneup.rb +103 -0
  28. data/lib/fiveruns/tuneup/asset_tags.rb +39 -0
  29. data/lib/fiveruns/tuneup/custom_methods.rb +8 -0
  30. data/lib/fiveruns/tuneup/environment.rb +29 -0
  31. data/lib/fiveruns/tuneup/instrumentation/action_controller/base.rb +59 -0
  32. data/lib/fiveruns/tuneup/instrumentation/action_view/base.rb +77 -0
  33. data/lib/fiveruns/tuneup/instrumentation/active_record/base.rb +126 -0
  34. data/lib/fiveruns/tuneup/instrumentation/cgi/session.rb +30 -0
  35. data/lib/fiveruns/tuneup/instrumentation/utilities.rb +172 -0
  36. data/lib/fiveruns/tuneup/multipart.rb +75 -0
  37. data/lib/fiveruns/tuneup/runs.rb +86 -0
  38. data/lib/fiveruns/tuneup/schema.rb +43 -0
  39. data/lib/fiveruns/tuneup/step.rb +219 -0
  40. data/lib/fiveruns/tuneup/urls.rb +23 -0
  41. data/lib/fiveruns/tuneup/version.rb +80 -0
  42. data/lib/fiveruns_tuneup.rb +1 -0
  43. data/lib/tuneup_config.rb +29 -0
  44. data/lib/tuneup_controller.rb +140 -0
  45. data/lib/tuneup_helper.rb +185 -0
  46. data/rails/init.rb +20 -0
  47. data/tasks/assets.rake +32 -0
  48. data/test/test_helper.rb +3 -0
  49. data/test/tuneup_test.rb +0 -0
  50. data/uninstall.rb +6 -0
  51. data/views/tuneup/_data.html.erb +15 -0
  52. data/views/tuneup/_flash.html.erb +6 -0
  53. data/views/tuneup/_link.html.erb +1 -0
  54. data/views/tuneup/_schema.html.erb +17 -0
  55. data/views/tuneup/_sql.html.erb +23 -0
  56. data/views/tuneup/_step.html.erb +15 -0
  57. data/views/tuneup/panel/_registered.html.erb +4 -0
  58. data/views/tuneup/panel/_unregistered.html.erb +14 -0
  59. metadata +146 -0
@@ -0,0 +1,30 @@
1
+ TuneUp.switchSchema = function(table) {
2
+ var element = $('tuneup-schema-table-' + table);
3
+ var operation = element.visible() ? 'hide' : 'show';
4
+ $$('#tuneup-schema .tuneup-schema-table').each(function(s) { s.hide(); })
5
+ element[operation]();
6
+ $('tuneup-schema')[operation]();
7
+ }
8
+ TuneUp.Spinner = {
9
+ start: function() { $('tuneup_spinner').show(); },
10
+ stop: function() { $('tuneup_spinner').hide(); }
11
+ }
12
+
13
+
14
+ Event.observe(window, 'load', function() {
15
+ $A($(document.body).descendants()).each(function(e){
16
+ var pos = Element.getStyle(e, 'position');
17
+ if(pos == 'absolute' || pos == 'fixed') {
18
+ var top = parseFloat(Element.getStyle(e, 'top') || 0);
19
+ e.style.top = (top + 50) + 'px';
20
+ }
21
+ })
22
+ new Insertion.Top(document.body, "<div id='tuneup'><h1>FiveRuns TuneUp</h1><img id='tuneup_spinner' style='display:none' src='/images/tuneup/spinner.gif' alt=''/><div id='tuneup-content'></div></div><div id='tuneup-flash'></div>");
23
+ new Ajax.Request('/tuneup?uri=' + encodeURIComponent(document.location.href),
24
+ {
25
+ asynchronous:true,
26
+ evalScripts:true,
27
+ onLoading: TuneUp.Spinner.start,
28
+ onComplete: TuneUp.Spinner.stop
29
+ });
30
+ });
@@ -0,0 +1,204 @@
1
+ /*
2
+ Copyright (c) 2008, Yahoo! Inc. All rights reserved.
3
+ Code licensed under the BSD License:
4
+ http://developer.yahoo.net/yui/license.txt
5
+ version: 2.5.1
6
+ */
7
+ /* Modified to target #tuneup div */
8
+ #tuneup div,#tuneup dl,#tuneup dt,#tuneup dd,#tuneup ul,#tuneup ol,#tuneup #tuneup li,#tuneup h1,#tuneup h2,#tuneup h3,#tuneup h4,#tuneup h5,#tuneup h6,#tuneup pre,#tuneup code,#tuneup form,#tuneup fieldset,#tuneup #tuneup legend,#tuneup input,#tuneup textarea,#tuneup p,#tuneup blockquote,#tuneup th,#tuneup td{margin:0;padding:0;}
9
+ #tuneup table{border-collapse:collapse;border-spacing:0;}
10
+ #tuneup fieldset,#tuneup img{border:0;}
11
+ #tuneup address,#tuneup caption,#tuneup cite,#tuneup code,#tuneup dfn,#tuneup em,#tuneup strong,#tuneup th,#tuneup var{font-style:normal;font-weight:normal;}
12
+ #tuneup li{list-style:none;}
13
+ #tuneup caption,#tuneup th{text-align:left;}
14
+ #tuneup h1,#tuneup h2,#tuneup h3,#tuneup h4,#tuneup h5,#tuneup h6{font-size:100%;font-weight:normal;}
15
+ #tuneup q:before,#tuneup q:after{content:'';}
16
+ #tuneup abbr,#tuneup acronym {border:0;font-variant:normal;}
17
+ #tuneup sup {vertical-align:text-top;}
18
+ #tuneup sub {vertical-align:text-bottom;}
19
+ #tuneup input,#tuneup textarea,#tuneup select{font-family:inherit;font-size:inherit;font-weight:inherit;}
20
+ #tuneup input,#tuneup textarea,#tuneup select{*font-size:100%;}
21
+ #tuneup legend{color:#000;}
22
+ #tuneup body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}
23
+ #tuneup table {font-size:inherit;font:100%;}
24
+ #tuneup pre,#tuneup code,#tuneup kbd,#tuneup samp,#tuneup tt{font-family:monospace;*font-size:108%;line-height:100%;}
25
+
26
+ #tuneup-flash div,#tuneup-flash dl,#tuneup-flash dt,#tuneup-flash dd,#tuneup-flash ul,#tuneup-flash ol,#tuneup-flash #tuneup-flash li,#tuneup-flash h1,#tuneup-flash h2,#tuneup-flash h3,#tuneup-flash h4,#tuneup-flash h5,#tuneup-flash h6,#tuneup-flash pre,#tuneup-flash code,#tuneup-flash form,#tuneup-flash fieldset,#tuneup-flash #tuneup-flash legend,#tuneup-flash input,#tuneup-flash textarea,#tuneup-flash p,#tuneup-flash blockquote,#tuneup-flash th,#tuneup-flash td{margin:0;padding:0;}
27
+ #tuneup-flash table{border-collapse:collapse;border-spacing:0;}
28
+ #tuneup-flash fieldset,#tuneup-flash img{border:0;}
29
+ #tuneup-flash address,#tuneup-flash caption,#tuneup-flash cite,#tuneup-flash code,#tuneup-flash dfn,#tuneup-flash em,#tuneup-flash strong,#tuneup-flash th,#tuneup-flash var{font-style:normal;font-weight:normal;}
30
+ #tuneup-flash li{list-style:none;}
31
+ #tuneup-flash caption,#tuneup-flash th{text-align:left;}
32
+ #tuneup-flash h1,#tuneup-flash h2,#tuneup-flash h3,#tuneup-flash h4,#tuneup-flash h5,#tuneup-flash h6{font-size:100%;font-weight:normal;}
33
+ #tuneup-flash q:before,#tuneup-flash q:after{content:'';}
34
+ #tuneup-flash abbr,#tuneup-flash acronym {border:0;font-variant:normal;}
35
+ #tuneup-flash sup {vertical-align:text-top;}
36
+ #tuneup-flash sub {vertical-align:text-bottom;}
37
+ #tuneup-flash input,#tuneup-flash textarea,#tuneup-flash select{font-family:inherit;font-size:inherit;font-weight:inherit;}
38
+ #tuneup-flash input,#tuneup-flash textarea,#tuneup-flash select{*font-size:100%;}
39
+ #tuneup-flash legend{color:#000;}
40
+ #tuneup-flash body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}
41
+ #tuneup-flash table {font-size:inherit;font:100%;}
42
+ #tuneup-flash pre,#tuneup-flash code,#tuneup-flash kbd,#tuneup-flash samp,#tuneup-flash tt{font-family:monospace;*font-size:108%;line-height:100%;}
43
+ /* END YUI RESET */
44
+
45
+ /* Styling */
46
+ #tuneup { height: 50px; color: #ddd; background: #000 url(/images/tuneup/head.gif) 0 100% repeat-x; padding: 0; font-family: "Helvetica Neue", "Lucida Grande", Calibri, Helvetica, Verdana, sans-serif; font-size: 12px; }
47
+ #tuneup #tuneup-content { margin-left: 170px; color: #ddd; height: 50px; vertical-align: middle; text-align: left; }
48
+ #tuneup #tuneup-root-bar { float: right; }
49
+ #tuneup a, #tuneup a:visited, #tuneup a:active { color: #fff; text-decoration: underline; font-size: 12px; border: 0; }
50
+
51
+ #tuneup #tuneup-logo { float: left;}
52
+ #tuneup label { display: inline; font-size: 13px; font-weight: normal; color: #CCC; padding: 2px 2px; }
53
+ #tuneup label, #tuneup button { margin: 0 6px 0 20px; }
54
+
55
+ #tuneup #tuneup-content p.full { height: 50px; line-height: 50px; vertical-align: middle; padding: 0; }
56
+ #tuneup .small { font-size: 10px; color: #666; padding: 0 8px 0 8px;}
57
+
58
+
59
+ #tuneup .tuneup-bar { margin: 0 4px; margin-left: 10px; height: 15px; list-style: none; }
60
+ #tuneup .tuneup-bar li { float:left; height: 20px; color: #fff; line-height: 20px; vertical-align: middle; font-size: 11px; padding: 0 4px;
61
+ background-image: url(/images/tuneup/fade.png);
62
+ background-position: bottom left;
63
+ background-repeat: repeat-x;
64
+ }
65
+ #tuneup .tuneup-layer-model { background-color: #FF9800; }
66
+ #tuneup .tuneup-layer-view { background-color: #38D023; }
67
+ #tuneup .tuneup-layer-controller { background-color: #3388D5; }
68
+ #tuneup .tuneup-bar li.tuneup-layer-other { background: #222 url(/images/tuneup/fade_down.png) top left repeat-x;}
69
+
70
+ #tuneup #tuneup-top { position: absolute; top: 0px; right: 10px; padding: 0; margin: 0; z-index: 11000; }
71
+ #tuneup #tuneup-top #tuneup-save-link { line-height: 45px; vertical-align: bottom; margin: 9px; text-align: center; font-weight: bold; padding-left: 20px; background: url(/images/tuneup/pointer.gif) 0 50% no-repeat; }
72
+ #tuneup #tuneup-summary {float: right; padding: 9px; padding-bottom: 25px; margin: 3px; text-align: center; color: #ddd; -moz-border-radius: 6px; }
73
+
74
+ #tuneup #tuneup-data:hover #tuneup-summary { /* h */
75
+ border-bottom: 0px;
76
+ background: #000;
77
+ }
78
+ #tuneup #tuneup-details { display: none; position: absolute; top: 46px; right: 13px; padding: 9px; text-align: left; z-index: 10999;}
79
+ #tuneup #tuneup-data:hover #tuneup-details { /* h */
80
+ display: block;
81
+ background: #000;
82
+ min-width: 300px;
83
+ -moz-border-radius: 6px;
84
+ }
85
+
86
+ #tuneup #tuneup-details ul dl { margin: 0; padding: 0; width: 700; overflow: hidden; }
87
+ #tuneup #tuneup-details ul dt { float: left; overflow: hidden; height: 20px; margin: 0 10px 0 0; padding: 0; color: #ddd; font-size: 12px; text-transform: none; font-weight: inherit;}
88
+ #tuneup #tuneup-details ul dt p { }
89
+ #tuneup #tuneup-details ul dt strong { color: #fff; font-weight: bold; }
90
+ #tuneup #tuneup-details ul dt span.time { float: right; text-transform: none; font-size: 11px; font-weight: normal; margin-right: 0px; }
91
+
92
+ #tuneup #tuneup-details ul dt a, #tuneup-details ul dt a:active, #tuneup-details ul dt a:visited {
93
+ color: inherit;
94
+ font-size: inherit;
95
+ font-weight: inherit;
96
+ text-decoration: none;
97
+ text-align: left;
98
+ position: inherit;
99
+ }
100
+
101
+ #tuneup .tuneup-bar li { text-align: center; }
102
+
103
+ #tuneup #tuneup-details li.fiveruns_tuneup_step { padding-left: 4px; background: url(/images/tuneup/pip.gif) 4px 0 no-repeat; }
104
+ #tuneup #tuneup-details li.fiveruns_tuneup_step.with-children { background: url(/images/tuneup/arrows.gif) 4px 0 no-repeat;}
105
+ #tuneup #tuneup-details li.fiveruns_tuneup_step.with-children.tuneup-opened { background: url(/images/tuneup/arrows.gif) 4px -20px no-repeat; }
106
+
107
+ #tuneup #tuneup-details ul { margin: 0; padding: 0; }
108
+ #tuneup #tuneup-details ul span.time { margin-right: 12px; }
109
+
110
+ #tuneup li .children { display: none; }
111
+
112
+ #tuneup_spinner { position: absolute; z-index: 11002; top: 15px; right: 30px; }
113
+
114
+ #tuneup #tuneup-details ul dd {
115
+ margin: 0 0 0 410px;
116
+ height: 20px;
117
+ padding: 0;
118
+ }
119
+ #tuneup #tuneup-details ul dt { padding-left: 16px; width: 400px; clear: left; }
120
+
121
+ #tuneup #tuneup-details ul ul.fiveruns_tuneup_children { background: #111; }
122
+ #tuneup #tuneup-details ul ul dd { margin-left: 406px; }
123
+ #tuneup #tuneup-details ul ul dt { width: 396px; }
124
+
125
+ #tuneup #tuneup-details ul ul ul.fiveruns_tuneup_children { background: #222;}
126
+ #tuneup #tuneup-details ul ul ul dd { margin-left: 402px; }
127
+ #tuneup #tuneup-details ul ul ul dt { width: 392px; }
128
+
129
+
130
+ #tuneup #tuneup-details ul ul ul ul.fiveruns_tuneup_children { background: #333;}
131
+ #tuneup #tuneup-details ul ul ul ul dd { margin-left: 398px; }
132
+ #tuneup #tuneup-details ul ul ul ul dt { width: 388px; }
133
+
134
+
135
+ #tuneup #tuneup-details ul ul ul ul ul.fiveruns_tuneup_children { background: #444;}
136
+ #tuneup #tuneup-details ul ul ul ul ul dd { margin-left: 394px; }
137
+ #tuneup #tuneup-details ul ul ul ul ul dt { width: 384px; }
138
+
139
+
140
+ #tuneup #tuneup-details ul ul ul ul ul ul.fiveruns_tuneup_children { background: #555;}
141
+ #tuneup #tuneup-details ul ul ul ul ul ul dd { margin-left: 390px; }
142
+ #tuneup #tuneup-details ul ul ul ul ul ul dt { width: 380px; }
143
+
144
+ #tuneup #tuneup-details ul ul ul ul ul ul ul.fiveruns_tuneup_children { background: #666;}
145
+ #tuneup #tuneup-details ul ul ul ul ul ul ul dd { margin-left: 386px; }
146
+ #tuneup #tuneup-details ul ul ul ul ul ul ul dt { width: 376px; }
147
+
148
+ #tuneup #tuneup-details ul ul ul ul ul ul ul ul dd { margin-left: 382px; }
149
+ #tuneup #tuneup-details ul ul ul ul ul ul ul ul dt { width: 372px; }
150
+
151
+ #tuneup #tuneup-details ul ul ul ul ul ul ul ul ul dd { margin-left: 378px; }
152
+ #tuneup #tuneup-details ul ul ul ul ul ul ul ul ul dt { width: 368px; }
153
+
154
+ #tuneup-flash { display: none; text-align: left; font-size: 12px; padding: 5px; color: #000; border-bottom: 1px #000 solid; }
155
+ #tuneup-flash emph { color: #666; font-style: italic; }
156
+ #tuneup-flash p { font-family: sans-serif; margin: 0; }
157
+ #tuneup-flash p { padding: 0; padding-left: 20px; font-family: sans-serif; background: none; color: #000; border: 0; }
158
+ #tuneup-flash.tuneup-show { display: block; }
159
+ #tuneup-flash.tuneup-error { background: #FDFCDB; }
160
+ #tuneup-flash.tuneup-error p { background: url(/images/tuneup/warning.gif) 0 50% no-repeat; }
161
+ #tuneup-flash.tuneup-notice { padding-left: 0; background: #E4FFDE; }
162
+
163
+ #tuneup #tuneup-details .tuneup-bar { width: 300px; height: 20px; padding: 0; margin: 0 !important; overflow: hidden; }
164
+ #tuneup #tuneup-details .tuneup-bar li { height: 18px; padding: 0; margin: 0 !important; }
165
+
166
+ #tuneup #tuneup-details a.tuneup-sql { color: 001999; margin-left: 10px; }
167
+ #tuneup #tuneup-details a img { border: 0; }
168
+
169
+ #tuneup .tuneup-halo { display: none; margin-left: 4px; }
170
+ #tuneup .tuneup-step-info:hover .tuneup-halo { display: inline; }
171
+
172
+ #tuneup textarea { background: none; overflow: auto; color: #fff; font-size: 12px; font-family: sans-serif; padding: 4px; border: 0; font-family: monospace; }
173
+ #tuneup table { border: 0; margin-top: 4px; background: #111; } /* sql */
174
+ #tuneup th { background: #000; padding: 4px; color: #fff; font-size: 12px; text-align: left; border: 0; font-weight: bold; border: 1px #333 solid; border-left: 0; border-top: 0; }
175
+ #tuneup td { background: #111; padding: 4px; color: #ddd; font-size: 12px; text-align: left; border: 0; }
176
+
177
+ #tuneup #tuneup-schema { display: none; position: absolute; top: 46px; right: 735px; padding: 9px; text-align: left; z-index: 10998; background: #000; opacity: 0.85; color: #ddd; overflow: hidden; -moz-border-radius: 6px; }
178
+
179
+ #tuneup h1 {
180
+ background: transparent url(/images/tuneup/logo_clear.png) center left no-repeat;
181
+ border: 0;
182
+ color: white;
183
+ display: block;
184
+ float: left;
185
+ font-family: 'Helvetica Neue';
186
+ font-size: 18px;
187
+ font-weight: bold;
188
+ height: 50px;
189
+ letter-spacing: 1px;
190
+ line-height: 50px;
191
+ margin: 0 18px 0 18px;
192
+ padding: 0 0 0 38px;
193
+ text-shadow: rgb(0, 0, 0) -1px -1px 0px;
194
+ vertical-align: middle;
195
+ }
196
+
197
+ #tuneup #tuneup-schema h3 { color: #fff; font-weight: bold; font-size: 14px; margin-bottom: 5px; }
198
+ #tuneup #tuneup-data:hover #tuneup-schema { display: block; }
199
+ #tuneup #tuneup-schema table, #tuneup #tuneup-schema tr { background: transparent; }
200
+ #tuneup #tuneup-schema th { background: #111; color: #fff; border: 0 }
201
+ #tuneup #tuneup-schema td { background: #000; font-family: monospace; color: #ddd; padding: 1px; font-size: 11px; }
202
+ #tuneup #tuneup-trend { float: right; width: 100px; }
203
+
204
+ #tuneup button { background: none; border: 0; margin: 0; padding: 0; height: 50px; line-height: 50px; vertical-align: middle; }
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+ require File.dirname(__FILE__) << "/../lib/fiveruns/tuneup/version"
5
+
6
+ # For older Rails versions
7
+ # USAGE: fiveruns_manage [RAILS_ROOT]
8
+ plugin_dir = File.join(ARGV[0] || Dir.pwd, 'vendor/plugins')
9
+ unless File.directory?(plugin_dir)
10
+ abort "FiveRuns TuneUp: #{plugin_dir} does not exist; cannot install plugin"
11
+ end
12
+
13
+ FileUtils.rm_rf File.join(plugin_dir, 'fiveruns_tuneup') rescue nil
14
+
15
+ File.readlines(File.dirname(__FILE__) << "/../Manifest").each do |line|
16
+ stub = line.strip
17
+ origin = File.dirname(__FILE__) << "/../#{stub}"
18
+ next if origin =~ /\/fiveruns_tuneup$/
19
+ if File.file?(origin)
20
+ destination = File.join(plugin_dir, 'fiveruns_tuneup', stub)
21
+ FileUtils.mkdir_p File.dirname(destination)
22
+ FileUtils.cp origin, destination
23
+ end
24
+ end
25
+
26
+ STDERR.puts "Installed FiveRuns TuneUp (#{Fiveruns::Tuneup::Version::STRING}) in vendor/plugins/fiveruns_tuneup"
@@ -0,0 +1,49 @@
1
+
2
+ # Gem::Specification for Fiveruns_tuneup-0.8.2
3
+ # Originally generated by Echoe
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = %q{fiveruns_tuneup}
7
+ s.version = "0.8.2"
8
+
9
+ s.specification_version = 2 if s.respond_to? :specification_version=
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.authors = ["FiveRuns Development Team"]
13
+ s.date = %q{2008-05-30}
14
+ s.default_executable = %q{fiveruns_tuneup}
15
+ s.description = %q{Instrumentation for the FiveRuns TuneUp product.}
16
+ s.email = %q{dev@fiveruns.com}
17
+ s.executables = ["fiveruns_tuneup"]
18
+ s.extra_rdoc_files = ["bin/fiveruns_tuneup", "lib/bumpspark_helper.rb", "lib/fiveruns/tuneup/asset_tags.rb", "lib/fiveruns/tuneup/custom_methods.rb", "lib/fiveruns/tuneup/environment.rb", "lib/fiveruns/tuneup/instrumentation/action_controller/base.rb", "lib/fiveruns/tuneup/instrumentation/action_view/base.rb", "lib/fiveruns/tuneup/instrumentation/active_record/base.rb", "lib/fiveruns/tuneup/instrumentation/cgi/session.rb", "lib/fiveruns/tuneup/instrumentation/utilities.rb", "lib/fiveruns/tuneup/multipart.rb", "lib/fiveruns/tuneup/runs.rb", "lib/fiveruns/tuneup/schema.rb", "lib/fiveruns/tuneup/step.rb", "lib/fiveruns/tuneup/urls.rb", "lib/fiveruns/tuneup/version.rb", "lib/fiveruns/tuneup.rb", "lib/fiveruns_tuneup.rb", "lib/tuneup_config.rb", "lib/tuneup_controller.rb", "lib/tuneup_helper.rb", "README.rdoc", "tasks/assets.rake"]
19
+ s.files = ["assets/images/arrows.gif", "assets/images/edit.png", "assets/images/fade.png", "assets/images/fade_down.png", "assets/images/head.gif", "assets/images/logo.gif", "assets/images/logo_clear.png", "assets/images/magnify.png", "assets/images/pip.gif", "assets/images/pointer.gif", "assets/images/schema.png", "assets/images/signin.gif", "assets/images/spinner.gif", "assets/images/warning.gif", "assets/javascripts/prototype.js", "assets/javascripts/tuneup.js", "assets/stylesheets/tuneup.css", "bin/fiveruns_tuneup", "History.rdoc", "init.rb", "install.rb", "lib/bumpspark_helper.rb", "lib/fiveruns/tuneup/asset_tags.rb", "lib/fiveruns/tuneup/custom_methods.rb", "lib/fiveruns/tuneup/environment.rb", "lib/fiveruns/tuneup/instrumentation/action_controller/base.rb", "lib/fiveruns/tuneup/instrumentation/action_view/base.rb", "lib/fiveruns/tuneup/instrumentation/active_record/base.rb", "lib/fiveruns/tuneup/instrumentation/cgi/session.rb", "lib/fiveruns/tuneup/instrumentation/utilities.rb", "lib/fiveruns/tuneup/multipart.rb", "lib/fiveruns/tuneup/runs.rb", "lib/fiveruns/tuneup/schema.rb", "lib/fiveruns/tuneup/step.rb", "lib/fiveruns/tuneup/urls.rb", "lib/fiveruns/tuneup/version.rb", "lib/fiveruns/tuneup.rb", "lib/fiveruns_tuneup.rb", "lib/tuneup_config.rb", "lib/tuneup_controller.rb", "lib/tuneup_helper.rb", "Manifest", "rails/init.rb", "Rakefile", "README.rdoc", "tasks/assets.rake", "test/test_helper.rb", "test/tuneup_test.rb", "uninstall.rb", "views/tuneup/_data.html.erb", "views/tuneup/_flash.html.erb", "views/tuneup/_link.html.erb", "views/tuneup/_schema.html.erb", "views/tuneup/_sql.html.erb", "views/tuneup/_step.html.erb", "views/tuneup/panel/_registered.html.erb", "views/tuneup/panel/_unregistered.html.erb", "fiveruns_tuneup.gemspec"]
20
+ s.has_rdoc = true
21
+ s.homepage = %q{http://github.com/fiveruns/fiveruns_tuneup}
22
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Fiveruns_tuneup", "--main", "README.rdoc"]
23
+ s.require_paths = ["lib"]
24
+ s.rubyforge_project = %q{fiveruns}
25
+ s.rubygems_version = %q{1.1.1}
26
+ s.summary = %q{Instrumentation for the FiveRuns TuneUp product.}
27
+ s.test_files = ["test/test_helper.rb", "test/tuneup_test.rb"]
28
+
29
+ s.add_dependency(%q<activesupport>, [">= 0"])
30
+ end
31
+
32
+
33
+ # # Original Rakefile source (requires the Echoe gem):
34
+ #
35
+ # require 'rubygems'
36
+ # require 'echoe'
37
+ #
38
+ # require File.dirname(__FILE__) << "/lib/fiveruns/tuneup/version"
39
+ #
40
+ # Echoe.new 'fiveruns_tuneup' do |p|
41
+ # p.version = Fiveruns::Tuneup::Version::STRING
42
+ # p.author = "FiveRuns Development Team"
43
+ # p.email = 'dev@fiveruns.com'
44
+ # p.project = 'fiveruns'
45
+ # p.summary = "Instrumentation for the FiveRuns TuneUp product."
46
+ # p.url = "http://github.com/fiveruns/fiveruns_tuneup"
47
+ # p.dependencies = %w(activesupport)
48
+ # p.include_rakefile = true
49
+ # end
data/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ # For Rails < 2.0.991
2
+ require File.dirname(__FILE__) << "/rails/init"
data/install.rb ADDED
@@ -0,0 +1,18 @@
1
+ # Allow linking (for development)
2
+ method = ENV['LINK'] ? :ln_s : :cp
3
+ installed = false
4
+ Dir[File.dirname(__FILE__) << "/assets/*"].each do |location|
5
+ directory = File.basename(location)
6
+ destination = File.join(RAILS_ROOT, 'public', directory, 'tuneup')
7
+ FileUtils.mkdir_p(destination) rescue nil
8
+ Dir[File.join(location, '*')].each do |file|
9
+ new_filename = File.join(destination, File.basename(file))
10
+ unless File.exists?(new_filename)
11
+ FileUtils.send(method, file, new_filename)
12
+ installed = true
13
+ end
14
+ end
15
+ end
16
+ if installed
17
+ STDERR.puts "FiveRuns TuneUp: Installed assets in public/"
18
+ end
@@ -0,0 +1,52 @@
1
+ require 'base64'
2
+ require 'zlib'
3
+
4
+ # Note: This is a modified copy of _why's `bumpspark' library,
5
+ # discussed and collaborated on at:
6
+ # http://redhanded.hobix.com/inspect/sparklinesForMinimalists.html
7
+ # Many thanks to the various collaborators; _why (concept), MenTaLguY (transparency), and jzp (png)
8
+ module BumpsparkHelper
9
+
10
+ def build_png_chunk(type,data)
11
+ to_check = type + data
12
+ return [data.length].pack("N") + to_check + [Zlib.crc32(to_check)].pack("N")
13
+ end
14
+
15
+ def build_png(image_rows)
16
+ header = [137, 80, 78, 71, 13, 10, 26, 10].pack("C*")
17
+ raw_data = image_rows.map { |row| [0] + row }.flatten.pack("C*")
18
+ ihdr_data = [ image_rows.first.length,image_rows.length,
19
+ 8,2,0,0,0].pack("NNCCCCC")
20
+ ihdr = build_png_chunk("IHDR", ihdr_data)
21
+ trns = build_png_chunk("tRNS", ([ 0 ]*6).pack("C6"))
22
+ idat = build_png_chunk("IDAT", Zlib::Deflate.deflate(raw_data))
23
+ iend = build_png_chunk("IEND", "")
24
+
25
+ return header + ihdr + trns + idat + iend
26
+ end
27
+ def bumpspark(results)
28
+ black = [0, 0, 0]
29
+ white, red, grey = [0xFF,0xFF,0xFF], [0xFF,0,0], [0x99,0x99,0x99]
30
+ rows = normalize(results).inject([]) do |ary, r|
31
+ ary << [black]*15 << [black]*15
32
+ ary.last[r/9,4] = [(r > 50 and red or grey)]*4
33
+ ary
34
+ end.transpose.reverse
35
+ return build_png(rows)
36
+ end
37
+ def build_data_url(type,data)
38
+ data = Base64.encode64(data).delete("\n")
39
+ return "data:#{type};base64,#{CGI.escape(data)}"
40
+ end
41
+
42
+ def normalize(results)
43
+ min, max = results.min, results.max
44
+ width = max - min
45
+ return [1] * results.size if width == 0
46
+ width += (300 * 1000)
47
+ results.map do |result|
48
+ ((result - min) * 100 / width.to_f).to_i
49
+ end
50
+ end
51
+
52
+ end
@@ -0,0 +1,103 @@
1
+ require File.dirname(__FILE__) << "/tuneup/step"
2
+
3
+ require 'digest/sha1'
4
+ require 'yaml'
5
+ require 'zlib'
6
+
7
+ module Fiveruns
8
+ module Tuneup
9
+
10
+ LOGGER = Logger.new('log/tuneup.log')
11
+
12
+ class << self
13
+
14
+ include Fiveruns::Tuneup::Urls
15
+ include Fiveruns::Tuneup::AssetTags
16
+ include Fiveruns::Tuneup::Runs
17
+ include Fiveruns::Tuneup::Instrumentation::Utilities
18
+ include Fiveruns::Tuneup::Environment
19
+ include Fiveruns::Tuneup::Schema
20
+
21
+ attr_writer :collecting
22
+ attr_accessor :running
23
+ attr_reader :trend
24
+
25
+ def run(controller, request)
26
+ @running = (!controller.is_a?(TuneupController) && !request.xhr?)
27
+ result = nil
28
+ record controller, request do
29
+ result = yield
30
+ end
31
+ @running = false
32
+ result
33
+ end
34
+
35
+ def collecting
36
+ if defined?(@collecting)
37
+ @collecting
38
+ else
39
+ @collecting = true
40
+ end
41
+ end
42
+
43
+ def record(controller, request)
44
+ if recording?
45
+ @stack = [Fiveruns::Tuneup::RootStep.new]
46
+ @trend = nil
47
+ @environment = environment
48
+ yield
49
+ log :info, "Persisting for #{request.url} using stub #{stub(request.url)}"
50
+ data = @stack.shift
51
+ persist(generate_run_id(request.url, data.time), @environment, schemas, data)
52
+ elsif !@running
53
+ # Plugin displaying the data
54
+ # TODO: Support targeted selection (for historical run)
55
+ if request.parameters['uri']
56
+ last_id = last_run_id_for(request.parameters['uri'])
57
+ log :info, "Retrieved last run id of #{last_id} for #{request.parameters['uri']} using stub #{stub(request.parameters['uri'])}"
58
+ if last_id && (data = retrieve_run(last_id))
59
+ @stack = [data]
60
+ @trend = trend_for(last_id)
61
+ else
62
+ log :debug, "No stack found"
63
+ clear_stack
64
+ end
65
+ else
66
+ clear_stack
67
+ end
68
+ yield
69
+ else
70
+ yield
71
+ end
72
+ clear_stack
73
+ end
74
+
75
+ def recording?
76
+ @running && @collecting
77
+ end
78
+
79
+ def start
80
+ log :info, "Starting..."
81
+ install_instrumentation
82
+ log :debug, "Using collector at #{collector_url}"
83
+ log :debug, "Using frontend at #{frontend_url}"
84
+ end
85
+
86
+ def log(level, text)
87
+ LOGGER.send(level, "FiveRuns TuneUp (v#{Fiveruns::Tuneup::Version::STRING}): #{text}")
88
+ end
89
+
90
+ #######
91
+ private
92
+ #######
93
+
94
+ def clear_stack
95
+ @stack = nil
96
+ @exclusion_stack = nil
97
+ end
98
+
99
+ end
100
+
101
+ end
102
+ end
103
+