blackbox 3.1.4 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -1
- data/.rubocop.yml +4 -4
- data/README.md +1 -1
- data/blackbox.gemspec +2 -0
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +118 -3
- data/coverage/index.html +725 -19
- data/doc/BB.html +4 -4
- data/doc/BB/Crypto.html +1 -1
- data/doc/BB/Gem.html +1 -1
- data/doc/BB/Hash.html +1 -1
- data/doc/BB/Number.html +1 -1
- data/doc/BB/String.html +1 -1
- data/doc/BB/Unix.html +420 -0
- data/doc/_index.html +16 -1
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +2 -2
- data/doc/index.html +2 -2
- data/doc/method_list.html +11 -5
- data/doc/top-level-namespace.html +1 -1
- data/lib/blackbox/unix.rb +113 -0
- data/lib/blackbox/version.rb +1 -1
- data/spec/unix_spec.rb +33 -0
- metadata +34 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 317095c5fb64f2f5345a6032e3e7336a1e3176b6
|
4
|
+
data.tar.gz: e8b08beb86941881b40ee848144dea4536ad1c43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75768cde97a26673c4ae774774330ade4afdff0649f30acc9aa66fc0503b2d57dff5852ac865fa9e33ee0a5b1c23b8a1c87a611ff6e6684f42ebb7b3c508da44
|
7
|
+
data.tar.gz: 26880ff4d99d59e621f9d42fefea625e5274ca075c47035c7ef0ace9cb9fcafcb0a99f9fcaebb47f4763776a454c9535fde3d99a0847a48a445cd340db9c98b3
|
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
--format
|
1
|
+
--format progress
|
2
2
|
--color
|
data/.rubocop.yml
CHANGED
@@ -2,19 +2,19 @@ AllCops:
|
|
2
2
|
TargetRubyVersion: 2.3
|
3
3
|
|
4
4
|
Metrics/AbcSize:
|
5
|
-
Max:
|
5
|
+
Max: 200
|
6
6
|
|
7
7
|
Metrics/CyclomaticComplexity:
|
8
|
-
Max:
|
8
|
+
Max: 42
|
9
9
|
|
10
10
|
Metrics/LineLength:
|
11
11
|
Max: 133
|
12
12
|
|
13
13
|
Metrics/MethodLength:
|
14
|
-
Max:
|
14
|
+
Max: 100
|
15
15
|
|
16
16
|
Metrics/PerceivedComplexity:
|
17
|
-
Max:
|
17
|
+
Max: 42
|
18
18
|
|
19
19
|
Style/FormatString:
|
20
20
|
Exclude:
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Blackbox [![Build Status](https://travis-ci.org/busyloop/blackbox.png?branch=master)](https://travis-ci.org/busyloop/blackbox) [![Dependency Status](https://gemnasium.com/badges/github.com/busyloop/blackbox.svg)](https://gemnasium.com/github.com/busyloop/blackbox)
|
1
|
+
# Blackbox [![Build Status](https://travis-ci.org/busyloop/blackbox.png?branch=master)](https://travis-ci.org/busyloop/blackbox) [![Dependency Status](https://gemnasium.com/badges/github.com/busyloop/blackbox.svg)](https://gemnasium.com/github.com/busyloop/blackbox) [![Gem Version](https://badge.fury.io/rb/blackbox.svg)](https://badge.fury.io/rb/blackbox)
|
2
2
|
|
3
3
|
Various little helpers.
|
4
4
|
|
data/blackbox.gemspec
CHANGED
data/coverage/.last_run.json
CHANGED
data/coverage/.resultset.json
CHANGED
@@ -134,7 +134,7 @@
|
|
134
134
|
null,
|
135
135
|
8,
|
136
136
|
8,
|
137
|
-
|
137
|
+
64,
|
138
138
|
null,
|
139
139
|
null,
|
140
140
|
8,
|
@@ -162,7 +162,7 @@
|
|
162
162
|
7,
|
163
163
|
7,
|
164
164
|
null,
|
165
|
-
|
165
|
+
1,
|
166
166
|
null,
|
167
167
|
null,
|
168
168
|
7,
|
@@ -448,8 +448,123 @@
|
|
448
448
|
null,
|
449
449
|
null,
|
450
450
|
null
|
451
|
+
],
|
452
|
+
"/Users/moe/code/busyloop/blackbox/lib/blackbox/unix.rb": [
|
453
|
+
null,
|
454
|
+
1,
|
455
|
+
1,
|
456
|
+
1,
|
457
|
+
1,
|
458
|
+
1,
|
459
|
+
null,
|
460
|
+
1,
|
461
|
+
null,
|
462
|
+
1,
|
463
|
+
1,
|
464
|
+
null,
|
465
|
+
null,
|
466
|
+
null,
|
467
|
+
null,
|
468
|
+
1,
|
469
|
+
4,
|
470
|
+
null,
|
471
|
+
null,
|
472
|
+
null,
|
473
|
+
null,
|
474
|
+
null,
|
475
|
+
null,
|
476
|
+
4,
|
477
|
+
4,
|
478
|
+
8,
|
479
|
+
8,
|
480
|
+
null,
|
481
|
+
0,
|
482
|
+
null,
|
483
|
+
4,
|
484
|
+
4,
|
485
|
+
4,
|
486
|
+
4,
|
487
|
+
0,
|
488
|
+
0,
|
489
|
+
null,
|
490
|
+
null,
|
491
|
+
8,
|
492
|
+
null,
|
493
|
+
4,
|
494
|
+
4,
|
495
|
+
0,
|
496
|
+
0,
|
497
|
+
0,
|
498
|
+
0,
|
499
|
+
null,
|
500
|
+
0,
|
501
|
+
0,
|
502
|
+
0,
|
503
|
+
0,
|
504
|
+
0,
|
505
|
+
0,
|
506
|
+
null,
|
507
|
+
0,
|
508
|
+
0,
|
509
|
+
0,
|
510
|
+
0,
|
511
|
+
0,
|
512
|
+
0,
|
513
|
+
0,
|
514
|
+
0,
|
515
|
+
0,
|
516
|
+
0,
|
517
|
+
null,
|
518
|
+
null,
|
519
|
+
0,
|
520
|
+
null,
|
521
|
+
0,
|
522
|
+
0,
|
523
|
+
0,
|
524
|
+
0,
|
525
|
+
0,
|
526
|
+
0,
|
527
|
+
0,
|
528
|
+
0,
|
529
|
+
null,
|
530
|
+
0,
|
531
|
+
0,
|
532
|
+
null,
|
533
|
+
null,
|
534
|
+
null,
|
535
|
+
null,
|
536
|
+
null,
|
537
|
+
0,
|
538
|
+
null,
|
539
|
+
null,
|
540
|
+
0,
|
541
|
+
0,
|
542
|
+
0,
|
543
|
+
0,
|
544
|
+
null,
|
545
|
+
null,
|
546
|
+
4,
|
547
|
+
4,
|
548
|
+
4,
|
549
|
+
4,
|
550
|
+
4,
|
551
|
+
3,
|
552
|
+
3,
|
553
|
+
null,
|
554
|
+
null,
|
555
|
+
4,
|
556
|
+
2,
|
557
|
+
null,
|
558
|
+
2,
|
559
|
+
1,
|
560
|
+
null,
|
561
|
+
2,
|
562
|
+
null,
|
563
|
+
null,
|
564
|
+
null,
|
565
|
+
null
|
451
566
|
]
|
452
567
|
},
|
453
|
-
"timestamp":
|
568
|
+
"timestamp": 1465776828
|
454
569
|
}
|
455
570
|
}
|
data/coverage/index.html
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
6
6
|
<script src='./assets/0.10.0/application.js' type='text/javascript'></script>
|
7
7
|
<link href='./assets/0.10.0/application.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
|
8
|
-
<link rel="shortcut icon" type="image/png" href="./assets/0.10.0/
|
8
|
+
<link rel="shortcut icon" type="image/png" href="./assets/0.10.0/favicon_yellow.png" />
|
9
9
|
<link rel="icon" type="image/png" href="./assets/0.10.0/favicon.png" />
|
10
10
|
</head>
|
11
11
|
|
@@ -14,27 +14,27 @@
|
|
14
14
|
<img src="./assets/0.10.0/loading.gif" alt="loading"/>
|
15
15
|
</div>
|
16
16
|
<div id="wrapper" style="display:none;">
|
17
|
-
<div class="timestamp">Generated <abbr class="timeago" title="2016-
|
17
|
+
<div class="timestamp">Generated <abbr class="timeago" title="2016-06-13T02:13:48+02:00">2016-06-13T02:13:48+02:00</abbr></div>
|
18
18
|
<ul class="group_tabs"></ul>
|
19
19
|
|
20
20
|
<div id="content">
|
21
21
|
<div class="file_list_container" id="AllFiles">
|
22
22
|
<h2>
|
23
23
|
<span class="group_name">All Files</span>
|
24
|
-
(<span class="covered_percent"><span class="
|
24
|
+
(<span class="covered_percent"><span class="yellow">81.07%</span></span>
|
25
25
|
covered at
|
26
26
|
<span class="covered_strength">
|
27
27
|
<span class="green">
|
28
|
-
|
28
|
+
40.95
|
29
29
|
</span>
|
30
30
|
</span> hits/line)
|
31
31
|
</h2>
|
32
32
|
<a name="AllFiles"></a>
|
33
33
|
<div>
|
34
|
-
<b>
|
35
|
-
<b>
|
36
|
-
<span class="green"><b>
|
37
|
-
<span class="red"><b>
|
34
|
+
<b>6</b> files in total.
|
35
|
+
<b>206</b> relevant lines.
|
36
|
+
<span class="green"><b>167</b> lines covered</span> and
|
37
|
+
<span class="red"><b>39</b> lines missed </span>
|
38
38
|
</div>
|
39
39
|
<table class="file_list">
|
40
40
|
<thead>
|
@@ -62,12 +62,12 @@
|
|
62
62
|
|
63
63
|
<tr>
|
64
64
|
<td class="strong"><a href="#192e300fd7769b750c82567439ee016f85516f3d" class="src_link" title="lib/blackbox/gem.rb">lib/blackbox/gem.rb</a></td>
|
65
|
-
<td class="green strong">
|
65
|
+
<td class="green strong">100.0 %</td>
|
66
66
|
<td>93</td>
|
67
67
|
<td>33</td>
|
68
|
-
<td>
|
69
|
-
<td>
|
70
|
-
<td>
|
68
|
+
<td>33</td>
|
69
|
+
<td>0</td>
|
70
|
+
<td>7.3</td>
|
71
71
|
</tr>
|
72
72
|
|
73
73
|
<tr>
|
@@ -100,6 +100,16 @@
|
|
100
100
|
<td>1.0</td>
|
101
101
|
</tr>
|
102
102
|
|
103
|
+
<tr>
|
104
|
+
<td class="strong"><a href="#ef107940f0bb318164d36d5de1cd48192edb65f2" class="src_link" title="lib/blackbox/unix.rb">lib/blackbox/unix.rb</a></td>
|
105
|
+
<td class="red strong">45.83 %</td>
|
106
|
+
<td>113</td>
|
107
|
+
<td>72</td>
|
108
|
+
<td>33</td>
|
109
|
+
<td>39</td>
|
110
|
+
<td>1.5</td>
|
111
|
+
</tr>
|
112
|
+
|
103
113
|
</tbody>
|
104
114
|
</table>
|
105
115
|
</div>
|
@@ -719,11 +729,11 @@
|
|
719
729
|
<div class="source_table" id="192e300fd7769b750c82567439ee016f85516f3d">
|
720
730
|
<div class="header">
|
721
731
|
<h3>lib/blackbox/gem.rb</h3>
|
722
|
-
<h4><span class="green">
|
732
|
+
<h4><span class="green">100.0 %</span> covered</h4>
|
723
733
|
<div>
|
724
734
|
<b>33</b> relevant lines.
|
725
|
-
<span class="green"><b>
|
726
|
-
<span class="red"><b>
|
735
|
+
<span class="green"><b>33</b> lines covered</span> and
|
736
|
+
<span class="red"><b>0</b> lines missed.</span>
|
727
737
|
</div>
|
728
738
|
</div>
|
729
739
|
|
@@ -928,8 +938,8 @@
|
|
928
938
|
<code class="ruby"> spec = ::Gem::Specification.find do |s|</code>
|
929
939
|
</li>
|
930
940
|
|
931
|
-
<li class="covered" data-hits="
|
932
|
-
<span class="hits">
|
941
|
+
<li class="covered" data-hits="64" data-linenumber="34">
|
942
|
+
<span class="hits">64</span>
|
933
943
|
|
934
944
|
<code class="ruby"> File.fnmatch(File.join(s.full_gem_path, '*'), calling_file)</code>
|
935
945
|
</li>
|
@@ -1096,8 +1106,8 @@
|
|
1096
1106
|
<code class="ruby"> rescue</code>
|
1097
1107
|
</li>
|
1098
1108
|
|
1099
|
-
<li class="
|
1100
|
-
|
1109
|
+
<li class="covered" data-hits="1" data-linenumber="62">
|
1110
|
+
<span class="hits">1</span>
|
1101
1111
|
|
1102
1112
|
<code class="ruby"> last_check_at = Time.at(0)</code>
|
1103
1113
|
</li>
|
@@ -2834,6 +2844,702 @@
|
|
2834
2844
|
</pre>
|
2835
2845
|
</div>
|
2836
2846
|
|
2847
|
+
<div class="source_table" id="ef107940f0bb318164d36d5de1cd48192edb65f2">
|
2848
|
+
<div class="header">
|
2849
|
+
<h3>lib/blackbox/unix.rb</h3>
|
2850
|
+
<h4><span class="red">45.83 %</span> covered</h4>
|
2851
|
+
<div>
|
2852
|
+
<b>72</b> relevant lines.
|
2853
|
+
<span class="green"><b>33</b> lines covered</span> and
|
2854
|
+
<span class="red"><b>39</b> lines missed.</span>
|
2855
|
+
</div>
|
2856
|
+
</div>
|
2857
|
+
|
2858
|
+
<pre>
|
2859
|
+
<ol>
|
2860
|
+
|
2861
|
+
<li class="never" data-hits="" data-linenumber="1">
|
2862
|
+
|
2863
|
+
|
2864
|
+
<code class="ruby"># frozen_string_literal: true</code>
|
2865
|
+
</li>
|
2866
|
+
|
2867
|
+
<li class="covered" data-hits="1" data-linenumber="2">
|
2868
|
+
<span class="hits">1</span>
|
2869
|
+
|
2870
|
+
<code class="ruby">require 'lolcat/lol'</code>
|
2871
|
+
</li>
|
2872
|
+
|
2873
|
+
<li class="covered" data-hits="1" data-linenumber="3">
|
2874
|
+
<span class="hits">1</span>
|
2875
|
+
|
2876
|
+
<code class="ruby">require 'thread'</code>
|
2877
|
+
</li>
|
2878
|
+
|
2879
|
+
<li class="covered" data-hits="1" data-linenumber="4">
|
2880
|
+
<span class="hits">1</span>
|
2881
|
+
|
2882
|
+
<code class="ruby">require 'open3'</code>
|
2883
|
+
</li>
|
2884
|
+
|
2885
|
+
<li class="covered" data-hits="1" data-linenumber="5">
|
2886
|
+
<span class="hits">1</span>
|
2887
|
+
|
2888
|
+
<code class="ruby">require 'pty'</code>
|
2889
|
+
</li>
|
2890
|
+
|
2891
|
+
<li class="covered" data-hits="1" data-linenumber="6">
|
2892
|
+
<span class="hits">1</span>
|
2893
|
+
|
2894
|
+
<code class="ruby">require 'rainbow/ext/string'</code>
|
2895
|
+
</li>
|
2896
|
+
|
2897
|
+
<li class="never" data-hits="" data-linenumber="7">
|
2898
|
+
|
2899
|
+
|
2900
|
+
<code class="ruby"></code>
|
2901
|
+
</li>
|
2902
|
+
|
2903
|
+
<li class="covered" data-hits="1" data-linenumber="8">
|
2904
|
+
<span class="hits">1</span>
|
2905
|
+
|
2906
|
+
<code class="ruby">module BB</code>
|
2907
|
+
</li>
|
2908
|
+
|
2909
|
+
<li class="never" data-hits="" data-linenumber="9">
|
2910
|
+
|
2911
|
+
|
2912
|
+
<code class="ruby"> # Unix utilities.</code>
|
2913
|
+
</li>
|
2914
|
+
|
2915
|
+
<li class="covered" data-hits="1" data-linenumber="10">
|
2916
|
+
<span class="hits">1</span>
|
2917
|
+
|
2918
|
+
<code class="ruby"> module Unix</code>
|
2919
|
+
</li>
|
2920
|
+
|
2921
|
+
<li class="covered" data-hits="1" data-linenumber="11">
|
2922
|
+
<span class="hits">1</span>
|
2923
|
+
|
2924
|
+
<code class="ruby"> class << self</code>
|
2925
|
+
</li>
|
2926
|
+
|
2927
|
+
<li class="never" data-hits="" data-linenumber="12">
|
2928
|
+
|
2929
|
+
|
2930
|
+
<code class="ruby"> # Run each line of a script in a shell.</code>
|
2931
|
+
</li>
|
2932
|
+
|
2933
|
+
<li class="never" data-hits="" data-linenumber="13">
|
2934
|
+
|
2935
|
+
|
2936
|
+
<code class="ruby"> #</code>
|
2937
|
+
</li>
|
2938
|
+
|
2939
|
+
<li class="never" data-hits="" data-linenumber="14">
|
2940
|
+
|
2941
|
+
|
2942
|
+
<code class="ruby"> # @param [Hash] script Script</code>
|
2943
|
+
</li>
|
2944
|
+
|
2945
|
+
<li class="never" data-hits="" data-linenumber="15">
|
2946
|
+
|
2947
|
+
|
2948
|
+
<code class="ruby"> # @return [Hash] Exit status (depends on mode)</code>
|
2949
|
+
</li>
|
2950
|
+
|
2951
|
+
<li class="covered" data-hits="1" data-linenumber="16">
|
2952
|
+
<span class="hits">1</span>
|
2953
|
+
|
2954
|
+
<code class="ruby"> def run_each(script, opts = {})</code>
|
2955
|
+
</li>
|
2956
|
+
|
2957
|
+
<li class="covered" data-hits="4" data-linenumber="17">
|
2958
|
+
<span class="hits">4</span>
|
2959
|
+
|
2960
|
+
<code class="ruby"> opts = {</code>
|
2961
|
+
</li>
|
2962
|
+
|
2963
|
+
<li class="never" data-hits="" data-linenumber="18">
|
2964
|
+
|
2965
|
+
|
2966
|
+
<code class="ruby"> quiet: false,</code>
|
2967
|
+
</li>
|
2968
|
+
|
2969
|
+
<li class="never" data-hits="" data-linenumber="19">
|
2970
|
+
|
2971
|
+
|
2972
|
+
<code class="ruby"> failfast: true,</code>
|
2973
|
+
</li>
|
2974
|
+
|
2975
|
+
<li class="never" data-hits="" data-linenumber="20">
|
2976
|
+
|
2977
|
+
|
2978
|
+
<code class="ruby"> spinner: nil,</code>
|
2979
|
+
</li>
|
2980
|
+
|
2981
|
+
<li class="never" data-hits="" data-linenumber="21">
|
2982
|
+
|
2983
|
+
|
2984
|
+
<code class="ruby"> stream: false</code>
|
2985
|
+
</li>
|
2986
|
+
|
2987
|
+
<li class="never" data-hits="" data-linenumber="22">
|
2988
|
+
|
2989
|
+
|
2990
|
+
<code class="ruby"> }.merge(opts)</code>
|
2991
|
+
</li>
|
2992
|
+
|
2993
|
+
<li class="never" data-hits="" data-linenumber="23">
|
2994
|
+
|
2995
|
+
|
2996
|
+
<code class="ruby"></code>
|
2997
|
+
</li>
|
2998
|
+
|
2999
|
+
<li class="covered" data-hits="4" data-linenumber="24">
|
3000
|
+
<span class="hits">4</span>
|
3001
|
+
|
3002
|
+
<code class="ruby"> @minispinlock ||= Mutex.new</code>
|
3003
|
+
</li>
|
3004
|
+
|
3005
|
+
<li class="covered" data-hits="4" data-linenumber="25">
|
3006
|
+
<span class="hits">4</span>
|
3007
|
+
|
3008
|
+
<code class="ruby"> script.lines.each_with_index do |line, i|</code>
|
3009
|
+
</li>
|
3010
|
+
|
3011
|
+
<li class="covered" data-hits="8" data-linenumber="26">
|
3012
|
+
<span class="hits">8</span>
|
3013
|
+
|
3014
|
+
<code class="ruby"> line.chomp!</code>
|
3015
|
+
</li>
|
3016
|
+
|
3017
|
+
<li class="covered" data-hits="8" data-linenumber="27">
|
3018
|
+
<span class="hits">8</span>
|
3019
|
+
|
3020
|
+
<code class="ruby"> case line[0]</code>
|
3021
|
+
</li>
|
3022
|
+
|
3023
|
+
<li class="never" data-hits="" data-linenumber="28">
|
3024
|
+
|
3025
|
+
|
3026
|
+
<code class="ruby"> when '#'</code>
|
3027
|
+
</li>
|
3028
|
+
|
3029
|
+
<li class="missed" data-hits="0" data-linenumber="29">
|
3030
|
+
|
3031
|
+
|
3032
|
+
<code class="ruby"> puts "\n" + line.bright unless opts[:quiet]</code>
|
3033
|
+
</li>
|
3034
|
+
|
3035
|
+
<li class="never" data-hits="" data-linenumber="30">
|
3036
|
+
|
3037
|
+
|
3038
|
+
<code class="ruby"> when ':'</code>
|
3039
|
+
</li>
|
3040
|
+
|
3041
|
+
<li class="covered" data-hits="4" data-linenumber="31">
|
3042
|
+
<span class="hits">4</span>
|
3043
|
+
|
3044
|
+
<code class="ruby"> opts[:quiet] = true if line == ':quiet'</code>
|
3045
|
+
</li>
|
3046
|
+
|
3047
|
+
<li class="covered" data-hits="4" data-linenumber="32">
|
3048
|
+
<span class="hits">4</span>
|
3049
|
+
|
3050
|
+
<code class="ruby"> opts[:failfast] = false if line == ':return'</code>
|
3051
|
+
</li>
|
3052
|
+
|
3053
|
+
<li class="covered" data-hits="4" data-linenumber="33">
|
3054
|
+
<span class="hits">4</span>
|
3055
|
+
|
3056
|
+
<code class="ruby"> opts[:spinner] = nil if line == ':nospinner'</code>
|
3057
|
+
</li>
|
3058
|
+
|
3059
|
+
<li class="covered" data-hits="4" data-linenumber="34">
|
3060
|
+
<span class="hits">4</span>
|
3061
|
+
|
3062
|
+
<code class="ruby"> if line == ':stream'</code>
|
3063
|
+
</li>
|
3064
|
+
|
3065
|
+
<li class="missed" data-hits="0" data-linenumber="35">
|
3066
|
+
|
3067
|
+
|
3068
|
+
<code class="ruby"> opts[:stream] = true</code>
|
3069
|
+
</li>
|
3070
|
+
|
3071
|
+
<li class="missed" data-hits="0" data-linenumber="36">
|
3072
|
+
|
3073
|
+
|
3074
|
+
<code class="ruby"> opts[:quiet] = false</code>
|
3075
|
+
</li>
|
3076
|
+
|
3077
|
+
<li class="never" data-hits="" data-linenumber="37">
|
3078
|
+
|
3079
|
+
|
3080
|
+
<code class="ruby"> end</code>
|
3081
|
+
</li>
|
3082
|
+
|
3083
|
+
<li class="never" data-hits="" data-linenumber="38">
|
3084
|
+
|
3085
|
+
|
3086
|
+
<code class="ruby"> end</code>
|
3087
|
+
</li>
|
3088
|
+
|
3089
|
+
<li class="covered" data-hits="8" data-linenumber="39">
|
3090
|
+
<span class="hits">8</span>
|
3091
|
+
|
3092
|
+
<code class="ruby"> next if line.empty? || ['#', ':'].include?(line[0])</code>
|
3093
|
+
</li>
|
3094
|
+
|
3095
|
+
<li class="never" data-hits="" data-linenumber="40">
|
3096
|
+
|
3097
|
+
|
3098
|
+
<code class="ruby"></code>
|
3099
|
+
</li>
|
3100
|
+
|
3101
|
+
<li class="covered" data-hits="4" data-linenumber="41">
|
3102
|
+
<span class="hits">4</span>
|
3103
|
+
|
3104
|
+
<code class="ruby"> status = nil</code>
|
3105
|
+
</li>
|
3106
|
+
|
3107
|
+
<li class="covered" data-hits="4" data-linenumber="42">
|
3108
|
+
<span class="hits">4</span>
|
3109
|
+
|
3110
|
+
<code class="ruby"> if opts[:stream]</code>
|
3111
|
+
</li>
|
3112
|
+
|
3113
|
+
<li class="missed" data-hits="0" data-linenumber="43">
|
3114
|
+
|
3115
|
+
|
3116
|
+
<code class="ruby"> puts "\n> ".color(:green) + line.color(:black).bright</code>
|
3117
|
+
</li>
|
3118
|
+
|
3119
|
+
<li class="missed" data-hits="0" data-linenumber="44">
|
3120
|
+
|
3121
|
+
|
3122
|
+
<code class="ruby"> rows, cols = STDIN.winsize</code>
|
3123
|
+
</li>
|
3124
|
+
|
3125
|
+
<li class="missed" data-hits="0" data-linenumber="45">
|
3126
|
+
|
3127
|
+
|
3128
|
+
<code class="ruby"> @minispin_disable = false</code>
|
3129
|
+
</li>
|
3130
|
+
|
3131
|
+
<li class="missed" data-hits="0" data-linenumber="46">
|
3132
|
+
|
3133
|
+
|
3134
|
+
<code class="ruby"> @minispin_last_char_at = Time.now</code>
|
3135
|
+
</li>
|
3136
|
+
|
3137
|
+
<li class="never" data-hits="" data-linenumber="47">
|
3138
|
+
|
3139
|
+
|
3140
|
+
<code class="ruby"> @tspin ||= Thread.new do</code>
|
3141
|
+
</li>
|
3142
|
+
|
3143
|
+
<li class="missed" data-hits="0" data-linenumber="48">
|
3144
|
+
|
3145
|
+
|
3146
|
+
<code class="ruby"> i = 0</code>
|
3147
|
+
</li>
|
3148
|
+
|
3149
|
+
<li class="missed" data-hits="0" data-linenumber="49">
|
3150
|
+
|
3151
|
+
|
3152
|
+
<code class="ruby"> loop do</code>
|
3153
|
+
</li>
|
3154
|
+
|
3155
|
+
<li class="missed" data-hits="0" data-linenumber="50">
|
3156
|
+
|
3157
|
+
|
3158
|
+
<code class="ruby"> break if @minispin_last_char_at == :end</code>
|
3159
|
+
</li>
|
3160
|
+
|
3161
|
+
<li class="missed" data-hits="0" data-linenumber="51">
|
3162
|
+
|
3163
|
+
|
3164
|
+
<code class="ruby"> if 0.23 > Time.now - @minispin_last_char_at || @minispin_disable</code>
|
3165
|
+
</li>
|
3166
|
+
|
3167
|
+
<li class="missed" data-hits="0" data-linenumber="52">
|
3168
|
+
|
3169
|
+
|
3170
|
+
<code class="ruby"> sleep 0.1</code>
|
3171
|
+
</li>
|
3172
|
+
|
3173
|
+
<li class="missed" data-hits="0" data-linenumber="53">
|
3174
|
+
|
3175
|
+
|
3176
|
+
<code class="ruby"> next</code>
|
3177
|
+
</li>
|
3178
|
+
|
3179
|
+
<li class="never" data-hits="" data-linenumber="54">
|
3180
|
+
|
3181
|
+
|
3182
|
+
<code class="ruby"> end</code>
|
3183
|
+
</li>
|
3184
|
+
|
3185
|
+
<li class="missed" data-hits="0" data-linenumber="55">
|
3186
|
+
|
3187
|
+
|
3188
|
+
<code class="ruby"> @minispinlock.synchronize do</code>
|
3189
|
+
</li>
|
3190
|
+
|
3191
|
+
<li class="missed" data-hits="0" data-linenumber="56">
|
3192
|
+
|
3193
|
+
|
3194
|
+
<code class="ruby"> next if @minispin_disable</code>
|
3195
|
+
</li>
|
3196
|
+
|
3197
|
+
<li class="missed" data-hits="0" data-linenumber="57">
|
3198
|
+
|
3199
|
+
|
3200
|
+
<code class="ruby"> print "\e[?25l"</code>
|
3201
|
+
</li>
|
3202
|
+
|
3203
|
+
<li class="missed" data-hits="0" data-linenumber="58">
|
3204
|
+
|
3205
|
+
|
3206
|
+
<code class="ruby"> print Paint[' ', '#000', Lol.rainbow(1, i / 3.0)]</code>
|
3207
|
+
</li>
|
3208
|
+
|
3209
|
+
<li class="missed" data-hits="0" data-linenumber="59">
|
3210
|
+
|
3211
|
+
|
3212
|
+
<code class="ruby"> sleep 0.12</code>
|
3213
|
+
</li>
|
3214
|
+
|
3215
|
+
<li class="missed" data-hits="0" data-linenumber="60">
|
3216
|
+
|
3217
|
+
|
3218
|
+
<code class="ruby"> print 8.chr</code>
|
3219
|
+
</li>
|
3220
|
+
|
3221
|
+
<li class="missed" data-hits="0" data-linenumber="61">
|
3222
|
+
|
3223
|
+
|
3224
|
+
<code class="ruby"> print ' '</code>
|
3225
|
+
</li>
|
3226
|
+
|
3227
|
+
<li class="missed" data-hits="0" data-linenumber="62">
|
3228
|
+
|
3229
|
+
|
3230
|
+
<code class="ruby"> print 8.chr</code>
|
3231
|
+
</li>
|
3232
|
+
|
3233
|
+
<li class="missed" data-hits="0" data-linenumber="63">
|
3234
|
+
|
3235
|
+
|
3236
|
+
<code class="ruby"> i += 1</code>
|
3237
|
+
</li>
|
3238
|
+
|
3239
|
+
<li class="missed" data-hits="0" data-linenumber="64">
|
3240
|
+
|
3241
|
+
|
3242
|
+
<code class="ruby"> print "\e[?25h"</code>
|
3243
|
+
</li>
|
3244
|
+
|
3245
|
+
<li class="never" data-hits="" data-linenumber="65">
|
3246
|
+
|
3247
|
+
|
3248
|
+
<code class="ruby"> end</code>
|
3249
|
+
</li>
|
3250
|
+
|
3251
|
+
<li class="never" data-hits="" data-linenumber="66">
|
3252
|
+
|
3253
|
+
|
3254
|
+
<code class="ruby"> end</code>
|
3255
|
+
</li>
|
3256
|
+
|
3257
|
+
<li class="missed" data-hits="0" data-linenumber="67">
|
3258
|
+
|
3259
|
+
|
3260
|
+
<code class="ruby"> end</code>
|
3261
|
+
</li>
|
3262
|
+
|
3263
|
+
<li class="never" data-hits="" data-linenumber="68">
|
3264
|
+
|
3265
|
+
|
3266
|
+
<code class="ruby"></code>
|
3267
|
+
</li>
|
3268
|
+
|
3269
|
+
<li class="missed" data-hits="0" data-linenumber="69">
|
3270
|
+
|
3271
|
+
|
3272
|
+
<code class="ruby"> PTY.spawn("stty rows #{rows} cols #{cols}; " + line) do |r, _w, pid|</code>
|
3273
|
+
</li>
|
3274
|
+
|
3275
|
+
<li class="missed" data-hits="0" data-linenumber="70">
|
3276
|
+
|
3277
|
+
|
3278
|
+
<code class="ruby"> begin</code>
|
3279
|
+
</li>
|
3280
|
+
|
3281
|
+
<li class="missed" data-hits="0" data-linenumber="71">
|
3282
|
+
|
3283
|
+
|
3284
|
+
<code class="ruby"> until r.eof?</code>
|
3285
|
+
</li>
|
3286
|
+
|
3287
|
+
<li class="missed" data-hits="0" data-linenumber="72">
|
3288
|
+
|
3289
|
+
|
3290
|
+
<code class="ruby"> c = r.getc</code>
|
3291
|
+
</li>
|
3292
|
+
|
3293
|
+
<li class="missed" data-hits="0" data-linenumber="73">
|
3294
|
+
|
3295
|
+
|
3296
|
+
<code class="ruby"> @minispinlock.synchronize do</code>
|
3297
|
+
</li>
|
3298
|
+
|
3299
|
+
<li class="missed" data-hits="0" data-linenumber="74">
|
3300
|
+
|
3301
|
+
|
3302
|
+
<code class="ruby"> print c</code>
|
3303
|
+
</li>
|
3304
|
+
|
3305
|
+
<li class="missed" data-hits="0" data-linenumber="75">
|
3306
|
+
|
3307
|
+
|
3308
|
+
<code class="ruby"> @minispin_last_char_at = Time.now</code>
|
3309
|
+
</li>
|
3310
|
+
|
3311
|
+
<li class="missed" data-hits="0" data-linenumber="76">
|
3312
|
+
|
3313
|
+
|
3314
|
+
<code class="ruby"> c = c.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: "\e") # barf.</code>
|
3315
|
+
</li>
|
3316
|
+
|
3317
|
+
<li class="never" data-hits="" data-linenumber="77">
|
3318
|
+
|
3319
|
+
|
3320
|
+
<code class="ruby"> # hold on when we are (likely) inside an escape sequence</code>
|
3321
|
+
</li>
|
3322
|
+
|
3323
|
+
<li class="missed" data-hits="0" data-linenumber="78">
|
3324
|
+
|
3325
|
+
|
3326
|
+
<code class="ruby"> @minispin_disable = true if c.ord == 27 || c.ord < 9</code>
|
3327
|
+
</li>
|
3328
|
+
|
3329
|
+
<li class="missed" data-hits="0" data-linenumber="79">
|
3330
|
+
|
3331
|
+
|
3332
|
+
<code class="ruby"> @minispin_disable = false if c =~ /[A-Za-z]/ || [13, 10].include?(c.ord)</code>
|
3333
|
+
</li>
|
3334
|
+
|
3335
|
+
<li class="never" data-hits="" data-linenumber="80">
|
3336
|
+
|
3337
|
+
|
3338
|
+
<code class="ruby"> end</code>
|
3339
|
+
</li>
|
3340
|
+
|
3341
|
+
<li class="never" data-hits="" data-linenumber="81">
|
3342
|
+
|
3343
|
+
|
3344
|
+
<code class="ruby"> end</code>
|
3345
|
+
</li>
|
3346
|
+
|
3347
|
+
<li class="never" data-hits="" data-linenumber="82">
|
3348
|
+
|
3349
|
+
|
3350
|
+
<code class="ruby"> rescue Errno::EIO</code>
|
3351
|
+
</li>
|
3352
|
+
|
3353
|
+
<li class="never" data-hits="" data-linenumber="83">
|
3354
|
+
|
3355
|
+
|
3356
|
+
<code class="ruby"> # Linux raises EIO on EOF, cf.</code>
|
3357
|
+
</li>
|
3358
|
+
|
3359
|
+
<li class="never" data-hits="" data-linenumber="84">
|
3360
|
+
|
3361
|
+
|
3362
|
+
<code class="ruby"> # https://github.com/ruby/ruby/blob/57fb2199059cb55b632d093c2e64c8a3c60acfbb/ext/pty/pty.c#L519</code>
|
3363
|
+
</li>
|
3364
|
+
|
3365
|
+
<li class="missed" data-hits="0" data-linenumber="85">
|
3366
|
+
|
3367
|
+
|
3368
|
+
<code class="ruby"> nil</code>
|
3369
|
+
</li>
|
3370
|
+
|
3371
|
+
<li class="never" data-hits="" data-linenumber="86">
|
3372
|
+
|
3373
|
+
|
3374
|
+
<code class="ruby"> end</code>
|
3375
|
+
</li>
|
3376
|
+
|
3377
|
+
<li class="never" data-hits="" data-linenumber="87">
|
3378
|
+
|
3379
|
+
|
3380
|
+
<code class="ruby"></code>
|
3381
|
+
</li>
|
3382
|
+
|
3383
|
+
<li class="missed" data-hits="0" data-linenumber="88">
|
3384
|
+
|
3385
|
+
|
3386
|
+
<code class="ruby"> _pid, status = Process.wait2(pid)</code>
|
3387
|
+
</li>
|
3388
|
+
|
3389
|
+
<li class="missed" data-hits="0" data-linenumber="89">
|
3390
|
+
|
3391
|
+
|
3392
|
+
<code class="ruby"> @minispin_last_char_at = :end</code>
|
3393
|
+
</li>
|
3394
|
+
|
3395
|
+
<li class="missed" data-hits="0" data-linenumber="90">
|
3396
|
+
|
3397
|
+
|
3398
|
+
<code class="ruby"> @tspin.join</code>
|
3399
|
+
</li>
|
3400
|
+
|
3401
|
+
<li class="missed" data-hits="0" data-linenumber="91">
|
3402
|
+
|
3403
|
+
|
3404
|
+
<code class="ruby"> @tspin = nil</code>
|
3405
|
+
</li>
|
3406
|
+
|
3407
|
+
<li class="never" data-hits="" data-linenumber="92">
|
3408
|
+
|
3409
|
+
|
3410
|
+
<code class="ruby"> end</code>
|
3411
|
+
</li>
|
3412
|
+
|
3413
|
+
<li class="never" data-hits="" data-linenumber="93">
|
3414
|
+
|
3415
|
+
|
3416
|
+
<code class="ruby"> else</code>
|
3417
|
+
</li>
|
3418
|
+
|
3419
|
+
<li class="covered" data-hits="4" data-linenumber="94">
|
3420
|
+
<span class="hits">4</span>
|
3421
|
+
|
3422
|
+
<code class="ruby"> opts[:spinner].call(true) if opts[:spinner]</code>
|
3423
|
+
</li>
|
3424
|
+
|
3425
|
+
<li class="covered" data-hits="4" data-linenumber="95">
|
3426
|
+
<span class="hits">4</span>
|
3427
|
+
|
3428
|
+
<code class="ruby"> output, status = Open3.capture2e(line)</code>
|
3429
|
+
</li>
|
3430
|
+
|
3431
|
+
<li class="covered" data-hits="4" data-linenumber="96">
|
3432
|
+
<span class="hits">4</span>
|
3433
|
+
|
3434
|
+
<code class="ruby"> opts[:spinner].call(false) if opts[:spinner]</code>
|
3435
|
+
</li>
|
3436
|
+
|
3437
|
+
<li class="covered" data-hits="4" data-linenumber="97">
|
3438
|
+
<span class="hits">4</span>
|
3439
|
+
|
3440
|
+
<code class="ruby"> color = (status.exitstatus == 0) ? :green : :red</code>
|
3441
|
+
</li>
|
3442
|
+
|
3443
|
+
<li class="covered" data-hits="4" data-linenumber="98">
|
3444
|
+
<span class="hits">4</span>
|
3445
|
+
|
3446
|
+
<code class="ruby"> if status.exitstatus != 0 || !opts[:quiet]</code>
|
3447
|
+
</li>
|
3448
|
+
|
3449
|
+
<li class="covered" data-hits="3" data-linenumber="99">
|
3450
|
+
<span class="hits">3</span>
|
3451
|
+
|
3452
|
+
<code class="ruby"> puts "\n> ".color(color) + line.color(:black).bright</code>
|
3453
|
+
</li>
|
3454
|
+
|
3455
|
+
<li class="covered" data-hits="3" data-linenumber="100">
|
3456
|
+
<span class="hits">3</span>
|
3457
|
+
|
3458
|
+
<code class="ruby"> puts output</code>
|
3459
|
+
</li>
|
3460
|
+
|
3461
|
+
<li class="never" data-hits="" data-linenumber="101">
|
3462
|
+
|
3463
|
+
|
3464
|
+
<code class="ruby"> end</code>
|
3465
|
+
</li>
|
3466
|
+
|
3467
|
+
<li class="never" data-hits="" data-linenumber="102">
|
3468
|
+
|
3469
|
+
|
3470
|
+
<code class="ruby"> end</code>
|
3471
|
+
</li>
|
3472
|
+
|
3473
|
+
<li class="covered" data-hits="4" data-linenumber="103">
|
3474
|
+
<span class="hits">4</span>
|
3475
|
+
|
3476
|
+
<code class="ruby"> next unless status.exitstatus != 0</code>
|
3477
|
+
</li>
|
3478
|
+
|
3479
|
+
<li class="covered" data-hits="2" data-linenumber="104">
|
3480
|
+
<span class="hits">2</span>
|
3481
|
+
|
3482
|
+
<code class="ruby"> puts "Error, exit #{status.exitstatus}: #{line} (L#{i})".color(:red).bright</code>
|
3483
|
+
</li>
|
3484
|
+
|
3485
|
+
<li class="never" data-hits="" data-linenumber="105">
|
3486
|
+
|
3487
|
+
|
3488
|
+
<code class="ruby"></code>
|
3489
|
+
</li>
|
3490
|
+
|
3491
|
+
<li class="covered" data-hits="2" data-linenumber="106">
|
3492
|
+
<span class="hits">2</span>
|
3493
|
+
|
3494
|
+
<code class="ruby"> exit status.exitstatus if opts[:failfast]</code>
|
3495
|
+
</li>
|
3496
|
+
|
3497
|
+
<li class="covered" data-hits="1" data-linenumber="107">
|
3498
|
+
<span class="hits">1</span>
|
3499
|
+
|
3500
|
+
<code class="ruby"> return status.exitstatus</code>
|
3501
|
+
</li>
|
3502
|
+
|
3503
|
+
<li class="never" data-hits="" data-linenumber="108">
|
3504
|
+
|
3505
|
+
|
3506
|
+
<code class="ruby"> end</code>
|
3507
|
+
</li>
|
3508
|
+
|
3509
|
+
<li class="covered" data-hits="2" data-linenumber="109">
|
3510
|
+
<span class="hits">2</span>
|
3511
|
+
|
3512
|
+
<code class="ruby"> 0</code>
|
3513
|
+
</li>
|
3514
|
+
|
3515
|
+
<li class="never" data-hits="" data-linenumber="110">
|
3516
|
+
|
3517
|
+
|
3518
|
+
<code class="ruby"> end</code>
|
3519
|
+
</li>
|
3520
|
+
|
3521
|
+
<li class="never" data-hits="" data-linenumber="111">
|
3522
|
+
|
3523
|
+
|
3524
|
+
<code class="ruby"> end</code>
|
3525
|
+
</li>
|
3526
|
+
|
3527
|
+
<li class="never" data-hits="" data-linenumber="112">
|
3528
|
+
|
3529
|
+
|
3530
|
+
<code class="ruby"> end</code>
|
3531
|
+
</li>
|
3532
|
+
|
3533
|
+
<li class="never" data-hits="" data-linenumber="113">
|
3534
|
+
|
3535
|
+
|
3536
|
+
<code class="ruby">end</code>
|
3537
|
+
</li>
|
3538
|
+
|
3539
|
+
</ol>
|
3540
|
+
</pre>
|
3541
|
+
</div>
|
3542
|
+
|
2837
3543
|
</div>
|
2838
3544
|
</div>
|
2839
3545
|
</body>
|