ghazel-fiveruns_tuneup 0.8.22
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +33 -0
- data/CONTRIBUTORS +5 -0
- data/README.rdoc +65 -0
- data/assets/images/arrows.gif +0 -0
- data/assets/images/edit.png +0 -0
- data/assets/images/fade.png +0 -0
- data/assets/images/fade_down.png +0 -0
- data/assets/images/head.gif +0 -0
- data/assets/images/logo.gif +0 -0
- data/assets/images/logo_clear.png +0 -0
- data/assets/images/magnify.png +0 -0
- data/assets/images/pin.png +0 -0
- data/assets/images/pip.gif +0 -0
- data/assets/images/pointer.gif +0 -0
- data/assets/images/pushed_pin.png +0 -0
- data/assets/images/schema.png +0 -0
- data/assets/images/signin.gif +0 -0
- data/assets/images/spinner.gif +0 -0
- data/assets/images/warning.gif +0 -0
- data/assets/javascripts/init.js +12 -0
- data/assets/javascripts/prototype.js +2515 -0
- data/assets/javascripts/tuneup.js +115 -0
- data/assets/stylesheets/tuneup.css +209 -0
- data/init.rb +2 -0
- data/install.rb +13 -0
- data/lib/bumpspark_helper.rb +52 -0
- data/lib/fiveruns/tuneup.rb +154 -0
- data/lib/fiveruns/tuneup/asset_tags.rb +54 -0
- data/lib/fiveruns/tuneup/configuration.rb +25 -0
- data/lib/fiveruns/tuneup/custom_methods.rb +8 -0
- data/lib/fiveruns/tuneup/environment.rb +29 -0
- data/lib/fiveruns/tuneup/instrumentation/action_controller/base.rb +59 -0
- data/lib/fiveruns/tuneup/instrumentation/action_view/base.rb +81 -0
- data/lib/fiveruns/tuneup/instrumentation/action_view/partial_template.rb +28 -0
- data/lib/fiveruns/tuneup/instrumentation/active_record/base.rb +126 -0
- data/lib/fiveruns/tuneup/instrumentation/cgi/session.rb +30 -0
- data/lib/fiveruns/tuneup/instrumentation/utilities.rb +187 -0
- data/lib/fiveruns/tuneup/multipart.rb +75 -0
- data/lib/fiveruns/tuneup/routing.rb +25 -0
- data/lib/fiveruns/tuneup/runs.rb +86 -0
- data/lib/fiveruns/tuneup/schema.rb +43 -0
- data/lib/fiveruns/tuneup/step.rb +221 -0
- data/lib/fiveruns/tuneup/version.rb +89 -0
- data/lib/fiveruns_tuneup.rb +11 -0
- data/lib/tuneup_controller.rb +46 -0
- data/lib/tuneup_helper.rb +181 -0
- data/rails/init.rb +14 -0
- data/tasks/assets.rake +32 -0
- data/test/test_helper.rb +3 -0
- data/test/tuneup_test.rb +0 -0
- data/uninstall.rb +6 -0
- data/views/tuneup/_data.html.erb +15 -0
- data/views/tuneup/_flash.html.erb +6 -0
- data/views/tuneup/_link.html.erb +1 -0
- data/views/tuneup/_schema.html.erb +17 -0
- data/views/tuneup/_sql.html.erb +23 -0
- data/views/tuneup/_step.html.erb +17 -0
- data/views/tuneup/panel/_show.html.erb +4 -0
- data/views/tuneup/sandbox.html.erb +6 -0
- metadata +124 -0
@@ -0,0 +1,115 @@
|
|
1
|
+
var _window = window.parent, // window obj of the main page
|
2
|
+
_document = _window.document, // document obj of the main page
|
3
|
+
TuneUp = _window.TuneUp; // TuneUp obj from declared on main page
|
4
|
+
|
5
|
+
var _$ = $; // rename Protoype bling
|
6
|
+
// our new bling will reference our main window then call Prototype bling
|
7
|
+
$ = function(element) {
|
8
|
+
if(typeof element == 'string') {
|
9
|
+
element = _document.getElementById(element);
|
10
|
+
}
|
11
|
+
|
12
|
+
return _$(element);
|
13
|
+
};
|
14
|
+
|
15
|
+
var _$$ = $$; // rename Protoype double bling
|
16
|
+
// our new double bling will reference our main window then call Prototype bling
|
17
|
+
$$ = function() {
|
18
|
+
return Selector.findChildElements(_document, $A(arguments));
|
19
|
+
}
|
20
|
+
|
21
|
+
// ensures that Prototypes Element.extend actually exstend another frames node
|
22
|
+
_nativeExtensions = false;
|
23
|
+
|
24
|
+
_window.TuneUpSandbox = window;
|
25
|
+
|
26
|
+
|
27
|
+
TuneUp.switchSchema = function(table) {
|
28
|
+
var element = $('tuneup-schema-table-' + table);
|
29
|
+
var operation = element.visible() ? 'hide' : 'show';
|
30
|
+
$$('#tuneup-schema .tuneup-schema-table').each(function(s) { s.hide(); })
|
31
|
+
element[operation]();
|
32
|
+
$('tuneup-schema')[operation]();
|
33
|
+
}
|
34
|
+
TuneUp.Spinner = {
|
35
|
+
start: function() { $('tuneup_spinner').show(); },
|
36
|
+
stop: function() { $('tuneup_spinner').hide(); }
|
37
|
+
}
|
38
|
+
|
39
|
+
TuneUp.adjustElement = function(e) {
|
40
|
+
var top = parseFloat(Element.getStyle(e, 'top') || 0);
|
41
|
+
var adjust = 0;
|
42
|
+
|
43
|
+
if ($('tuneup-flash').hasClassName('tuneup-show')) {
|
44
|
+
if (!e.hasClassName('tuneup-flash-adjusted')) {
|
45
|
+
adjust = 27;
|
46
|
+
e.addClassName('tuneup-flash-adjusted');
|
47
|
+
}
|
48
|
+
}
|
49
|
+
else {
|
50
|
+
if (e.hasClassName('tuneup-flash-adjusted')) {
|
51
|
+
adjust = -27;
|
52
|
+
e.removeClassName('tuneup-flash-adjusted');
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
if (e.hasClassName('tuneup-adjusted'))
|
57
|
+
e.style.top = (top + adjust) + 'px';
|
58
|
+
else {
|
59
|
+
e.style.top = (top + 50 + adjust) + 'px';
|
60
|
+
e.addClassName('tuneup-adjusted')
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
TuneUp.adjustFixedElements = function(e) {
|
65
|
+
$(_document.body).descendants().each(function(e) {
|
66
|
+
var pos = Element.getStyle(e, 'position');
|
67
|
+
if (pos == 'fixed') {
|
68
|
+
TuneUp.adjustElement(e);
|
69
|
+
}
|
70
|
+
});
|
71
|
+
}
|
72
|
+
|
73
|
+
TuneUp.adjustAbsoluteElements = function(e) {
|
74
|
+
$(e).immediateDescendants().each(function (e) {
|
75
|
+
if (e.id == "tuneup") {
|
76
|
+
return;
|
77
|
+
}
|
78
|
+
var pos = Element.getStyle(e, 'position');
|
79
|
+
if (pos == 'absolute') {
|
80
|
+
TuneUp.adjustElement(e);
|
81
|
+
TuneUp.adjustAbsoluteElements(e);
|
82
|
+
}
|
83
|
+
else if (pos == 'relative') {
|
84
|
+
// do nothing
|
85
|
+
}
|
86
|
+
else {
|
87
|
+
TuneUp.adjustAbsoluteElements(e);
|
88
|
+
}
|
89
|
+
});
|
90
|
+
}
|
91
|
+
|
92
|
+
TuneUp.pinToggle = function(e) {
|
93
|
+
$("tuneup-data").toggleClassName("pin");
|
94
|
+
if ($("tuneup-data").hasClassName("pin")) {
|
95
|
+
$("tuneup-pin").src = "/images/tuneup/pushed_pin.png";
|
96
|
+
} else {
|
97
|
+
$("tuneup-pin").src = "/images/tuneup/pin.png";
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
Event.observe(window, 'load', function() {
|
102
|
+
new Insertion.Top(_document.body, "<div id='tuneup'><h1>TuneUp</h1><img id='tuneup_spinner' style='display:none' src='/images/tuneup/spinner.gif' alt=''/><div id='tuneup-content' style='display:block'></div></div><div id='tuneup-flash'></div>");
|
103
|
+
|
104
|
+
TuneUp.adjustAbsoluteElements(_document.body);
|
105
|
+
TuneUp.adjustFixedElements();
|
106
|
+
|
107
|
+
new Ajax.Request('/tuneup?uri=' + encodeURIComponent(_document.location.href), {
|
108
|
+
asynchronous : true,
|
109
|
+
evalScripts : true,
|
110
|
+
onLoading : TuneUp.Spinner.start,
|
111
|
+
onComplete : TuneUp.Spinner.stop
|
112
|
+
});
|
113
|
+
});
|
114
|
+
|
115
|
+
|
@@ -0,0 +1,209 @@
|
|
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 { position: relative; 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: 220px; 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.tuneup-full { height: 50px; line-height: 50px; vertical-align: middle; padding: 0; background-color: transparent; }
|
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-data { position: relative;}
|
71
|
+
#tuneup #tuneup-top { position: absolute; top: 0px; right: 10px; padding: 0; margin: 0 0 0 150px; z-index: 11000; }
|
72
|
+
#tuneup #tuneup-top #tuneup-save-link { float: right; line-height: 45px; vertical-align: bottom; text-align: center; font-weight: bold; padding: 0 9px 0 20px; background: url(/images/tuneup/pointer.gif) 0 50% no-repeat; }
|
73
|
+
#tuneup #tuneup-back-to-run-link { float: right; line-height: 15px; vertical-align: bottom; text-align: center; padding: 8px; background-color: #333; -moz-border-radius: 5px; margin: 7px 10px 0px 0px; border: 1px solid black;}
|
74
|
+
#tuneup #tuneup-summary {float: right; padding: 9px; width: 400px; padding-bottom: 17px; margin-top: 3px; text-align: center; color: #ddd; -moz-border-radius: 6px 6px 0 0; }
|
75
|
+
|
76
|
+
#tuneup #tuneup-data:hover #tuneup-summary { /* h */
|
77
|
+
border-bottom: 0px;
|
78
|
+
background: #000;
|
79
|
+
}
|
80
|
+
|
81
|
+
#tuneup #tuneup-data.pin #tuneup-summary { /* h */
|
82
|
+
border-bottom: 0px;
|
83
|
+
background: #000;
|
84
|
+
}
|
85
|
+
|
86
|
+
#tuneup #tuneup-details { display: none; position: absolute; top: 46px; right: 10px; padding: 9px; text-align: left; z-index: 10999;}
|
87
|
+
#tuneup #tuneup-data:hover #tuneup-details { /* h */
|
88
|
+
display: block;
|
89
|
+
background: #000;
|
90
|
+
min-width: 300px;
|
91
|
+
-moz-border-radius: 6px 0 6px 6px;
|
92
|
+
}
|
93
|
+
|
94
|
+
#tuneup #tuneup-data.pin #tuneup-details { /* h */
|
95
|
+
display: block;
|
96
|
+
background: #000;
|
97
|
+
min-width: 300px;
|
98
|
+
-moz-border-radius: 6px 0 6px 6px;
|
99
|
+
}
|
100
|
+
|
101
|
+
#tuneup ul#tuneup-details ul.tuneup-step-info { margin: 0; padding: 0; }
|
102
|
+
#tuneup ul#tuneup-details li.tuneup-title { float: left; overflow: hidden; height: 20px; margin: 0 10px 0 0; padding: 0; color: #ddd; font-size: 12px; text-transform: none; font-weight: inherit;}
|
103
|
+
#tuneup ul#tuneup-details li.tuneup-title p { background-color: transparent; }
|
104
|
+
#tuneup ul#tuneup-details li.tuneup-title strong { color: #fff; font-weight: bold; }
|
105
|
+
#tuneup ul#tuneup-details li.tuneup-title span.time { float: right; text-transform: none; font-size: 11px; font-weight: normal; margin-right: 0px; }
|
106
|
+
|
107
|
+
#tuneup ul#tuneup-details li.tuneup-title a, ul#tuneup-details li.tuneup-title a:active, ul#tuneup-details li.tuneup-title a:visited {
|
108
|
+
color: inherit;
|
109
|
+
font-size: inherit;
|
110
|
+
font-weight: inherit;
|
111
|
+
text-decoration: none;
|
112
|
+
text-align: left;
|
113
|
+
position: inherit;
|
114
|
+
}
|
115
|
+
|
116
|
+
#tuneup .tuneup-bar li { text-align: center; }
|
117
|
+
|
118
|
+
#tuneup #tuneup-details li.fiveruns_tuneup_step { clear: left; padding: 0 0 0 4px; background: url(/images/tuneup/pip.gif) 4px 0 no-repeat; margin: 2px 0; }
|
119
|
+
#tuneup #tuneup-details li.fiveruns_tuneup_step.with-children { background: url(/images/tuneup/arrows.gif) 4px 0 no-repeat;}
|
120
|
+
#tuneup #tuneup-details li.fiveruns_tuneup_step.with-children.tuneup-opened { background: url(/images/tuneup/arrows.gif) 4px -20px no-repeat; }
|
121
|
+
|
122
|
+
#tuneup ul#tuneup-details span.time { margin-right: 12px; }
|
123
|
+
|
124
|
+
#tuneup li .children { display: none; }
|
125
|
+
|
126
|
+
#tuneup_spinner { position: absolute; z-index: 11002; top: 15px; right: 30px; }
|
127
|
+
|
128
|
+
#tuneup ul#tuneup-details li.tuneup-detail-bar {
|
129
|
+
float:left;
|
130
|
+
margin: 0 0 0 0;
|
131
|
+
height: 20px;
|
132
|
+
width: 300px;
|
133
|
+
padding: 0;
|
134
|
+
}
|
135
|
+
#tuneup ul#tuneup-details li.tuneup-title { padding-left: 16px; width: 400px; }
|
136
|
+
|
137
|
+
#tuneup ul#tuneup-details ul.fiveruns_tuneup_children { background: #111; }
|
138
|
+
#tuneup ul#tuneup-details ul li.tuneup-title { width: 396px; }
|
139
|
+
|
140
|
+
#tuneup ul#tuneup-details ul ul.fiveruns_tuneup_children { background: #222;}
|
141
|
+
#tuneup ul#tuneup-details ul ul li.tuneup-title { width: 392px; }
|
142
|
+
|
143
|
+
#tuneup ul#tuneup-details ul ul ul.fiveruns_tuneup_children { background: #333;}
|
144
|
+
#tuneup ul#tuneup-details ul ul ul li.tuneup-title { width: 388px; }
|
145
|
+
|
146
|
+
#tuneup ul#tuneup-details ul ul ul ul.fiveruns_tuneup_children { background: #444;}
|
147
|
+
#tuneup ul#tuneup-details ul ul ul ul li.tuneup-title { width: 384px; }
|
148
|
+
|
149
|
+
#tuneup ul#tuneup-details ul ul ul ul ul.fiveruns_tuneup_children { background: #555;}
|
150
|
+
#tuneup ul#tuneup-details ul ul ul ul ul li.tuneup-title { width: 380px; }
|
151
|
+
|
152
|
+
#tuneup ul#tuneup-details ul ul ul ul ul ul.fiveruns_tuneup_children { background: #666;}
|
153
|
+
|
154
|
+
#tuneup ul#tuneup-details ul ul ul ul ul ul li.tuneup-title { width: 376px; }
|
155
|
+
#tuneup ul#tuneup-details ul ul ul ul ul ul ul li.tuneup-title { width: 372px; }
|
156
|
+
#tuneup ul#tuneup-details ul ul ul ul ul ul ul ul li.tuneup-title { width: 368px; }
|
157
|
+
|
158
|
+
#tuneup-flash { display: none; text-align: left; font-size: 12px; padding: 5px; color: #000; border-bottom: 1px #000 solid; }
|
159
|
+
#tuneup-flash emph { color: #666; font-style: italic; }
|
160
|
+
#tuneup-flash p { font-family: sans-serif; margin: 0; }
|
161
|
+
#tuneup-flash p { padding: 0; padding-left: 20px; font-family: sans-serif; background: none; color: #000; border: 0; }
|
162
|
+
#tuneup-flash.tuneup-show { display: block; }
|
163
|
+
#tuneup-flash.tuneup-error { background: #FDFCDB; }
|
164
|
+
#tuneup-flash.tuneup-error p { background: url(/images/tuneup/warning.gif) 0 50% no-repeat; }
|
165
|
+
#tuneup-flash.tuneup-notice { padding-left: 0; background: #E4FFDE; }
|
166
|
+
|
167
|
+
#tuneup #tuneup-details .tuneup-bar { width: 300px; height: 20px; padding: 0; margin: 0 !important; }
|
168
|
+
#tuneup #tuneup-details .tuneup-bar li { height: 20px; padding: 0; margin: 0 !important; }
|
169
|
+
|
170
|
+
#tuneup #tuneup-details a.tuneup-sql { color: 001999; margin-left: 10px; }
|
171
|
+
#tuneup #tuneup-details a img { border: 0; }
|
172
|
+
|
173
|
+
#tuneup .tuneup-halo { display: none; margin-left: 4px; }
|
174
|
+
#tuneup .tuneup-step-info:hover .tuneup-halo { display: inline; }
|
175
|
+
|
176
|
+
#tuneup textarea { background: none; overflow: auto; color: #fff; font-size: 12px; font-family: sans-serif; padding: 4px; border: 0; font-family: monospace; }
|
177
|
+
#tuneup table { border: 0; margin-top: 4px; background: #111; } /* sql */
|
178
|
+
#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; }
|
179
|
+
#tuneup td { background: #111; padding: 4px; color: #ddd; font-size: 12px; text-align: left; border: 0; }
|
180
|
+
|
181
|
+
#tuneup #tuneup-schema { display: none; position: absolute; top: 46px; right: 754px; padding: 9px; text-align: left; z-index: 10998; background: #000; opacity: 0.85; color: #ddd; overflow: hidden; -moz-border-radius: 6px; }
|
182
|
+
|
183
|
+
#tuneup h1 {
|
184
|
+
border: 0;
|
185
|
+
color: white;
|
186
|
+
display: block;
|
187
|
+
float: left;
|
188
|
+
font-family: 'Helvetica Neue';
|
189
|
+
font-size: 18px;
|
190
|
+
font-weight: bold;
|
191
|
+
height: 50px;
|
192
|
+
letter-spacing: 1px;
|
193
|
+
line-height: 50px;
|
194
|
+
margin: 0 18px 0 18px;
|
195
|
+
text-shadow: rgb(0, 0, 0) -1px -1px 0px;
|
196
|
+
vertical-align: middle;
|
197
|
+
}
|
198
|
+
|
199
|
+
#tuneup #tuneup-schema h3 { color: #fff; font-weight: bold; font-size: 14px; margin-bottom: 5px; }
|
200
|
+
#tuneup #tuneup-data:hover #tuneup-schema { display: block; }
|
201
|
+
#tuneup #tuneup-data.pin #tuneup-schema { display: block; }
|
202
|
+
#tuneup #tuneup-schema table, #tuneup #tuneup-schema tr { background: transparent; }
|
203
|
+
#tuneup #tuneup-schema th { background: #111; color: #fff; border: 0 }
|
204
|
+
#tuneup #tuneup-schema td { background: #000; font-family: monospace; color: #ddd; padding: 1px; font-size: 11px; }
|
205
|
+
#tuneup #tuneup-trend { float: right; width: 100px; }
|
206
|
+
|
207
|
+
#tuneup button { background: none; border: 0; margin: 0; padding: 0; height: 50px; line-height: 50px; vertical-align: middle; }
|
208
|
+
|
209
|
+
a.tuneup-step-link { padding-left: 20px; margin-left: -20px; outline: none;}
|
data/init.rb
ADDED
data/install.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
installed = false
|
2
|
+
Dir[File.dirname(__FILE__) << "/assets/*"].each do |location|
|
3
|
+
directory = File.basename(location)
|
4
|
+
destination = File.join(RAILS_ROOT, 'public', directory, 'tuneup')
|
5
|
+
FileUtils.rm_rf(destination) rescue nil
|
6
|
+
FileUtils.mkdir_p(destination)
|
7
|
+
Dir[File.join(location, '*')].each do |file|
|
8
|
+
new_filename = File.join(destination, File.basename(file))
|
9
|
+
unless File.exists?(new_filename)
|
10
|
+
FileUtils.cp file, new_filename
|
11
|
+
end
|
12
|
+
end
|
13
|
+
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 #:nodoc:
|
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,154 @@
|
|
1
|
+
require File.dirname(__FILE__) << "/tuneup/step"
|
2
|
+
|
3
|
+
require 'digest/sha1'
|
4
|
+
require 'yaml'
|
5
|
+
require 'zlib'
|
6
|
+
require File.dirname(__FILE__) << '/tuneup/step'
|
7
|
+
|
8
|
+
module Fiveruns
|
9
|
+
module Tuneup
|
10
|
+
|
11
|
+
class << self
|
12
|
+
|
13
|
+
include Fiveruns::Tuneup::AssetTags
|
14
|
+
include Fiveruns::Tuneup::Runs
|
15
|
+
include Fiveruns::Tuneup::Instrumentation::Utilities
|
16
|
+
include Fiveruns::Tuneup::Environment
|
17
|
+
include Fiveruns::Tuneup::Schema
|
18
|
+
|
19
|
+
attr_writer :collecting
|
20
|
+
attr_accessor :running
|
21
|
+
attr_reader :trend
|
22
|
+
|
23
|
+
def logger
|
24
|
+
@logger ||= returning Logger.new(log_file) do |l|
|
25
|
+
RAILS_DEFAULT_LOGGER.info(log_format % "Logging in #{log_file}")
|
26
|
+
l.level = Logger::INFO
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def run(controller, request)
|
31
|
+
@running = (!controller.is_a?(TuneupController) && !request.xhr?)
|
32
|
+
result = nil
|
33
|
+
record controller, request do
|
34
|
+
result = yield
|
35
|
+
end
|
36
|
+
@running = false
|
37
|
+
result
|
38
|
+
end
|
39
|
+
|
40
|
+
def config(&block)
|
41
|
+
yield configuration
|
42
|
+
end
|
43
|
+
|
44
|
+
def configuration
|
45
|
+
@configuration ||= ::Fiveruns::Tuneup::Configuration.new
|
46
|
+
end
|
47
|
+
|
48
|
+
def collecting
|
49
|
+
if defined?(@collecting)
|
50
|
+
@collecting
|
51
|
+
else
|
52
|
+
@collecting = true
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def record(controller, request)
|
57
|
+
if recording?
|
58
|
+
@stack = [Fiveruns::Tuneup::RootStep.new]
|
59
|
+
@trend = nil
|
60
|
+
@environment = environment
|
61
|
+
yield
|
62
|
+
log :info, "Persisting for #{request.url} using stub #{stub(request.url)}"
|
63
|
+
data = @stack.shift
|
64
|
+
persist(generate_run_id(request.url, data.time), @environment, schemas, data)
|
65
|
+
elsif !@running
|
66
|
+
# Plugin displaying the data
|
67
|
+
# TODO: Support targeted selection (for historical run)
|
68
|
+
if request.parameters['uri']
|
69
|
+
last_id = last_run_id_for(request.parameters['uri'])
|
70
|
+
log :info, "Retrieved last run id of #{last_id} for #{request.parameters['uri']} using stub #{stub(request.parameters['uri'])}"
|
71
|
+
if last_id && (data = retrieve_run(last_id))
|
72
|
+
@stack = [data]
|
73
|
+
@trend = trend_for(last_id)
|
74
|
+
else
|
75
|
+
log :debug, "No stack found"
|
76
|
+
clear_stack
|
77
|
+
end
|
78
|
+
else
|
79
|
+
clear_stack
|
80
|
+
end
|
81
|
+
yield
|
82
|
+
else
|
83
|
+
yield
|
84
|
+
end
|
85
|
+
clear_stack
|
86
|
+
end
|
87
|
+
|
88
|
+
def recording?
|
89
|
+
@running && @collecting
|
90
|
+
end
|
91
|
+
|
92
|
+
def start
|
93
|
+
if supports_rails?
|
94
|
+
load_configuration_file
|
95
|
+
if configuration.instrument?
|
96
|
+
yield
|
97
|
+
install_instrumentation
|
98
|
+
log :info, "Started."
|
99
|
+
else
|
100
|
+
log :warn, "Not configured to run in #{RAILS_ENV} environment, aborting."
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def log(level, text)
|
106
|
+
message = log_format % text
|
107
|
+
logger.send(level, message)
|
108
|
+
STDERR.puts message if level == :error
|
109
|
+
end
|
110
|
+
|
111
|
+
#######
|
112
|
+
private
|
113
|
+
#######
|
114
|
+
|
115
|
+
def log_file
|
116
|
+
File.join(configuration.log_directory, "tuneup.log")
|
117
|
+
end
|
118
|
+
|
119
|
+
def log_format
|
120
|
+
"FiveRuns TuneUp (v#{Fiveruns::Tuneup::Version::STRING}): %s"
|
121
|
+
end
|
122
|
+
|
123
|
+
def configuration_file
|
124
|
+
File.join(RAILS_ROOT, 'config/tuneup.rb')
|
125
|
+
end
|
126
|
+
|
127
|
+
def load_configuration_file
|
128
|
+
if File.exists?(configuration_file)
|
129
|
+
require configuration_file
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def supports_rails?
|
134
|
+
version = Rails::VERSION rescue nil
|
135
|
+
return true unless version
|
136
|
+
if version::MAJOR < 2
|
137
|
+
log :error, "Sorry, FiveRuns TuneUp does not currently support Rails < 2.0.0; aborting load."
|
138
|
+
false
|
139
|
+
else
|
140
|
+
log :info, "Rails version #{version::STRING} is supported, loading..."
|
141
|
+
true
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def clear_stack
|
146
|
+
@stack = nil
|
147
|
+
@exclusion_stack = nil
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|