stackprofiler 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/README.md +1 -1
  4. data/config.ru +3 -2
  5. data/lib/stackprofiler.rb +0 -1
  6. data/lib/stackprofiler/filters/build_tree.rb +3 -4
  7. data/lib/stackprofiler/filters/gem_removal.rb +3 -0
  8. data/lib/stackprofiler/web_ui.rb +34 -11
  9. data/lib/stackprofiler/web_ui/public/css/stackprofiler.css +77 -0
  10. data/lib/stackprofiler/web_ui/public/js/stackprofiler.js +129 -58
  11. data/lib/stackprofiler/web_ui/public/vendor/ace/ace.js +18298 -0
  12. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-beautify.js +334 -0
  13. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-chromevox.js +541 -0
  14. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-elastic_tabstops_lite.js +275 -0
  15. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-emmet.js +1190 -0
  16. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-error_marker.js +6 -0
  17. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-keybinding_menu.js +170 -0
  18. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-language_tools.js +1934 -0
  19. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-linking.js +52 -0
  20. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-modelist.js +187 -0
  21. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-old_ie.js +494 -0
  22. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-searchbox.js +409 -0
  23. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-settings_menu.js +637 -0
  24. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-spellcheck.js +71 -0
  25. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-split.js +246 -0
  26. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-static_highlight.js +154 -0
  27. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-statusbar.js +51 -0
  28. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-textarea.js +632 -0
  29. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-themelist.js +58 -0
  30. data/lib/stackprofiler/web_ui/public/vendor/ace/ext-whitespace.js +181 -0
  31. data/lib/stackprofiler/web_ui/public/vendor/ace/keybinding-emacs.js +1182 -0
  32. data/lib/stackprofiler/web_ui/public/vendor/ace/keybinding-vim.js +5320 -0
  33. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-haml.js +525 -0
  34. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-html.js +2427 -0
  35. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-html_ruby.js +2955 -0
  36. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-javascript.js +1025 -0
  37. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-json.js +668 -0
  38. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-ruby.js +839 -0
  39. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-xml.js +637 -0
  40. data/lib/stackprofiler/web_ui/public/vendor/ace/mode-yaml.js +256 -0
  41. data/lib/stackprofiler/web_ui/public/vendor/ace/theme-xcode.js +89 -0
  42. data/lib/stackprofiler/web_ui/public/vendor/ace/worker-coffee.js +7599 -0
  43. data/lib/stackprofiler/web_ui/public/vendor/ace/worker-css.js +8682 -0
  44. data/lib/stackprofiler/web_ui/public/vendor/ace/worker-html.js +11527 -0
  45. data/lib/stackprofiler/web_ui/public/vendor/ace/worker-javascript.js +10429 -0
  46. data/lib/stackprofiler/web_ui/public/vendor/ace/worker-json.js +2319 -0
  47. data/lib/stackprofiler/web_ui/views/index.erb +1 -1
  48. data/lib/stackprofiler/web_ui/views/layout.erb +2 -55
  49. data/stackprofiler.gemspec +2 -4
  50. metadata +42 -19
  51. data/lib/stackprofiler/web_ui/views/code.erb +0 -17
@@ -0,0 +1,71 @@
1
+ ace.define("ace/ext/spellcheck",["require","exports","module","ace/lib/event","ace/editor","ace/config"], function(require, exports, module) {
2
+ "use strict";
3
+ var event = require("../lib/event");
4
+
5
+ exports.contextMenuHandler = function(e){
6
+ var host = e.target;
7
+ var text = host.textInput.getElement();
8
+ if (!host.selection.isEmpty())
9
+ return;
10
+ var c = host.getCursorPosition();
11
+ var r = host.session.getWordRange(c.row, c.column);
12
+ var w = host.session.getTextRange(r);
13
+
14
+ host.session.tokenRe.lastIndex = 0;
15
+ if (!host.session.tokenRe.test(w))
16
+ return;
17
+ var PLACEHOLDER = "\x01\x01";
18
+ var value = w + " " + PLACEHOLDER;
19
+ text.value = value;
20
+ text.setSelectionRange(w.length, w.length + 1);
21
+ text.setSelectionRange(0, 0);
22
+ text.setSelectionRange(0, w.length);
23
+
24
+ var afterKeydown = false;
25
+ event.addListener(text, "keydown", function onKeydown() {
26
+ event.removeListener(text, "keydown", onKeydown);
27
+ afterKeydown = true;
28
+ });
29
+
30
+ host.textInput.setInputHandler(function(newVal) {
31
+ console.log(newVal , value, text.selectionStart, text.selectionEnd)
32
+ if (newVal == value)
33
+ return '';
34
+ if (newVal.lastIndexOf(value, 0) === 0)
35
+ return newVal.slice(value.length);
36
+ if (newVal.substr(text.selectionEnd) == value)
37
+ return newVal.slice(0, -value.length);
38
+ if (newVal.slice(-2) == PLACEHOLDER) {
39
+ var val = newVal.slice(0, -2);
40
+ if (val.slice(-1) == " ") {
41
+ if (afterKeydown)
42
+ return val.substring(0, text.selectionEnd);
43
+ val = val.slice(0, -1);
44
+ host.session.replace(r, val);
45
+ return "";
46
+ }
47
+ }
48
+
49
+ return newVal;
50
+ });
51
+ };
52
+ var Editor = require("../editor").Editor;
53
+ require("../config").defineOptions(Editor.prototype, "editor", {
54
+ spellcheck: {
55
+ set: function(val) {
56
+ var text = this.textInput.getElement();
57
+ text.spellcheck = !!val;
58
+ if (!val)
59
+ this.removeListener("nativecontextmenu", exports.contextMenuHandler);
60
+ else
61
+ this.on("nativecontextmenu", exports.contextMenuHandler);
62
+ },
63
+ value: true
64
+ }
65
+ });
66
+
67
+ });
68
+ (function() {
69
+ ace.require(["ace/ext/spellcheck"], function() {});
70
+ })();
71
+
@@ -0,0 +1,246 @@
1
+ ace.define("ace/split",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/editor","ace/virtual_renderer","ace/edit_session"], function(require, exports, module) {
2
+ "use strict";
3
+
4
+ var oop = require("./lib/oop");
5
+ var lang = require("./lib/lang");
6
+ var EventEmitter = require("./lib/event_emitter").EventEmitter;
7
+
8
+ var Editor = require("./editor").Editor;
9
+ var Renderer = require("./virtual_renderer").VirtualRenderer;
10
+ var EditSession = require("./edit_session").EditSession;
11
+
12
+
13
+ var Split = function(container, theme, splits) {
14
+ this.BELOW = 1;
15
+ this.BESIDE = 0;
16
+
17
+ this.$container = container;
18
+ this.$theme = theme;
19
+ this.$splits = 0;
20
+ this.$editorCSS = "";
21
+ this.$editors = [];
22
+ this.$orientation = this.BESIDE;
23
+
24
+ this.setSplits(splits || 1);
25
+ this.$cEditor = this.$editors[0];
26
+
27
+
28
+ this.on("focus", function(editor) {
29
+ this.$cEditor = editor;
30
+ }.bind(this));
31
+ };
32
+
33
+ (function(){
34
+
35
+ oop.implement(this, EventEmitter);
36
+
37
+ this.$createEditor = function() {
38
+ var el = document.createElement("div");
39
+ el.className = this.$editorCSS;
40
+ el.style.cssText = "position: absolute; top:0px; bottom:0px";
41
+ this.$container.appendChild(el);
42
+ var editor = new Editor(new Renderer(el, this.$theme));
43
+
44
+ editor.on("focus", function() {
45
+ this._emit("focus", editor);
46
+ }.bind(this));
47
+
48
+ this.$editors.push(editor);
49
+ editor.setFontSize(this.$fontSize);
50
+ return editor;
51
+ };
52
+
53
+ this.setSplits = function(splits) {
54
+ var editor;
55
+ if (splits < 1) {
56
+ throw "The number of splits have to be > 0!";
57
+ }
58
+
59
+ if (splits == this.$splits) {
60
+ return;
61
+ } else if (splits > this.$splits) {
62
+ while (this.$splits < this.$editors.length && this.$splits < splits) {
63
+ editor = this.$editors[this.$splits];
64
+ this.$container.appendChild(editor.container);
65
+ editor.setFontSize(this.$fontSize);
66
+ this.$splits ++;
67
+ }
68
+ while (this.$splits < splits) {
69
+ this.$createEditor();
70
+ this.$splits ++;
71
+ }
72
+ } else {
73
+ while (this.$splits > splits) {
74
+ editor = this.$editors[this.$splits - 1];
75
+ this.$container.removeChild(editor.container);
76
+ this.$splits --;
77
+ }
78
+ }
79
+ this.resize();
80
+ };
81
+ this.getSplits = function() {
82
+ return this.$splits;
83
+ };
84
+ this.getEditor = function(idx) {
85
+ return this.$editors[idx];
86
+ };
87
+ this.getCurrentEditor = function() {
88
+ return this.$cEditor;
89
+ };
90
+ this.focus = function() {
91
+ this.$cEditor.focus();
92
+ };
93
+ this.blur = function() {
94
+ this.$cEditor.blur();
95
+ };
96
+ this.setTheme = function(theme) {
97
+ this.$editors.forEach(function(editor) {
98
+ editor.setTheme(theme);
99
+ });
100
+ };
101
+ this.setKeyboardHandler = function(keybinding) {
102
+ this.$editors.forEach(function(editor) {
103
+ editor.setKeyboardHandler(keybinding);
104
+ });
105
+ };
106
+ this.forEach = function(callback, scope) {
107
+ this.$editors.forEach(callback, scope);
108
+ };
109
+
110
+
111
+ this.$fontSize = "";
112
+ this.setFontSize = function(size) {
113
+ this.$fontSize = size;
114
+ this.forEach(function(editor) {
115
+ editor.setFontSize(size);
116
+ });
117
+ };
118
+
119
+ this.$cloneSession = function(session) {
120
+ var s = new EditSession(session.getDocument(), session.getMode());
121
+
122
+ var undoManager = session.getUndoManager();
123
+ if (undoManager) {
124
+ var undoManagerProxy = new UndoManagerProxy(undoManager, s);
125
+ s.setUndoManager(undoManagerProxy);
126
+ }
127
+ s.$informUndoManager = lang.delayedCall(function() { s.$deltas = []; });
128
+ s.setTabSize(session.getTabSize());
129
+ s.setUseSoftTabs(session.getUseSoftTabs());
130
+ s.setOverwrite(session.getOverwrite());
131
+ s.setBreakpoints(session.getBreakpoints());
132
+ s.setUseWrapMode(session.getUseWrapMode());
133
+ s.setUseWorker(session.getUseWorker());
134
+ s.setWrapLimitRange(session.$wrapLimitRange.min,
135
+ session.$wrapLimitRange.max);
136
+ s.$foldData = session.$cloneFoldData();
137
+
138
+ return s;
139
+ };
140
+ this.setSession = function(session, idx) {
141
+ var editor;
142
+ if (idx == null) {
143
+ editor = this.$cEditor;
144
+ } else {
145
+ editor = this.$editors[idx];
146
+ }
147
+ var isUsed = this.$editors.some(function(editor) {
148
+ return editor.session === session;
149
+ });
150
+
151
+ if (isUsed) {
152
+ session = this.$cloneSession(session);
153
+ }
154
+ editor.setSession(session);
155
+ return session;
156
+ };
157
+ this.getOrientation = function() {
158
+ return this.$orientation;
159
+ };
160
+ this.setOrientation = function(orientation) {
161
+ if (this.$orientation == orientation) {
162
+ return;
163
+ }
164
+ this.$orientation = orientation;
165
+ this.resize();
166
+ };
167
+ this.resize = function() {
168
+ var width = this.$container.clientWidth;
169
+ var height = this.$container.clientHeight;
170
+ var editor;
171
+
172
+ if (this.$orientation == this.BESIDE) {
173
+ var editorWidth = width / this.$splits;
174
+ for (var i = 0; i < this.$splits; i++) {
175
+ editor = this.$editors[i];
176
+ editor.container.style.width = editorWidth + "px";
177
+ editor.container.style.top = "0px";
178
+ editor.container.style.left = i * editorWidth + "px";
179
+ editor.container.style.height = height + "px";
180
+ editor.resize();
181
+ }
182
+ } else {
183
+ var editorHeight = height / this.$splits;
184
+ for (var i = 0; i < this.$splits; i++) {
185
+ editor = this.$editors[i];
186
+ editor.container.style.width = width + "px";
187
+ editor.container.style.top = i * editorHeight + "px";
188
+ editor.container.style.left = "0px";
189
+ editor.container.style.height = editorHeight + "px";
190
+ editor.resize();
191
+ }
192
+ }
193
+ };
194
+
195
+ }).call(Split.prototype);
196
+
197
+
198
+ function UndoManagerProxy(undoManager, session) {
199
+ this.$u = undoManager;
200
+ this.$doc = session;
201
+ }
202
+
203
+ (function() {
204
+ this.execute = function(options) {
205
+ this.$u.execute(options);
206
+ };
207
+
208
+ this.undo = function() {
209
+ var selectionRange = this.$u.undo(true);
210
+ if (selectionRange) {
211
+ this.$doc.selection.setSelectionRange(selectionRange);
212
+ }
213
+ };
214
+
215
+ this.redo = function() {
216
+ var selectionRange = this.$u.redo(true);
217
+ if (selectionRange) {
218
+ this.$doc.selection.setSelectionRange(selectionRange);
219
+ }
220
+ };
221
+
222
+ this.reset = function() {
223
+ this.$u.reset();
224
+ };
225
+
226
+ this.hasUndo = function() {
227
+ return this.$u.hasUndo();
228
+ };
229
+
230
+ this.hasRedo = function() {
231
+ return this.$u.hasRedo();
232
+ };
233
+ }).call(UndoManagerProxy.prototype);
234
+
235
+ exports.Split = Split;
236
+ });
237
+
238
+ ace.define("ace/ext/split",["require","exports","module","ace/split"], function(require, exports, module) {
239
+ "use strict";
240
+ module.exports = require("../split");
241
+
242
+ });
243
+ (function() {
244
+ ace.require(["ace/ext/split"], function() {});
245
+ })();
246
+
@@ -0,0 +1,154 @@
1
+ ace.define("ace/ext/static_highlight",["require","exports","module","ace/edit_session","ace/layer/text","ace/config","ace/lib/dom"], function(require, exports, module) {
2
+ "use strict";
3
+
4
+ var EditSession = require("../edit_session").EditSession;
5
+ var TextLayer = require("../layer/text").Text;
6
+ var baseStyles = ".ace_static_highlight {\
7
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace;\
8
+ font-size: 12px;\
9
+ }\
10
+ .ace_static_highlight .ace_gutter {\
11
+ width: 25px !important;\
12
+ float: left;\
13
+ text-align: right;\
14
+ padding: 0 3px 0 0;\
15
+ margin-right: 3px;\
16
+ position: static !important;\
17
+ }\
18
+ .ace_static_highlight .ace_line { clear: both; }\
19
+ .ace_static_highlight .ace_gutter-cell {\
20
+ -moz-user-select: -moz-none;\
21
+ -khtml-user-select: none;\
22
+ -webkit-user-select: none;\
23
+ user-select: none;\
24
+ }\
25
+ .ace_static_highlight .ace_gutter-cell:before {\
26
+ content: counter(ace_line, decimal);\
27
+ counter-increment: ace_line;\
28
+ }\
29
+ .ace_static_highlight {\
30
+ counter-reset: ace_line;\
31
+ }\
32
+ ";
33
+ var config = require("../config");
34
+ var dom = require("../lib/dom");
35
+
36
+
37
+ var highlight = function(el, opts, callback) {
38
+ var m = el.className.match(/lang-(\w+)/);
39
+ var mode = opts.mode || m && ("ace/mode/" + m[1]);
40
+ if (!mode)
41
+ return false;
42
+ var theme = opts.theme || "ace/theme/textmate";
43
+
44
+ var data = "";
45
+ var nodes = [];
46
+
47
+ if (el.firstElementChild) {
48
+ var textLen = 0;
49
+ for (var i = 0; i < el.childNodes.length; i++) {
50
+ var ch = el.childNodes[i];
51
+ if (ch.nodeType == 3) {
52
+ textLen += ch.data.length;
53
+ data += ch.data;
54
+ } else {
55
+ nodes.push(textLen, ch);
56
+ }
57
+ }
58
+ } else {
59
+ data = dom.getInnerText(el);
60
+ if (opts.trim)
61
+ data = data.trim();
62
+ }
63
+
64
+ highlight.render(data, mode, theme, opts.firstLineNumber, !opts.showGutter, function (highlighted) {
65
+ dom.importCssString(highlighted.css, "ace_highlight");
66
+ el.innerHTML = highlighted.html;
67
+ var container = el.firstChild.firstChild;
68
+ for (var i = 0; i < nodes.length; i += 2) {
69
+ var pos = highlighted.session.doc.indexToPosition(nodes[i]);
70
+ var node = nodes[i + 1];
71
+ var lineEl = container.children[pos.row];
72
+ lineEl && lineEl.appendChild(node);
73
+ }
74
+ callback && callback();
75
+ });
76
+ };
77
+ highlight.render = function(input, mode, theme, lineStart, disableGutter, callback) {
78
+ var waiting = 1;
79
+ var modeCache = EditSession.prototype.$modes;
80
+ if (typeof theme == "string") {
81
+ waiting++;
82
+ config.loadModule(['theme', theme], function(m) {
83
+ theme = m;
84
+ --waiting || done();
85
+ });
86
+ }
87
+ var modeOptions;
88
+ if (mode && typeof mode === "object" && !mode.getTokenizer) {
89
+ modeOptions = mode;
90
+ mode = modeOptions.path;
91
+ }
92
+ if (typeof mode == "string") {
93
+ waiting++;
94
+ config.loadModule(['mode', mode], function(m) {
95
+ if (!modeCache[mode] || modeOptions)
96
+ modeCache[mode] = new m.Mode(modeOptions);
97
+ mode = modeCache[mode];
98
+ --waiting || done();
99
+ });
100
+ }
101
+ function done() {
102
+ var result = highlight.renderSync(input, mode, theme, lineStart, disableGutter);
103
+ return callback ? callback(result) : result;
104
+ }
105
+ return --waiting || done();
106
+ };
107
+ highlight.renderSync = function(input, mode, theme, lineStart, disableGutter) {
108
+ lineStart = parseInt(lineStart || 1, 10);
109
+
110
+ var session = new EditSession("");
111
+ session.setUseWorker(false);
112
+ session.setMode(mode);
113
+
114
+ var textLayer = new TextLayer(document.createElement("div"));
115
+ textLayer.setSession(session);
116
+ textLayer.config = {
117
+ characterWidth: 10,
118
+ lineHeight: 20
119
+ };
120
+
121
+ session.setValue(input);
122
+
123
+ var stringBuilder = [];
124
+ var length = session.getLength();
125
+
126
+ for(var ix = 0; ix < length; ix++) {
127
+ stringBuilder.push("<div class='ace_line'>");
128
+ if (!disableGutter)
129
+ stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + /*(ix + lineStart) + */ "</span>");
130
+ textLayer.$renderLine(stringBuilder, ix, true, false);
131
+ stringBuilder.push("\n</div>");
132
+ }
133
+ var html = "<div class='" + theme.cssClass + "'>" +
134
+ "<div class='ace_static_highlight' style='counter-reset:ace_line " + (lineStart - 1) + "'>" +
135
+ stringBuilder.join("") +
136
+ "</div>" +
137
+ "</div>";
138
+
139
+ textLayer.destroy();
140
+
141
+ return {
142
+ css: baseStyles + theme.cssText,
143
+ html: html,
144
+ session: session
145
+ };
146
+ };
147
+
148
+ module.exports = highlight;
149
+ module.exports.highlight =highlight;
150
+ });
151
+ (function() {
152
+ ace.require(["ace/ext/static_highlight"], function() {});
153
+ })();
154
+