bovem 2.1.3 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bovem.gemspec +1 -1
- data/doc/Bovem.html +1 -1
- data/doc/Bovem/Configuration.html +2 -2
- data/doc/Bovem/Console.html +28 -28
- data/doc/Bovem/ConsoleMethods.html +1 -1
- data/doc/Bovem/ConsoleMethods/Interactions.html +12 -12
- data/doc/Bovem/ConsoleMethods/Interactions/ClassMethods.html +5 -5
- data/doc/Bovem/ConsoleMethods/Logging.html +49 -49
- data/doc/Bovem/ConsoleMethods/Logging/ClassMethods.html +5 -5
- data/doc/Bovem/ConsoleMethods/Output.html +39 -41
- data/doc/Bovem/ConsoleMethods/StyleHandling.html +5 -5
- data/doc/Bovem/ConsoleMethods/StyleHandling/ClassMethods.html +14 -18
- data/doc/Bovem/Errors.html +1 -1
- data/doc/Bovem/Errors/InvalidConfiguration.html +1 -1
- data/doc/Bovem/Errors/InvalidLogger.html +1 -1
- data/doc/Bovem/Logger.html +6 -6
- data/doc/Bovem/Shell.html +13 -13
- data/doc/Bovem/ShellMethods.html +1 -1
- data/doc/Bovem/ShellMethods/Directories.html +9 -9
- data/doc/Bovem/ShellMethods/Execute.html +9 -9
- data/doc/Bovem/ShellMethods/General.html +1 -1
- data/doc/Bovem/ShellMethods/Read.html +1 -1
- data/doc/Bovem/ShellMethods/Write.html +7 -9
- data/doc/Bovem/Version.html +3 -3
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/top-level-namespace.html +1 -1
- data/lib/bovem/configuration.rb +2 -2
- data/lib/bovem/console.rb +10 -13
- data/lib/bovem/logger.rb +2 -2
- data/lib/bovem/shell.rb +14 -12
- data/lib/bovem/version.rb +2 -2
- data/spec/bovem/console_spec.rb +1 -1
- data/spec/bovem/shell_spec.rb +8 -8
- metadata +5 -5
data/doc/Bovem/ShellMethods.html
CHANGED
@@ -116,7 +116,7 @@
|
|
116
116
|
</div>
|
117
117
|
|
118
118
|
<div id="footer">
|
119
|
-
Generated on
|
119
|
+
Generated on Thu Feb 28 10:15:57 2013 by
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
121
|
0.8.5.2 (ruby-1.9.3).
|
122
122
|
</div>
|
@@ -297,8 +297,6 @@
|
|
297
297
|
<pre class="lines">
|
298
298
|
|
299
299
|
|
300
|
-
453
|
301
|
-
454
|
302
300
|
455
|
303
301
|
456
|
304
302
|
457
|
@@ -313,10 +311,12 @@
|
|
313
311
|
466
|
314
312
|
467
|
315
313
|
468
|
316
|
-
469
|
314
|
+
469
|
315
|
+
470
|
316
|
+
471</pre>
|
317
317
|
</td>
|
318
318
|
<td>
|
319
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line
|
319
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line 455</span>
|
320
320
|
|
321
321
|
<span class='kw'>def</span> <span class='id identifier rubyid_create_directories'>create_directories</span><span class='lparen'>(</span><span class='id identifier rubyid_directories'>directories</span><span class='comma'>,</span> <span class='id identifier rubyid_mode'>mode</span> <span class='op'>=</span> <span class='int'>0755</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>
|
322
322
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>true</span>
|
@@ -435,8 +435,6 @@
|
|
435
435
|
<pre class="lines">
|
436
436
|
|
437
437
|
|
438
|
-
431
|
439
|
-
432
|
440
438
|
433
|
441
439
|
434
|
442
440
|
435
|
@@ -447,10 +445,12 @@
|
|
447
445
|
440
|
448
446
|
441
|
449
447
|
442
|
450
|
-
443
|
448
|
+
443
|
449
|
+
444
|
450
|
+
445</pre>
|
451
451
|
</td>
|
452
452
|
<td>
|
453
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line
|
453
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line 433</span>
|
454
454
|
|
455
455
|
<span class='kw'>def</span> <span class='id identifier rubyid_within_directory'>within_directory</span><span class='lparen'>(</span><span class='id identifier rubyid_directory'>directory</span><span class='comma'>,</span> <span class='id identifier rubyid_restore'>restore</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_show_messages'>show_messages</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
456
456
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>false</span>
|
@@ -475,7 +475,7 @@
|
|
475
475
|
</div>
|
476
476
|
|
477
477
|
<div id="footer">
|
478
|
-
Generated on
|
478
|
+
Generated on Thu Feb 28 10:15:57 2013 by
|
479
479
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
480
480
|
0.8.5.2 (ruby-1.9.3).
|
481
481
|
</div>
|
@@ -280,8 +280,6 @@
|
|
280
280
|
<pre class="lines">
|
281
281
|
|
282
282
|
|
283
|
-
375
|
284
|
-
376
|
285
283
|
377
|
286
284
|
378
|
287
285
|
379
|
@@ -304,10 +302,12 @@
|
|
304
302
|
396
|
305
303
|
397
|
306
304
|
398
|
307
|
-
399
|
305
|
+
399
|
306
|
+
400
|
307
|
+
401</pre>
|
308
308
|
</td>
|
309
309
|
<td>
|
310
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line
|
310
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line 377</span>
|
311
311
|
|
312
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
313
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>true</span>
|
@@ -502,8 +502,6 @@
|
|
502
502
|
<pre class="lines">
|
503
503
|
|
504
504
|
|
505
|
-
347
|
506
|
-
348
|
507
505
|
349
|
508
506
|
350
|
509
507
|
351
|
@@ -521,10 +519,12 @@
|
|
521
519
|
363
|
522
520
|
364
|
523
521
|
365
|
524
|
-
366
|
522
|
+
366
|
523
|
+
367
|
524
|
+
368</pre>
|
525
525
|
</td>
|
526
526
|
<td>
|
527
|
-
<pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line
|
527
|
+
<pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line 349</span>
|
528
528
|
|
529
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
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>
|
@@ -556,7 +556,7 @@
|
|
556
556
|
</div>
|
557
557
|
|
558
558
|
<div id="footer">
|
559
|
-
Generated on
|
559
|
+
Generated on Thu Feb 28 10:15:57 2013 by
|
560
560
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
561
561
|
0.8.5.2 (ruby-1.9.3).
|
562
562
|
</div>
|
@@ -551,7 +551,7 @@
|
|
551
551
|
</div>
|
552
552
|
|
553
553
|
<div id="footer">
|
554
|
-
Generated on
|
554
|
+
Generated on Thu Feb 28 10:15:57 2013 by
|
555
555
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
556
556
|
0.8.5.2 (ruby-1.9.3).
|
557
557
|
</div>
|
@@ -442,7 +442,7 @@
|
|
442
442
|
</div>
|
443
443
|
|
444
444
|
<div id="footer">
|
445
|
-
Generated on
|
445
|
+
Generated on Thu Feb 28 10:15:57 2013 by
|
446
446
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
447
447
|
0.8.5.2 (ruby-1.9.3).
|
448
448
|
</div>
|
@@ -139,7 +139,7 @@
|
|
139
139
|
<li class="public ">
|
140
140
|
<span class="summary_signature">
|
141
141
|
|
142
|
-
<a href="#copy_or_move-instance_method" title="#copy_or_move (instance method)">- (Boolean) <strong>copy_or_move</strong>(src, dst, operation, run = true, show_errors =
|
142
|
+
<a href="#copy_or_move-instance_method" title="#copy_or_move (instance method)">- (Boolean) <strong>copy_or_move</strong>(src, dst, operation, run = true, show_errors = true, fatal = true) </a>
|
143
143
|
|
144
144
|
|
145
145
|
|
@@ -336,7 +336,7 @@
|
|
336
336
|
<div class="method_details ">
|
337
337
|
<h3 class="signature " id="copy_or_move-instance_method">
|
338
338
|
|
339
|
-
- (<tt>Boolean</tt>) <strong>copy_or_move</strong>(src, dst, operation, run = true, show_errors =
|
339
|
+
- (<tt>Boolean</tt>) <strong>copy_or_move</strong>(src, dst, operation, run = true, show_errors = true, fatal = true)
|
340
340
|
|
341
341
|
|
342
342
|
|
@@ -423,7 +423,7 @@
|
|
423
423
|
<span class='type'>(<tt>Boolean</tt>)</span>
|
424
424
|
|
425
425
|
|
426
|
-
<em class="default">(defaults to: <tt>
|
426
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
427
427
|
|
428
428
|
|
429
429
|
—
|
@@ -491,16 +491,14 @@
|
|
491
491
|
201
|
492
492
|
202
|
493
493
|
203
|
494
|
-
204
|
495
|
-
205</pre>
|
494
|
+
204</pre>
|
496
495
|
</td>
|
497
496
|
<td>
|
498
497
|
<pre class="code"><span class="info file"># File 'lib/bovem/shell.rb', line 188</span>
|
499
498
|
|
500
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_copy_or_move'>copy_or_move</span><span class='lparen'>(</span><span class='id identifier rubyid_src'>src</span><span class='comma'>,</span> <span class='id identifier rubyid_dst'>dst</span><span class='comma'>,</span> <span class='id identifier rubyid_operation'>operation</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'>
|
499
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_copy_or_move'>copy_or_move</span><span class='lparen'>(</span><span class='id identifier rubyid_src'>src</span><span class='comma'>,</span> <span class='id identifier rubyid_dst'>dst</span><span class='comma'>,</span> <span class='id identifier rubyid_operation'>operation</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'>true</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>
|
501
500
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>true</span>
|
502
|
-
<span class='id identifier
|
503
|
-
<span class='id identifier rubyid_operation'>operation</span><span class='comma'>,</span> <span class='id identifier rubyid_operation_s'>operation_s</span><span class='comma'>,</span> <span class='id identifier rubyid_single'>single</span><span class='comma'>,</span> <span class='id identifier rubyid_src'>src</span><span class='comma'>,</span> <span class='id identifier rubyid_dst'>dst</span> <span class='op'>=</span> <span class='id identifier rubyid_sanitize_copy_or_move_arguments'>sanitize_copy_or_move_arguments</span><span class='lparen'>(</span><span class='id identifier rubyid_operation'>operation</span><span class='comma'>,</span> <span class='id identifier rubyid_src'>src</span><span class='comma'>,</span> <span class='id identifier rubyid_dst'>dst</span><span class='rparen'>)</span>
|
501
|
+
<span class='id identifier rubyid_operation'>operation</span><span class='comma'>,</span> <span class='id identifier rubyid_operation_s'>operation_s</span><span class='comma'>,</span> <span class='id identifier rubyid_single'>single</span><span class='comma'>,</span> <span class='id identifier rubyid_src'>src</span><span class='comma'>,</span> <span class='id identifier rubyid_dst'>dst</span> <span class='op'>=</span> <span class='id identifier rubyid_sanitize_copy_or_move'>sanitize_copy_or_move</span><span class='lparen'>(</span><span class='id identifier rubyid_operation'>operation</span><span class='comma'>,</span> <span class='id identifier rubyid_src'>src</span><span class='comma'>,</span> <span class='id identifier rubyid_dst'>dst</span><span class='rparen'>)</span>
|
504
502
|
|
505
503
|
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_run'>run</span> <span class='kw'>then</span>
|
506
504
|
<span class='id identifier rubyid_dry_run_copy_or_move'>dry_run_copy_or_move</span><span class='lparen'>(</span><span class='id identifier rubyid_single'>single</span><span class='comma'>,</span> <span class='id identifier rubyid_operation_s'>operation_s</span><span class='comma'>,</span> <span class='id identifier rubyid_src'>src</span><span class='comma'>,</span> <span class='id identifier rubyid_dst'>dst</span><span class='rparen'>)</span>
|
@@ -667,7 +665,7 @@
|
|
667
665
|
</div>
|
668
666
|
|
669
667
|
<div id="footer">
|
670
|
-
Generated on
|
668
|
+
Generated on Thu Feb 28 10:15:57 2013 by
|
671
669
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
672
670
|
0.8.5.2 (ruby-1.9.3).
|
673
671
|
</div>
|
data/doc/Bovem/Version.html
CHANGED
@@ -134,7 +134,7 @@
|
|
134
134
|
|
135
135
|
</div>
|
136
136
|
</dt>
|
137
|
-
<dd><pre class="code"><span class='int'>
|
137
|
+
<dd><pre class="code"><span class='int'>2</span></pre></dd>
|
138
138
|
|
139
139
|
<dt id="PATCH-constant" class="">PATCH =
|
140
140
|
<div class="docstring">
|
@@ -149,7 +149,7 @@
|
|
149
149
|
|
150
150
|
</div>
|
151
151
|
</dt>
|
152
|
-
<dd><pre class="code"><span class='int'>
|
152
|
+
<dd><pre class="code"><span class='int'>0</span></pre></dd>
|
153
153
|
|
154
154
|
<dt id="STRING-constant" class="">STRING =
|
155
155
|
<div class="docstring">
|
@@ -180,7 +180,7 @@
|
|
180
180
|
</div>
|
181
181
|
|
182
182
|
<div id="footer">
|
183
|
-
Generated on
|
183
|
+
Generated on Thu Feb 28 10:15:58 2013 by
|
184
184
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
185
185
|
0.8.5.2 (ruby-1.9.3).
|
186
186
|
</div>
|
data/doc/_index.html
CHANGED
@@ -346,7 +346,7 @@
|
|
346
346
|
</div>
|
347
347
|
|
348
348
|
<div id="footer">
|
349
|
-
Generated on
|
349
|
+
Generated on Thu Feb 28 10:15:57 2013 by
|
350
350
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
351
351
|
0.8.5.2 (ruby-1.9.3).
|
352
352
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -100,7 +100,7 @@
|
|
100
100
|
</div></div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on
|
103
|
+
Generated on Thu Feb 28 10:15:57 2013 by
|
104
104
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
105
|
0.8.5.2 (ruby-1.9.3).
|
106
106
|
</div>
|
data/doc/index.html
CHANGED
@@ -100,7 +100,7 @@
|
|
100
100
|
</div></div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on
|
103
|
+
Generated on Thu Feb 28 10:15:57 2013 by
|
104
104
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
105
|
0.8.5.2 (ruby-1.9.3).
|
106
106
|
</div>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Thu Feb 28 10:15:57 2013 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.5.2 (ruby-1.9.3).
|
109
109
|
</div>
|
data/lib/bovem/configuration.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
#
|
6
6
|
|
7
7
|
module Bovem
|
8
|
-
# This class holds the configuration of an
|
8
|
+
# This class holds the configuration of an application.
|
9
9
|
#
|
10
10
|
# Extend this class and add valid properties via {property property} method.
|
11
11
|
# Example:
|
@@ -95,7 +95,7 @@ module Bovem
|
|
95
95
|
path = file =~ /^#{File::SEPARATOR}/ ? file : ::Pathname.new(file).realpath.to_s
|
96
96
|
logger.info(self.i18n.configuration.using(path)) if logger
|
97
97
|
eval_file(path)
|
98
|
-
rescue ::Exception =>
|
98
|
+
rescue ::Exception => _
|
99
99
|
raise Bovem::Errors::InvalidConfiguration.new(self.i18n.configuration.invalid(file))
|
100
100
|
end
|
101
101
|
end
|
data/lib/bovem/console.rb
CHANGED
@@ -29,8 +29,6 @@ module Bovem
|
|
29
29
|
style = style.ensure_string.strip.parameterize
|
30
30
|
|
31
31
|
if style.present? then
|
32
|
-
sym = style.to_sym
|
33
|
-
|
34
32
|
::Bovem::Console.replace_term_code(Bovem::TERM_EFFECTS, style, 0) ||
|
35
33
|
::Bovem::Console.replace_term_code(Bovem::TERM_COLORS, style, 30) ||
|
36
34
|
::Bovem::Console.replace_term_code(Bovem::TERM_COLORS, style.gsub(/^bg_/, ""), 40) ||
|
@@ -119,7 +117,6 @@ module Bovem
|
|
119
117
|
# @return [Fixnum] The new indentation width.
|
120
118
|
def set_indentation(width, is_absolute = false)
|
121
119
|
@indentation = [(!is_absolute ? @indentation : 0) + width, 0].max.to_i
|
122
|
-
@indentation
|
123
120
|
end
|
124
121
|
|
125
122
|
# Resets indentation width to `0`.
|
@@ -152,7 +149,7 @@ module Bovem
|
|
152
149
|
if width.to_integer <= 0 then
|
153
150
|
message
|
154
151
|
else
|
155
|
-
width = (width == true || width.to_integer < 0 ? self.
|
152
|
+
width = (width == true || width.to_integer < 0 ? self.line_width : width.to_integer)
|
156
153
|
|
157
154
|
message.split("\n").collect { |line|
|
158
155
|
line.length > width ? line.gsub(/(.{1,#{width}})(\s+|$)/, "\\1\n").strip : line
|
@@ -165,10 +162,10 @@ module Bovem
|
|
165
162
|
# @param message [String] The message to indent.
|
166
163
|
# @param width [Fixnum] The indentation width. `true` means to use the current indentation, a negative value of `-x` will indent of `x` absolute spaces. `nil` or `false` will skip indentation.
|
167
164
|
# @param newline_separator [String] The character used for newlines.
|
168
|
-
# @return [String] The
|
165
|
+
# @return [String] The indented message.
|
169
166
|
def indent(message, width = true, newline_separator = "\n")
|
170
167
|
if width.to_integer != 0 then
|
171
|
-
width = (width
|
168
|
+
width = (width.is_a?(TrueClass) ? 0 : width.to_integer)
|
172
169
|
width = width < 0 ? -width : @indentation + width
|
173
170
|
|
174
171
|
message = message.split(newline_separator).collect {|line|
|
@@ -197,10 +194,10 @@ module Bovem
|
|
197
194
|
rv = self.replace_markers(rv, plain) # Replace markers
|
198
195
|
|
199
196
|
# Compute the real width available for the screen, if we both indent and wrap
|
200
|
-
if wrap
|
197
|
+
if wrap.is_a?(TrueClass) then
|
201
198
|
wrap = self.line_width
|
202
199
|
|
203
|
-
if indent
|
200
|
+
if indent.is_a?(TrueClass) then
|
204
201
|
wrap -= @indentation
|
205
202
|
else
|
206
203
|
indent_i = indent.to_integer
|
@@ -343,7 +340,7 @@ module Bovem
|
|
343
340
|
#
|
344
341
|
# @see #format
|
345
342
|
def begin(message, suffix = "\n", indent = true, wrap = false, plain = false, indented_banner = false, full_colored = false, print = true)
|
346
|
-
banner = self.get_banner("*", "bright green")
|
343
|
+
banner = self.get_banner("*", "bright green", full_colored)
|
347
344
|
message = self.indent(message, indented_banner ? 0 : indent)
|
348
345
|
self.write(banner + " " + message, suffix, indented_banner ? indent : 0, wrap, plain, print)
|
349
346
|
end
|
@@ -469,7 +466,7 @@ module Bovem
|
|
469
466
|
handle_reply(reply)
|
470
467
|
end
|
471
468
|
end
|
472
|
-
rescue Interrupt =>
|
469
|
+
rescue Interrupt => _
|
473
470
|
default_value
|
474
471
|
end
|
475
472
|
end
|
@@ -521,7 +518,7 @@ module Bovem
|
|
521
518
|
# @return [String|nil] The prompt to use or `nil`, if no message must be prompted.
|
522
519
|
def sanitize_prompt(prompt)
|
523
520
|
if prompt.present?
|
524
|
-
(prompt
|
521
|
+
(prompt.is_a?(TrueClass) ? self.i18n.console.prompt : prompt).gsub(/:?\s*$/, "") + ": "
|
525
522
|
else
|
526
523
|
nil
|
527
524
|
end
|
@@ -538,7 +535,7 @@ module Bovem
|
|
538
535
|
# Read an input from the terminal.
|
539
536
|
#
|
540
537
|
# @param prompt [String] A message to show to the user.
|
541
|
-
# @param echo [Boolean] If disable echoing. **Not supported and
|
538
|
+
# @param echo [Boolean] If disable echoing. **Not supported and therefore ignored on Rubinius.**
|
542
539
|
# @param default_value [Object] A default value to enter if the user just pressed the enter key.
|
543
540
|
# @return [Object] The read value.
|
544
541
|
def read_input_value(prompt, echo, default_value = nil)
|
@@ -619,7 +616,7 @@ module Bovem
|
|
619
616
|
begin
|
620
617
|
require "io/console" if !defined?($stdin.winsize)
|
621
618
|
$stdin.winsize[1]
|
622
|
-
rescue Exception =>
|
619
|
+
rescue Exception => _
|
623
620
|
80
|
624
621
|
end
|
625
622
|
end
|
data/lib/bovem/logger.rb
CHANGED
@@ -50,7 +50,7 @@ module Bovem
|
|
50
50
|
rv
|
51
51
|
end
|
52
52
|
|
53
|
-
# Translates a file to standard input or standard
|
53
|
+
# Translates a file to standard input or standard output in some special cases.
|
54
54
|
#
|
55
55
|
# @param file [String] The string to translate.
|
56
56
|
# @return [String|IO] The translated file name.
|
@@ -71,7 +71,7 @@ module Bovem
|
|
71
71
|
# The default formatter for logging.
|
72
72
|
# @return [Proc] The default formatter for logging.
|
73
73
|
def self.default_formatter
|
74
|
-
@default_formatter ||= ::Proc.new {|severity, datetime,
|
74
|
+
@default_formatter ||= ::Proc.new {|severity, datetime, _, msg|
|
75
75
|
color = case severity
|
76
76
|
when "DEBUG" then :cyan
|
77
77
|
when "INFO" then :green
|
data/lib/bovem/shell.rb
CHANGED
@@ -185,10 +185,9 @@ module Bovem
|
|
185
185
|
# @param show_errors [Boolean] If show errors.
|
186
186
|
# @param fatal [Boolean] If quit in case of fatal errors.
|
187
187
|
# @return [Boolean] `true` if operation succeeded, `false` otherwise.
|
188
|
-
def copy_or_move(src, dst, operation, run = true, show_errors =
|
188
|
+
def copy_or_move(src, dst, operation, run = true, show_errors = true, fatal = true)
|
189
189
|
rv = true
|
190
|
-
|
191
|
-
operation, operation_s, single, src, dst = sanitize_copy_or_move_arguments(operation, src, dst)
|
190
|
+
operation, operation_s, single, src, dst = sanitize_copy_or_move(operation, src, dst)
|
192
191
|
|
193
192
|
if !run then
|
194
193
|
dry_run_copy_or_move(single, operation_s, src, dst)
|
@@ -211,7 +210,7 @@ module Bovem
|
|
211
210
|
# @param src [String|Array] The entries to copy or move. If is an Array, `dst` is assumed to be a directory.
|
212
211
|
# @param dst [String] The destination. **Any existing entries will be overwritten.** Any required directory will be created.
|
213
212
|
# @return [Array] A list of sanitized arguments.
|
214
|
-
def
|
213
|
+
def sanitize_copy_or_move(operation, src, dst)
|
215
214
|
operation = :copy if operation != :move
|
216
215
|
single = !src.is_a?(Array)
|
217
216
|
src = single ? File.expand_path(src) : src.collect {|s| File.expand_path(s) }
|
@@ -296,7 +295,7 @@ module Bovem
|
|
296
295
|
|
297
296
|
begin
|
298
297
|
FileUtils.send(operation == :move ? :mv : :cp_r, src, dst, {noop: false, verbose: false})
|
299
|
-
rescue Errno::EACCES =>
|
298
|
+
rescue Errno::EACCES => _
|
300
299
|
single_msg = locale.copy_move_dst_not_writable_single(operation_s, src, dst_dir)
|
301
300
|
multi_msg = locale.copy_move_dst_not_writable_single(operation_s, dst)
|
302
301
|
handle_copy_move_failure(single, src, show_errors, fatal, single_msg, multi_msg, nil)
|
@@ -318,13 +317,16 @@ module Bovem
|
|
318
317
|
# @param error [String|nil] The ending message to show in case of multiple sources.
|
319
318
|
def handle_copy_move_failure(single, src, show_errors, fatal, single_msg, multi_msg, error)
|
320
319
|
if single then
|
321
|
-
@console.send(fatal ? :fatal : :error, single_msg, "\n", 5)
|
320
|
+
@console.send(fatal ? :fatal : :error, single_msg, "\n", 5) if fatal || show_errors
|
322
321
|
else
|
323
|
-
|
324
|
-
|
325
|
-
|
322
|
+
if show_errors then
|
323
|
+
@console.error(multi_msg)
|
324
|
+
@console.with_indentation(11) do
|
325
|
+
src.each do |s| @console.write(s) end
|
326
|
+
end
|
327
|
+
@console.write(error, "\n", 5) if error
|
326
328
|
end
|
327
|
-
|
329
|
+
|
328
330
|
Kernel.exit(-1) if fatal
|
329
331
|
end
|
330
332
|
|
@@ -409,7 +411,7 @@ module Bovem
|
|
409
411
|
output = ""
|
410
412
|
|
411
413
|
@console.info(self.i18n.shell.run(command)) if show_command
|
412
|
-
status = ::Open4::popen4(command + " 2>&1") { |
|
414
|
+
status = ::Open4::popen4(command + " 2>&1") { |_, _, stdout, _|
|
413
415
|
stdout.each_line do |line|
|
414
416
|
output << line
|
415
417
|
Kernel.print line if show_output
|
@@ -481,7 +483,7 @@ module Bovem
|
|
481
483
|
@console.info(message) if show_message
|
482
484
|
Dir.chdir(directory)
|
483
485
|
true
|
484
|
-
rescue Exception =>
|
486
|
+
rescue Exception => _
|
485
487
|
false
|
486
488
|
end
|
487
489
|
end
|