bovem 1.2.6 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -1
- data/Gemfile +1 -1
- data/README.md +5 -2
- data/bovem.gemspec +11 -9
- data/doc/Bovem.html +7 -25
- data/doc/Bovem/Configuration.html +30 -43
- data/doc/Bovem/Console.html +225 -4360
- data/doc/Bovem/ConsoleMethods.html +125 -0
- data/doc/Bovem/ConsoleMethods/Interactions.html +575 -0
- data/doc/Bovem/ConsoleMethods/Interactions/ClassMethods.html +231 -0
- data/doc/Bovem/ConsoleMethods/Logging.html +2218 -0
- data/doc/Bovem/ConsoleMethods/Logging/ClassMethods.html +212 -0
- data/doc/Bovem/ConsoleMethods/Output.html +1213 -0
- data/doc/Bovem/ConsoleMethods/StyleHandling.html +274 -0
- data/doc/Bovem/ConsoleMethods/StyleHandling/ClassMethods.html +653 -0
- data/doc/Bovem/Errors.html +3 -3
- data/doc/Bovem/Errors/InvalidConfiguration.html +3 -3
- data/doc/Bovem/Errors/InvalidLogger.html +3 -3
- data/doc/Bovem/Logger.html +112 -12
- data/doc/Bovem/Shell.html +58 -1888
- data/doc/Bovem/ShellMethods.html +125 -0
- data/doc/Bovem/ShellMethods/Directories.html +484 -0
- data/doc/Bovem/ShellMethods/Execute.html +565 -0
- data/doc/Bovem/ShellMethods/General.html +450 -0
- data/doc/Bovem/ShellMethods/Read.html +451 -0
- data/doc/Bovem/ShellMethods/Write.html +676 -0
- data/doc/Bovem/Version.html +6 -6
- data/doc/_index.html +145 -4
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +10 -7
- data/doc/frames.html +1 -1
- data/doc/index.html +10 -7
- data/doc/method_list.html +119 -79
- data/doc/top-level-namespace.html +3 -3
- data/lib/bovem.rb +1 -1
- data/lib/bovem/configuration.rb +24 -13
- data/lib/bovem/console.rb +566 -497
- data/lib/bovem/errors.rb +1 -1
- data/lib/bovem/logger.rb +4 -4
- data/lib/bovem/shell.rb +482 -305
- data/lib/bovem/version.rb +4 -4
- data/locales/en.yml +43 -0
- data/locales/it.yml +43 -0
- data/spec/bovem/configuration_spec.rb +3 -3
- data/spec/bovem/console_spec.rb +17 -10
- data/spec/bovem/logger_spec.rb +1 -1
- data/spec/bovem/shell_spec.rb +9 -5
- data/spec/coverage_helper.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +32 -22
@@ -0,0 +1,565 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Bovem::ShellMethods::Execute
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.3
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../_index.html">Index (E)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Bovem.html" title="Bovem (module)">Bovem</a></span></span> » <span class='title'><span class='object_link'><a href="../ShellMethods.html" title="Bovem::ShellMethods (module)">ShellMethods</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Execute</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Bovem::ShellMethods::Execute
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
<dt class="r1">Included in:</dt>
|
81
|
+
<dd class="r1"><span class='object_link'><a href="../Shell.html" title="Bovem::Shell (class)">Bovem::Shell</a></span></dd>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<dt class="r2 last">Defined in:</dt>
|
86
|
+
<dd class="r2 last">lib/bovem/shell.rb</dd>
|
87
|
+
|
88
|
+
</dl>
|
89
|
+
<div class="clear"></div>
|
90
|
+
|
91
|
+
<h2>Overview</h2><div class="docstring">
|
92
|
+
<div class="discussion">
|
93
|
+
<p>Methods to run commands or delete entries.</p>
|
94
|
+
|
95
|
+
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
<div class="tags">
|
99
|
+
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<h2>
|
110
|
+
Instance Method Summary
|
111
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
112
|
+
</h2>
|
113
|
+
|
114
|
+
<ul class="summary">
|
115
|
+
|
116
|
+
<li class="public ">
|
117
|
+
<span class="summary_signature">
|
118
|
+
|
119
|
+
<a href="#delete-instance_method" title="#delete (instance method)">- (Boolean) <strong>delete</strong>(files, run = true, show_errors = false, fatal = true) </a>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
</span>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="summary_desc"><div class='inline'><p>Deletes a list of files.</p>
|
134
|
+
</div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
<li class="public ">
|
140
|
+
<span class="summary_signature">
|
141
|
+
|
142
|
+
<a href="#run-instance_method" title="#run (instance method)">- (Hash) <strong>run</strong>(command, message = nil, run = true, show_exit = true, show_output = false, show_command = false, fatal = true) </a>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<span class="summary_desc"><div class='inline'><p>Runs a command into the shell.</p>
|
157
|
+
</div></span>
|
158
|
+
|
159
|
+
</li>
|
160
|
+
|
161
|
+
|
162
|
+
</ul>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<div id="instance_method_details" class="method_details_list">
|
168
|
+
<h2>Instance Method Details</h2>
|
169
|
+
|
170
|
+
|
171
|
+
<div class="method_details first">
|
172
|
+
<h3 class="signature first" id="delete-instance_method">
|
173
|
+
|
174
|
+
- (<tt>Boolean</tt>) <strong>delete</strong>(files, run = true, show_errors = false, fatal = true)
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
</h3><div class="docstring">
|
181
|
+
<div class="discussion">
|
182
|
+
<p>Deletes a list of files.</p>
|
183
|
+
|
184
|
+
|
185
|
+
</div>
|
186
|
+
</div>
|
187
|
+
<div class="tags">
|
188
|
+
<p class="tag_title">Parameters:</p>
|
189
|
+
<ul class="param">
|
190
|
+
|
191
|
+
<li>
|
192
|
+
|
193
|
+
<span class='name'>files</span>
|
194
|
+
|
195
|
+
|
196
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
—
|
201
|
+
<div class='inline'><p>The list of files to remove</p>
|
202
|
+
</div>
|
203
|
+
|
204
|
+
</li>
|
205
|
+
|
206
|
+
<li>
|
207
|
+
|
208
|
+
<span class='name'>run</span>
|
209
|
+
|
210
|
+
|
211
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
212
|
+
|
213
|
+
|
214
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
215
|
+
|
216
|
+
|
217
|
+
—
|
218
|
+
<div class='inline'><p>If <code>false</code>, it will just print a list of message that would be deleted.</p>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
</li>
|
222
|
+
|
223
|
+
<li>
|
224
|
+
|
225
|
+
<span class='name'>show_errors</span>
|
226
|
+
|
227
|
+
|
228
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
229
|
+
|
230
|
+
|
231
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
232
|
+
|
233
|
+
|
234
|
+
—
|
235
|
+
<div class='inline'><p>If show errors.</p>
|
236
|
+
</div>
|
237
|
+
|
238
|
+
</li>
|
239
|
+
|
240
|
+
<li>
|
241
|
+
|
242
|
+
<span class='name'>fatal</span>
|
243
|
+
|
244
|
+
|
245
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
246
|
+
|
247
|
+
|
248
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
249
|
+
|
250
|
+
|
251
|
+
—
|
252
|
+
<div class='inline'><p>If quit in case of fatal errors.</p>
|
253
|
+
</div>
|
254
|
+
|
255
|
+
</li>
|
256
|
+
|
257
|
+
</ul>
|
258
|
+
|
259
|
+
<p class="tag_title">Returns:</p>
|
260
|
+
<ul class="return">
|
261
|
+
|
262
|
+
<li>
|
263
|
+
|
264
|
+
|
265
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
—
|
270
|
+
<div class='inline'><p><code>true</code> if operation succeeded, <code>false</code> otherwise.</p>
|
271
|
+
</div>
|
272
|
+
|
273
|
+
</li>
|
274
|
+
|
275
|
+
</ul>
|
276
|
+
|
277
|
+
</div><table class="source_code">
|
278
|
+
<tr>
|
279
|
+
<td>
|
280
|
+
<pre class="lines">
|
281
|
+
|
282
|
+
|
283
|
+
368
|
284
|
+
369
|
285
|
+
370
|
286
|
+
371
|
287
|
+
372
|
288
|
+
373
|
289
|
+
374
|
290
|
+
375
|
291
|
+
376
|
292
|
+
377
|
293
|
+
378
|
294
|
+
379
|
295
|
+
380
|
296
|
+
381
|
297
|
+
382
|
298
|
+
383
|
299
|
+
384
|
300
|
+
385
|
301
|
+
386
|
302
|
+
387
|
303
|
+
388
|
304
|
+
389
|
305
|
+
390
|
306
|
+
391
|
307
|
+
392</pre>
|
308
|
+
</td>
|
309
|
+
<td>
|
310
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line 368</span>
|
311
|
+
|
312
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_files'>files</span><span class='comma'>,</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_show_errors'>show_errors</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_fatal'>fatal</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
313
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>true</span>
|
314
|
+
<span class='id identifier rubyid_locale'>locale</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_shell'>shell</span>
|
315
|
+
<span class='id identifier rubyid_files'>files</span> <span class='op'>=</span> <span class='id identifier rubyid_files'>files</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
316
|
+
|
317
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_run'>run</span> <span class='kw'>then</span>
|
318
|
+
<span class='ivar'>@console</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='period'>.</span><span class='id identifier rubyid_remove_dry'>remove_dry</span><span class='rparen'>)</span>
|
319
|
+
<span class='ivar'>@console</span><span class='period'>.</span><span class='id identifier rubyid_with_indentation'>with_indentation</span><span class='lparen'>(</span><span class='int'>11</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
320
|
+
<span class='id identifier rubyid_files'>files</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_file'>file</span><span class='op'>|</span> <span class='ivar'>@console</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span> <span class='kw'>end</span>
|
321
|
+
<span class='kw'>end</span>
|
322
|
+
<span class='kw'>else</span>
|
323
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_catch'>catch</span><span class='lparen'>(</span><span class='symbol'>:rv</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
324
|
+
<span class='kw'>begin</span>
|
325
|
+
<span class='const'>FileUtils</span><span class='period'>.</span><span class='id identifier rubyid_rm_r'>rm_r</span><span class='lparen'>(</span><span class='id identifier rubyid_files'>files</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>noop:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='label'>verbose:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='label'>secure:</span> <span class='kw'>true</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
326
|
+
<span class='id identifier rubyid_throw'>throw</span><span class='lparen'>(</span><span class='symbol'>:rv</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
327
|
+
<span class='kw'>rescue</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
328
|
+
<span class='id identifier rubyid_handle_failure'>handle_failure</span><span class='lparen'>(</span><span class='id identifier rubyid_e'>e</span><span class='comma'>,</span> <span class='symbol'>:remove_unwritable</span><span class='comma'>,</span> <span class='symbol'>:remove_not_found</span><span class='comma'>,</span> <span class='symbol'>:remove_error</span><span class='comma'>,</span> <span class='id identifier rubyid_files'>files</span><span class='comma'>,</span> <span class='id identifier rubyid_fatal'>fatal</span><span class='comma'>,</span> <span class='id identifier rubyid_show_errors'>show_errors</span><span class='rparen'>)</span>
|
329
|
+
<span class='kw'>end</span>
|
330
|
+
|
331
|
+
<span class='kw'>false</span>
|
332
|
+
<span class='kw'>end</span>
|
333
|
+
<span class='kw'>end</span>
|
334
|
+
|
335
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
336
|
+
<span class='kw'>end</span></pre>
|
337
|
+
</td>
|
338
|
+
</tr>
|
339
|
+
</table>
|
340
|
+
</div>
|
341
|
+
|
342
|
+
<div class="method_details ">
|
343
|
+
<h3 class="signature " id="run-instance_method">
|
344
|
+
|
345
|
+
- (<tt>Hash</tt>) <strong>run</strong>(command, message = nil, run = true, show_exit = true, show_output = false, show_command = false, fatal = true)
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
</h3><div class="docstring">
|
352
|
+
<div class="discussion">
|
353
|
+
<p>Runs a command into the shell.</p>
|
354
|
+
|
355
|
+
|
356
|
+
</div>
|
357
|
+
</div>
|
358
|
+
<div class="tags">
|
359
|
+
<p class="tag_title">Parameters:</p>
|
360
|
+
<ul class="param">
|
361
|
+
|
362
|
+
<li>
|
363
|
+
|
364
|
+
<span class='name'>command</span>
|
365
|
+
|
366
|
+
|
367
|
+
<span class='type'>(<tt>String</tt>)</span>
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
—
|
372
|
+
<div class='inline'><p>The string to run.</p>
|
373
|
+
</div>
|
374
|
+
|
375
|
+
</li>
|
376
|
+
|
377
|
+
<li>
|
378
|
+
|
379
|
+
<span class='name'>message</span>
|
380
|
+
|
381
|
+
|
382
|
+
<span class='type'>(<tt>String</tt>)</span>
|
383
|
+
|
384
|
+
|
385
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
386
|
+
|
387
|
+
|
388
|
+
—
|
389
|
+
<div class='inline'><p>A message to show before running.</p>
|
390
|
+
</div>
|
391
|
+
|
392
|
+
</li>
|
393
|
+
|
394
|
+
<li>
|
395
|
+
|
396
|
+
<span class='name'>run</span>
|
397
|
+
|
398
|
+
|
399
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
400
|
+
|
401
|
+
|
402
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
403
|
+
|
404
|
+
|
405
|
+
—
|
406
|
+
<div class='inline'><p>If <code>false</code>, it will just print a message with the full command that will be run.</p>
|
407
|
+
</div>
|
408
|
+
|
409
|
+
</li>
|
410
|
+
|
411
|
+
<li>
|
412
|
+
|
413
|
+
<span class='name'>show_exit</span>
|
414
|
+
|
415
|
+
|
416
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
417
|
+
|
418
|
+
|
419
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
420
|
+
|
421
|
+
|
422
|
+
—
|
423
|
+
<div class='inline'><p>If show the exit status.</p>
|
424
|
+
</div>
|
425
|
+
|
426
|
+
</li>
|
427
|
+
|
428
|
+
<li>
|
429
|
+
|
430
|
+
<span class='name'>show_output</span>
|
431
|
+
|
432
|
+
|
433
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
434
|
+
|
435
|
+
|
436
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
437
|
+
|
438
|
+
|
439
|
+
—
|
440
|
+
<div class='inline'><p>If show command output.</p>
|
441
|
+
</div>
|
442
|
+
|
443
|
+
</li>
|
444
|
+
|
445
|
+
<li>
|
446
|
+
|
447
|
+
<span class='name'>show_command</span>
|
448
|
+
|
449
|
+
|
450
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
451
|
+
|
452
|
+
|
453
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
454
|
+
|
455
|
+
|
456
|
+
—
|
457
|
+
<div class='inline'><p>If show the command that will be run.</p>
|
458
|
+
</div>
|
459
|
+
|
460
|
+
</li>
|
461
|
+
|
462
|
+
<li>
|
463
|
+
|
464
|
+
<span class='name'>fatal</span>
|
465
|
+
|
466
|
+
|
467
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
468
|
+
|
469
|
+
|
470
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
471
|
+
|
472
|
+
|
473
|
+
—
|
474
|
+
<div class='inline'><p>If quit in case of fatal errors.</p>
|
475
|
+
</div>
|
476
|
+
|
477
|
+
</li>
|
478
|
+
|
479
|
+
</ul>
|
480
|
+
|
481
|
+
<p class="tag_title">Returns:</p>
|
482
|
+
<ul class="return">
|
483
|
+
|
484
|
+
<li>
|
485
|
+
|
486
|
+
|
487
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
—
|
492
|
+
<div class='inline'><p>An hash with <code>status</code> and <code>output</code> keys.</p>
|
493
|
+
</div>
|
494
|
+
|
495
|
+
</li>
|
496
|
+
|
497
|
+
</ul>
|
498
|
+
|
499
|
+
</div><table class="source_code">
|
500
|
+
<tr>
|
501
|
+
<td>
|
502
|
+
<pre class="lines">
|
503
|
+
|
504
|
+
|
505
|
+
340
|
506
|
+
341
|
507
|
+
342
|
508
|
+
343
|
509
|
+
344
|
510
|
+
345
|
511
|
+
346
|
512
|
+
347
|
513
|
+
348
|
514
|
+
349
|
515
|
+
350
|
516
|
+
351
|
517
|
+
352
|
518
|
+
353
|
519
|
+
354
|
520
|
+
355
|
521
|
+
356
|
522
|
+
357
|
523
|
+
358
|
524
|
+
359</pre>
|
525
|
+
</td>
|
526
|
+
<td>
|
527
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line 340</span>
|
528
|
+
|
529
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_run'>run</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_show_exit'>show_exit</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_show_output'>show_output</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_show_command'>show_command</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_fatal'>fatal</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
530
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>status:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='label'>output:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rbrace'>}</span>
|
531
|
+
<span class='id identifier rubyid_command'>command</span> <span class='op'>=</span> <span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
532
|
+
<span class='id identifier rubyid_locale'>locale</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_shell'>shell</span>
|
533
|
+
|
534
|
+
<span class='comment'># Show the command
|
535
|
+
</span> <span class='ivar'>@console</span><span class='period'>.</span><span class='id identifier rubyid_begin'>begin</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
536
|
+
|
537
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_run'>run</span> <span class='kw'>then</span> <span class='comment'># Print a message
|
538
|
+
</span> <span class='ivar'>@console</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='period'>.</span><span class='id identifier rubyid_run_dry'>run_dry</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
539
|
+
<span class='ivar'>@console</span><span class='period'>.</span><span class='id identifier rubyid_status'>status</span><span class='lparen'>(</span><span class='symbol'>:ok</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_show_exit'>show_exit</span>
|
540
|
+
<span class='kw'>else</span> <span class='comment'># Run
|
541
|
+
</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_execute_command'>execute_command</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='id identifier rubyid_show_command'>show_command</span><span class='comma'>,</span> <span class='id identifier rubyid_show_output'>show_output</span><span class='rparen'>)</span>
|
542
|
+
<span class='kw'>end</span>
|
543
|
+
|
544
|
+
<span class='comment'># Return
|
545
|
+
</span> <span class='ivar'>@console</span><span class='period'>.</span><span class='id identifier rubyid_status'>status</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='lbracket'>[</span><span class='symbol'>:status</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='int'>0</span> <span class='op'>?</span> <span class='symbol'>:ok</span> <span class='op'>:</span> <span class='symbol'>:fail</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_show_exit'>show_exit</span>
|
546
|
+
<span class='id identifier rubyid_exit'>exit</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='lbracket'>[</span><span class='symbol'>:status</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_fatal'>fatal</span> <span class='op'>&&</span> <span class='id identifier rubyid_rv'>rv</span><span class='lbracket'>[</span><span class='symbol'>:status</span><span class='rbracket'>]</span> <span class='op'>!=</span> <span class='int'>0</span>
|
547
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
548
|
+
<span class='kw'>end</span></pre>
|
549
|
+
</td>
|
550
|
+
</tr>
|
551
|
+
</table>
|
552
|
+
</div>
|
553
|
+
|
554
|
+
</div>
|
555
|
+
|
556
|
+
</div>
|
557
|
+
|
558
|
+
<div id="footer">
|
559
|
+
Generated on Fri Feb 1 23:40:17 2013 by
|
560
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
561
|
+
0.8.3 (ruby-1.9.3).
|
562
|
+
</div>
|
563
|
+
|
564
|
+
</body>
|
565
|
+
</html>
|