ruby-prof 0.15.7 → 0.15.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +5 -0
- data/doc/created.rid +4 -4
- data/doc/js/search_index.js.gz +0 -0
- data/examples/graph.dot +53 -75
- data/examples/multi.flat.txt +21 -21
- data/examples/multi.graph.html +693 -839
- data/examples/multi.grind.dat +93 -173
- data/examples/multi.stack.html +411 -437
- data/examples/stack.html +411 -437
- data/lib/ruby-prof/assets/call_stack_printer.css.html +117 -0
- data/lib/ruby-prof/assets/call_stack_printer.js.html +385 -0
- data/lib/ruby-prof/assets/call_stack_printer.png +0 -0
- data/lib/ruby-prof/printers/flat_printer.rb +1 -1
- data/lib/ruby-prof/printers/graph_html_printer.rb +43 -48
- data/lib/ruby-prof/version.rb +1 -1
- data/ruby-prof.gemspec +1 -1
- data/test/measure_memory_test.rb +5 -3
- data/test/printers_test.rb +1 -1
- metadata +5 -58
- data/doc/LICENSE.html +0 -114
- data/doc/README_rdoc.html +0 -592
- data/doc/Rack.html +0 -95
- data/doc/Rack/RubyProf.html +0 -264
- data/doc/RubyProf.html +0 -961
- data/doc/RubyProf/AbstractPrinter.html +0 -546
- data/doc/RubyProf/AggregateCallInfo.html +0 -537
- data/doc/RubyProf/CallInfo.html +0 -716
- data/doc/RubyProf/CallInfoPrinter.html +0 -120
- data/doc/RubyProf/CallInfoVisitor.html +0 -198
- data/doc/RubyProf/CallStackPrinter.html +0 -1121
- data/doc/RubyProf/CallTreePrinter.html +0 -359
- data/doc/RubyProf/Cmd.html +0 -631
- data/doc/RubyProf/DotPrinter.html +0 -257
- data/doc/RubyProf/FlatPrinter.html +0 -163
- data/doc/RubyProf/FlatPrinterWithLineNumbers.html +0 -208
- data/doc/RubyProf/GraphHtmlPrinter.html +0 -579
- data/doc/RubyProf/GraphPrinter.html +0 -139
- data/doc/RubyProf/MethodInfo.html +0 -885
- data/doc/RubyProf/MultiPrinter.html +0 -358
- data/doc/RubyProf/Profile.html +0 -713
- data/doc/RubyProf/ProfileTask.html +0 -490
- data/doc/RubyProf/Thread.html +0 -303
- data/doc/examples/flat_txt.html +0 -149
- data/doc/examples/graph_html.html +0 -850
- data/doc/examples/graph_txt.html +0 -274
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +0 -618
- data/doc/table_of_contents.html +0 -934
- data/examples/empty.png +0 -0
- data/examples/graph.png +0 -0
- data/examples/minus.png +0 -0
- data/examples/plus.png +0 -0
@@ -1,490 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class RubyProf::ProfileTask - ruby-prof</title>
|
8
|
-
|
9
|
-
<script type="text/javascript">
|
10
|
-
var rdoc_rel_prefix = "../";
|
11
|
-
</script>
|
12
|
-
|
13
|
-
<script src="../js/jquery.js"></script>
|
14
|
-
<script src="../js/darkfish.js"></script>
|
15
|
-
|
16
|
-
<link href="../css/fonts.css" rel="stylesheet">
|
17
|
-
<link href="../css/rdoc.css" rel="stylesheet">
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<body id="top" role="document" class="class">
|
22
|
-
<nav role="navigation">
|
23
|
-
<div id="project-navigation">
|
24
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
25
|
-
<h2>
|
26
|
-
<a href="../index.html" rel="home">Home</a>
|
27
|
-
</h2>
|
28
|
-
|
29
|
-
<div id="table-of-contents-navigation">
|
30
|
-
<a href="../table_of_contents.html#pages">Pages</a>
|
31
|
-
<a href="../table_of_contents.html#classes">Classes</a>
|
32
|
-
<a href="../table_of_contents.html#methods">Methods</a>
|
33
|
-
</div>
|
34
|
-
</div>
|
35
|
-
|
36
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
37
|
-
<form action="#" method="get" accept-charset="utf-8">
|
38
|
-
<div id="search-field-wrapper">
|
39
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
40
|
-
aria-autocomplete="list" aria-controls="search-results"
|
41
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
42
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
43
|
-
</div>
|
44
|
-
|
45
|
-
<ul id="search-results" aria-label="Search Results"
|
46
|
-
aria-busy="false" aria-expanded="false"
|
47
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
48
|
-
</form>
|
49
|
-
</div>
|
50
|
-
|
51
|
-
</div>
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
<div id="class-metadata">
|
56
|
-
|
57
|
-
<div id="parent-class-section" class="nav-section">
|
58
|
-
<h3>Parent</h3>
|
59
|
-
|
60
|
-
|
61
|
-
<p class="link">Rake::TestTask
|
62
|
-
|
63
|
-
</div>
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
<!-- Method Quickref -->
|
68
|
-
<div id="method-list-section" class="nav-section">
|
69
|
-
<h3>Methods</h3>
|
70
|
-
|
71
|
-
<ul class="link-list" role="directory">
|
72
|
-
|
73
|
-
<li class="calls-super" ><a href="#method-c-new">::new</a>
|
74
|
-
|
75
|
-
<li ><a href="#method-i-clean_output_directory">#clean_output_directory</a>
|
76
|
-
|
77
|
-
<li ><a href="#method-i-create_output_directory">#create_output_directory</a>
|
78
|
-
|
79
|
-
<li ><a href="#method-i-define">#define</a>
|
80
|
-
|
81
|
-
<li ><a href="#method-i-output_directory">#output_directory</a>
|
82
|
-
|
83
|
-
<li ><a href="#method-i-run_script">#run_script</a>
|
84
|
-
|
85
|
-
</ul>
|
86
|
-
</div>
|
87
|
-
|
88
|
-
</div>
|
89
|
-
</nav>
|
90
|
-
|
91
|
-
<main role="main" aria-labelledby="class-RubyProf::ProfileTask">
|
92
|
-
<h1 id="class-RubyProf::ProfileTask" class="class">
|
93
|
-
class RubyProf::ProfileTask
|
94
|
-
</h1>
|
95
|
-
|
96
|
-
<section class="description">
|
97
|
-
|
98
|
-
<p>Define a task library for profiling unit tests with ruby-prof.</p>
|
99
|
-
|
100
|
-
<p>All of the options provided by the Rake:TestTask are supported except the
|
101
|
-
loader which is set to ruby-prof. For detailed information please refer to
|
102
|
-
the Rake:TestTask documentation.</p>
|
103
|
-
|
104
|
-
<p>ruby-prof specific options include:</p>
|
105
|
-
|
106
|
-
<pre>output_dir - For each file specified an output
|
107
|
-
file with profile information will be
|
108
|
-
written to the output directory.
|
109
|
-
By default, the output directory is
|
110
|
-
called "profile" and is created underneath
|
111
|
-
the current working directory.
|
112
|
-
|
113
|
-
printer - Specifies the output printer. Valid values include
|
114
|
-
:flat, :graph, :graph_html and :call_tree.
|
115
|
-
|
116
|
-
min_percent - Methods that take less than the specified percent
|
117
|
-
will not be written out.</pre>
|
118
|
-
|
119
|
-
<p>Example:</p>
|
120
|
-
|
121
|
-
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'ruby-prof/task'</span>
|
122
|
-
|
123
|
-
<span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">ProfileTask</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
|
124
|
-
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">test_files</span> = <span class="ruby-constant">FileList</span>[<span class="ruby-string">'test/test*.rb'</span>]
|
125
|
-
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">output_dir</span> = <span class="ruby-string">"c:/temp"</span>
|
126
|
-
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">printer</span> = :<span class="ruby-identifier">graph</span>
|
127
|
-
<span class="ruby-identifier">t</span>.<span class="ruby-identifier">min_percent</span> = <span class="ruby-value">10</span>
|
128
|
-
<span class="ruby-keyword">end</span>
|
129
|
-
</pre>
|
130
|
-
|
131
|
-
<p>If rake is invoked with a “TEST=filename” command line option, then the
|
132
|
-
list of test files will be overridden to include only the filename
|
133
|
-
specified on the command line. This provides an easy way to run just one
|
134
|
-
test.</p>
|
135
|
-
|
136
|
-
<p>If rake is invoked with a “TESTOPTS=options” command line option, then the
|
137
|
-
given options are passed to the test process after a '–'. This
|
138
|
-
allows Test::Unit options to be passed to the test suite.</p>
|
139
|
-
|
140
|
-
<p>Examples:</p>
|
141
|
-
|
142
|
-
<pre class="ruby"><span class="ruby-identifier">rake</span> <span class="ruby-identifier">profile</span> <span class="ruby-comment"># run tests normally</span>
|
143
|
-
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">profile</span> <span class="ruby-constant">TEST</span>=<span class="ruby-identifier">just_one_file</span>.<span class="ruby-identifier">rb</span> <span class="ruby-comment"># run just one test file.</span>
|
144
|
-
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">profile</span> <span class="ruby-constant">TESTOPTS</span>=<span class="ruby-string">"-v"</span> <span class="ruby-comment"># run in verbose mode</span>
|
145
|
-
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">profile</span> <span class="ruby-constant">TESTOPTS</span>=<span class="ruby-string">"--runner=fox"</span> <span class="ruby-comment"># use the fox test runner</span>
|
146
|
-
</pre>
|
147
|
-
|
148
|
-
</section>
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
<section class="attribute-method-details" class="method-section">
|
162
|
-
<header>
|
163
|
-
<h3>Attributes</h3>
|
164
|
-
</header>
|
165
|
-
|
166
|
-
|
167
|
-
<div id="attribute-i-min_percent" class="method-detail">
|
168
|
-
<div class="method-heading attribute-method-heading">
|
169
|
-
<span class="method-name">min_percent</span><span
|
170
|
-
class="attribute-access-type">[RW]</span>
|
171
|
-
</div>
|
172
|
-
|
173
|
-
<div class="method-description">
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
</div>
|
178
|
-
</div>
|
179
|
-
|
180
|
-
<div id="attribute-i-output_dir" class="method-detail">
|
181
|
-
<div class="method-heading attribute-method-heading">
|
182
|
-
<span class="method-name">output_dir</span><span
|
183
|
-
class="attribute-access-type">[RW]</span>
|
184
|
-
</div>
|
185
|
-
|
186
|
-
<div class="method-description">
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
</div>
|
191
|
-
</div>
|
192
|
-
|
193
|
-
<div id="attribute-i-printer" class="method-detail">
|
194
|
-
<div class="method-heading attribute-method-heading">
|
195
|
-
<span class="method-name">printer</span><span
|
196
|
-
class="attribute-access-type">[RW]</span>
|
197
|
-
</div>
|
198
|
-
|
199
|
-
<div class="method-description">
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
</div>
|
204
|
-
</div>
|
205
|
-
|
206
|
-
</section>
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
211
|
-
<header>
|
212
|
-
<h3>Public Class Methods</h3>
|
213
|
-
</header>
|
214
|
-
|
215
|
-
|
216
|
-
<div id="method-c-new" class="method-detail ">
|
217
|
-
|
218
|
-
<div class="method-heading">
|
219
|
-
<span class="method-name">new</span><span
|
220
|
-
class="method-args">(name = :profile)</span>
|
221
|
-
|
222
|
-
<span class="method-click-advice">click to toggle source</span>
|
223
|
-
|
224
|
-
</div>
|
225
|
-
|
226
|
-
|
227
|
-
<div class="method-description">
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
<div class="method-calls-super">
|
233
|
-
Calls superclass method
|
234
|
-
|
235
|
-
</div>
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
<div class="method-source-code" id="new-source">
|
240
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/task.rb, line 64</span>
|
241
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span> = <span class="ruby-value">:profile</span>)
|
242
|
-
<span class="ruby-keyword">super</span>(<span class="ruby-identifier">name</span>)
|
243
|
-
<span class="ruby-keyword">end</span></pre>
|
244
|
-
</div>
|
245
|
-
|
246
|
-
</div>
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
</div>
|
252
|
-
|
253
|
-
|
254
|
-
</section>
|
255
|
-
|
256
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
257
|
-
<header>
|
258
|
-
<h3>Public Instance Methods</h3>
|
259
|
-
</header>
|
260
|
-
|
261
|
-
|
262
|
-
<div id="method-i-clean_output_directory" class="method-detail ">
|
263
|
-
|
264
|
-
<div class="method-heading">
|
265
|
-
<span class="method-name">clean_output_directory</span><span
|
266
|
-
class="method-args">()</span>
|
267
|
-
|
268
|
-
<span class="method-click-advice">click to toggle source</span>
|
269
|
-
|
270
|
-
</div>
|
271
|
-
|
272
|
-
|
273
|
-
<div class="method-description">
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
<div class="method-source-code" id="clean_output_directory-source">
|
281
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/task.rb, line 135</span>
|
282
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">clean_output_directory</span>
|
283
|
-
<span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">output_directory</span>)
|
284
|
-
<span class="ruby-identifier">files</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-identifier">output_directory</span> <span class="ruby-operator">+</span> <span class="ruby-string">'/*'</span>)
|
285
|
-
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm</span>(<span class="ruby-identifier">files</span>)
|
286
|
-
<span class="ruby-keyword">end</span>
|
287
|
-
<span class="ruby-keyword">end</span></pre>
|
288
|
-
</div>
|
289
|
-
|
290
|
-
</div>
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
</div>
|
296
|
-
|
297
|
-
|
298
|
-
<div id="method-i-create_output_directory" class="method-detail ">
|
299
|
-
|
300
|
-
<div class="method-heading">
|
301
|
-
<span class="method-name">create_output_directory</span><span
|
302
|
-
class="method-args">()</span>
|
303
|
-
|
304
|
-
<span class="method-click-advice">click to toggle source</span>
|
305
|
-
|
306
|
-
</div>
|
307
|
-
|
308
|
-
|
309
|
-
<div class="method-description">
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
<div class="method-source-code" id="create_output_directory-source">
|
317
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/task.rb, line 129</span>
|
318
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_output_directory</span>
|
319
|
-
<span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">output_directory</span>)
|
320
|
-
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">mkdir</span>(<span class="ruby-identifier">output_directory</span>)
|
321
|
-
<span class="ruby-keyword">end</span>
|
322
|
-
<span class="ruby-keyword">end</span></pre>
|
323
|
-
</div>
|
324
|
-
|
325
|
-
</div>
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
</div>
|
331
|
-
|
332
|
-
|
333
|
-
<div id="method-i-define" class="method-detail ">
|
334
|
-
|
335
|
-
<div class="method-heading">
|
336
|
-
<span class="method-name">define</span><span
|
337
|
-
class="method-args">()</span>
|
338
|
-
|
339
|
-
<span class="method-click-advice">click to toggle source</span>
|
340
|
-
|
341
|
-
</div>
|
342
|
-
|
343
|
-
|
344
|
-
<div class="method-description">
|
345
|
-
|
346
|
-
<p>Create the tasks defined by this task lib.</p>
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
<div class="method-source-code" id="define-source">
|
352
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/task.rb, line 69</span>
|
353
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">define</span>
|
354
|
-
<span class="ruby-identifier">lib_path</span> = <span class="ruby-ivar">@libs</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_SEPARATOR</span>)
|
355
|
-
<span class="ruby-identifier">desc</span> <span class="ruby-string">"Profile"</span> <span class="ruby-operator">+</span> (<span class="ruby-ivar">@name</span><span class="ruby-operator">==</span><span class="ruby-value">:profile</span> <span class="ruby-operator">?</span> <span class="ruby-string">""</span> <span class="ruby-operator">:</span> <span class="ruby-node">" for #{@name}"</span>)
|
356
|
-
|
357
|
-
<span class="ruby-identifier">task</span> <span class="ruby-ivar">@name</span> <span class="ruby-keyword">do</span>
|
358
|
-
<span class="ruby-identifier">create_output_directory</span>
|
359
|
-
|
360
|
-
<span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">unshift</span>( <span class="ruby-node">"-I#{lib_path}"</span> )
|
361
|
-
<span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">unshift</span>( <span class="ruby-string">"-w"</span> ) <span class="ruby-keyword">if</span> <span class="ruby-ivar">@warning</span>
|
362
|
-
<span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">push</span>(<span class="ruby-string">"-S ruby-prof"</span>)
|
363
|
-
<span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">push</span>(<span class="ruby-node">"--printer #{@printer}"</span>)
|
364
|
-
<span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">push</span>(<span class="ruby-node">"--min_percent #{@min_percent}"</span>)
|
365
|
-
|
366
|
-
<span class="ruby-identifier">file_list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file_path</span><span class="ruby-operator">|</span>
|
367
|
-
<span class="ruby-identifier">run_script</span>(<span class="ruby-identifier">file_path</span>)
|
368
|
-
<span class="ruby-keyword">end</span>
|
369
|
-
<span class="ruby-keyword">end</span>
|
370
|
-
<span class="ruby-keyword">self</span>
|
371
|
-
<span class="ruby-keyword">end</span></pre>
|
372
|
-
</div>
|
373
|
-
|
374
|
-
</div>
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
</div>
|
380
|
-
|
381
|
-
|
382
|
-
<div id="method-i-output_directory" class="method-detail ">
|
383
|
-
|
384
|
-
<div class="method-heading">
|
385
|
-
<span class="method-name">output_directory</span><span
|
386
|
-
class="method-args">()</span>
|
387
|
-
|
388
|
-
<span class="method-click-advice">click to toggle source</span>
|
389
|
-
|
390
|
-
</div>
|
391
|
-
|
392
|
-
|
393
|
-
<div class="method-description">
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
<div class="method-source-code" id="output_directory-source">
|
401
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/task.rb, line 125</span>
|
402
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">output_directory</span>
|
403
|
-
<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-ivar">@output_dir</span>)
|
404
|
-
<span class="ruby-keyword">end</span></pre>
|
405
|
-
</div>
|
406
|
-
|
407
|
-
</div>
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
</div>
|
413
|
-
|
414
|
-
|
415
|
-
<div id="method-i-run_script" class="method-detail ">
|
416
|
-
|
417
|
-
<div class="method-heading">
|
418
|
-
<span class="method-name">run_script</span><span
|
419
|
-
class="method-args">(script_path)</span>
|
420
|
-
|
421
|
-
<span class="method-click-advice">click to toggle source</span>
|
422
|
-
|
423
|
-
</div>
|
424
|
-
|
425
|
-
|
426
|
-
<div class="method-description">
|
427
|
-
|
428
|
-
<p>Run script</p>
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
<div class="method-source-code" id="run_script-source">
|
434
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/task.rb, line 90</span>
|
435
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">run_script</span>(<span class="ruby-identifier">script_path</span>)
|
436
|
-
<span class="ruby-identifier">run_code</span> = <span class="ruby-string">''</span>
|
437
|
-
<span class="ruby-constant">RakeFileUtils</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-ivar">@verbose</span>) <span class="ruby-keyword">do</span>
|
438
|
-
<span class="ruby-identifier">file_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">script_path</span>, <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">script_path</span>))
|
439
|
-
<span class="ruby-keyword">case</span> <span class="ruby-ivar">@printer</span>
|
440
|
-
<span class="ruby-keyword">when</span> <span class="ruby-value">:flat</span>, <span class="ruby-value">:graph</span>, <span class="ruby-value">:call_tree</span>
|
441
|
-
<span class="ruby-identifier">file_name</span> <span class="ruby-operator">+=</span> <span class="ruby-string">".txt"</span>
|
442
|
-
<span class="ruby-keyword">when</span> <span class="ruby-value">:graph_html</span>
|
443
|
-
<span class="ruby-identifier">file_name</span> <span class="ruby-operator">+=</span> <span class="ruby-string">".html"</span>
|
444
|
-
<span class="ruby-keyword">else</span>
|
445
|
-
<span class="ruby-identifier">file_name</span> <span class="ruby-operator">+=</span> <span class="ruby-string">".txt"</span>
|
446
|
-
<span class="ruby-keyword">end</span>
|
447
|
-
|
448
|
-
<span class="ruby-identifier">output_file_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">output_directory</span>, <span class="ruby-identifier">file_name</span>)
|
449
|
-
|
450
|
-
<span class="ruby-identifier">command_line</span> = <span class="ruby-ivar">@ruby_opts</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">" "</span>) <span class="ruby-operator">+</span>
|
451
|
-
<span class="ruby-string">" --file="</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">output_file_path</span> <span class="ruby-operator">+</span>
|
452
|
-
<span class="ruby-string">" "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">script_path</span>
|
453
|
-
|
454
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-string">"ruby "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">command_line</span>
|
455
|
-
<span class="ruby-comment"># We have to catch the exeption to continue on. However,</span>
|
456
|
-
<span class="ruby-comment"># the error message will have been output to STDERR</span>
|
457
|
-
<span class="ruby-comment"># already by the time we get here so we don't have to</span>
|
458
|
-
<span class="ruby-comment"># do that again</span>
|
459
|
-
<span class="ruby-keyword">begin</span>
|
460
|
-
<span class="ruby-identifier">ruby</span> <span class="ruby-identifier">command_line</span>
|
461
|
-
<span class="ruby-keyword">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
462
|
-
<span class="ruby-constant">STDOUT</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">e</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"\n"</span>
|
463
|
-
<span class="ruby-constant">STDOUT</span>.<span class="ruby-identifier">flush</span>
|
464
|
-
<span class="ruby-keyword">end</span>
|
465
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-string">""</span>
|
466
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-string">""</span>
|
467
|
-
<span class="ruby-keyword">end</span>
|
468
|
-
<span class="ruby-keyword">end</span></pre>
|
469
|
-
</div>
|
470
|
-
|
471
|
-
</div>
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
</div>
|
477
|
-
|
478
|
-
|
479
|
-
</section>
|
480
|
-
|
481
|
-
</section>
|
482
|
-
</main>
|
483
|
-
|
484
|
-
|
485
|
-
<footer id="validator-badges" role="contentinfo">
|
486
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
487
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
488
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
489
|
-
</footer>
|
490
|
-
|