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
data/doc/BB.html
CHANGED
@@ -80,7 +80,7 @@
|
|
80
80
|
|
81
81
|
<dt class="r1 last">Defined in:</dt>
|
82
82
|
<dd class="r1 last">lib/blackbox/gem.rb<span class="defines">,<br />
|
83
|
-
lib/blackbox/hash.rb,<br /> lib/blackbox/
|
83
|
+
lib/blackbox/hash.rb,<br /> lib/blackbox/unix.rb,<br /> lib/blackbox/string.rb,<br /> lib/blackbox/number.rb,<br /> lib/blackbox/crypto.rb,<br /> lib/blackbox/version.rb</span>
|
84
84
|
</dd>
|
85
85
|
|
86
86
|
</dl>
|
@@ -101,7 +101,7 @@
|
|
101
101
|
<p class="children">
|
102
102
|
|
103
103
|
|
104
|
-
<strong class="modules">Modules:</strong> <span class='object_link'><a href="BB/Crypto.html" title="BB::Crypto (module)">Crypto</a></span>, <span class='object_link'><a href="BB/Gem.html" title="BB::Gem (module)">Gem</a></span>, <span class='object_link'><a href="BB/Hash.html" title="BB::Hash (module)">Hash</a></span>, <span class='object_link'><a href="BB/Number.html" title="BB::Number (module)">Number</a></span>, <span class='object_link'><a href="BB/String.html" title="BB::String (module)">String</a></span>
|
104
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="BB/Crypto.html" title="BB::Crypto (module)">Crypto</a></span>, <span class='object_link'><a href="BB/Gem.html" title="BB::Gem (module)">Gem</a></span>, <span class='object_link'><a href="BB/Hash.html" title="BB::Hash (module)">Hash</a></span>, <span class='object_link'><a href="BB/Number.html" title="BB::Number (module)">Number</a></span>, <span class='object_link'><a href="BB/String.html" title="BB::String (module)">String</a></span>, <span class='object_link'><a href="BB/Unix.html" title="BB::Unix (module)">Unix</a></span>
|
105
105
|
|
106
106
|
|
107
107
|
|
@@ -115,7 +115,7 @@
|
|
115
115
|
<dt id="VERSION-constant" class="">VERSION =
|
116
116
|
|
117
117
|
</dt>
|
118
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>3.
|
118
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>3.2.0</span><span class='tstring_end'>'</span></span></pre></dd>
|
119
119
|
|
120
120
|
</dl>
|
121
121
|
|
@@ -131,7 +131,7 @@
|
|
131
131
|
</div>
|
132
132
|
|
133
133
|
<div id="footer">
|
134
|
-
Generated on
|
134
|
+
Generated on Mon Jun 13 02:13:50 2016 by
|
135
135
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
136
136
|
0.8.7.6 (ruby-2.3.1).
|
137
137
|
</div>
|
data/doc/BB/Crypto.html
CHANGED
@@ -1132,7 +1132,7 @@
|
|
1132
1132
|
</div>
|
1133
1133
|
|
1134
1134
|
<div id="footer">
|
1135
|
-
Generated on
|
1135
|
+
Generated on Mon Jun 13 02:13:50 2016 by
|
1136
1136
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1137
1137
|
0.8.7.6 (ruby-2.3.1).
|
1138
1138
|
</div>
|
data/doc/BB/Gem.html
CHANGED
@@ -428,7 +428,7 @@ version?</p>
|
|
428
428
|
</div>
|
429
429
|
|
430
430
|
<div id="footer">
|
431
|
-
Generated on
|
431
|
+
Generated on Mon Jun 13 02:13:50 2016 by
|
432
432
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
433
433
|
0.8.7.6 (ruby-2.3.1).
|
434
434
|
</div>
|
data/doc/BB/Hash.html
CHANGED
@@ -432,7 +432,7 @@ BB::Hash.flatten_prop_style(input)
|
|
432
432
|
</div>
|
433
433
|
|
434
434
|
<div id="footer">
|
435
|
-
Generated on
|
435
|
+
Generated on Mon Jun 13 02:13:50 2016 by
|
436
436
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
437
437
|
0.8.7.6 (ruby-2.3.1).
|
438
438
|
</div>
|
data/doc/BB/Number.html
CHANGED
@@ -922,7 +922,7 @@ can customize the format in the <code>options</code> hash.</p>
|
|
922
922
|
</div>
|
923
923
|
|
924
924
|
<div id="footer">
|
925
|
-
Generated on
|
925
|
+
Generated on Mon Jun 13 02:13:50 2016 by
|
926
926
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
927
927
|
0.8.7.6 (ruby-2.3.1).
|
928
928
|
</div>
|
data/doc/BB/String.html
CHANGED
@@ -231,7 +231,7 @@
|
|
231
231
|
</div>
|
232
232
|
|
233
233
|
<div id="footer">
|
234
|
-
Generated on
|
234
|
+
Generated on Mon Jun 13 02:13:50 2016 by
|
235
235
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
236
236
|
0.8.7.6 (ruby-2.3.1).
|
237
237
|
</div>
|
data/doc/BB/Unix.html
ADDED
@@ -0,0 +1,420 @@
|
|
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: BB::Unix
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" 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#!BB/Unix.html";
|
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 (U)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../BB.html" title="BB (module)">BB</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Unix</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: BB::Unix
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/blackbox/unix.rb</dd>
|
83
|
+
|
84
|
+
</dl>
|
85
|
+
<div class="clear"></div>
|
86
|
+
|
87
|
+
<h2>Overview</h2><div class="docstring">
|
88
|
+
<div class="discussion">
|
89
|
+
|
90
|
+
<p>Unix utilities.</p>
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
<div class="tags">
|
96
|
+
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<h2>
|
107
|
+
Class Method Summary
|
108
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
109
|
+
</h2>
|
110
|
+
|
111
|
+
<ul class="summary">
|
112
|
+
|
113
|
+
<li class="public ">
|
114
|
+
<span class="summary_signature">
|
115
|
+
|
116
|
+
<a href="#run_each-class_method" title="run_each (class method)">+ (Hash) <strong>run_each</strong>(script, opts = {}) </a>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
</span>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
<span class="summary_desc"><div class='inline'>
|
131
|
+
<p>Run each line of a script in a shell.</p>
|
132
|
+
</div></span>
|
133
|
+
|
134
|
+
</li>
|
135
|
+
|
136
|
+
|
137
|
+
</ul>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
<div id="class_method_details" class="method_details_list">
|
143
|
+
<h2>Class Method Details</h2>
|
144
|
+
|
145
|
+
|
146
|
+
<div class="method_details first">
|
147
|
+
<h3 class="signature first" id="run_each-class_method">
|
148
|
+
|
149
|
+
+ (<tt><span class='object_link'><a href="Hash.html" title="BB::Hash (module)">Hash</a></span></tt>) <strong>run_each</strong>(script, opts = {})
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
</h3><div class="docstring">
|
156
|
+
<div class="discussion">
|
157
|
+
|
158
|
+
<p>Run each line of a script in a shell.</p>
|
159
|
+
|
160
|
+
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
<div class="tags">
|
164
|
+
<p class="tag_title">Parameters:</p>
|
165
|
+
<ul class="param">
|
166
|
+
|
167
|
+
<li>
|
168
|
+
|
169
|
+
<span class='name'>script</span>
|
170
|
+
|
171
|
+
|
172
|
+
<span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="BB::Hash (module)">Hash</a></span></tt>)</span>
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
—
|
177
|
+
<div class='inline'>
|
178
|
+
<p>Script</p>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
</li>
|
182
|
+
|
183
|
+
</ul>
|
184
|
+
|
185
|
+
<p class="tag_title">Returns:</p>
|
186
|
+
<ul class="return">
|
187
|
+
|
188
|
+
<li>
|
189
|
+
|
190
|
+
|
191
|
+
<span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="BB::Hash (module)">Hash</a></span></tt>)</span>
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
—
|
196
|
+
<div class='inline'>
|
197
|
+
<p>Exit status (depends on mode)</p>
|
198
|
+
</div>
|
199
|
+
|
200
|
+
</li>
|
201
|
+
|
202
|
+
</ul>
|
203
|
+
|
204
|
+
</div><table class="source_code">
|
205
|
+
<tr>
|
206
|
+
<td>
|
207
|
+
<pre class="lines">
|
208
|
+
|
209
|
+
|
210
|
+
16
|
211
|
+
17
|
212
|
+
18
|
213
|
+
19
|
214
|
+
20
|
215
|
+
21
|
216
|
+
22
|
217
|
+
23
|
218
|
+
24
|
219
|
+
25
|
220
|
+
26
|
221
|
+
27
|
222
|
+
28
|
223
|
+
29
|
224
|
+
30
|
225
|
+
31
|
226
|
+
32
|
227
|
+
33
|
228
|
+
34
|
229
|
+
35
|
230
|
+
36
|
231
|
+
37
|
232
|
+
38
|
233
|
+
39
|
234
|
+
40
|
235
|
+
41
|
236
|
+
42
|
237
|
+
43
|
238
|
+
44
|
239
|
+
45
|
240
|
+
46
|
241
|
+
47
|
242
|
+
48
|
243
|
+
49
|
244
|
+
50
|
245
|
+
51
|
246
|
+
52
|
247
|
+
53
|
248
|
+
54
|
249
|
+
55
|
250
|
+
56
|
251
|
+
57
|
252
|
+
58
|
253
|
+
59
|
254
|
+
60
|
255
|
+
61
|
256
|
+
62
|
257
|
+
63
|
258
|
+
64
|
259
|
+
65
|
260
|
+
66
|
261
|
+
67
|
262
|
+
68
|
263
|
+
69
|
264
|
+
70
|
265
|
+
71
|
266
|
+
72
|
267
|
+
73
|
268
|
+
74
|
269
|
+
75
|
270
|
+
76
|
271
|
+
77
|
272
|
+
78
|
273
|
+
79
|
274
|
+
80
|
275
|
+
81
|
276
|
+
82
|
277
|
+
83
|
278
|
+
84
|
279
|
+
85
|
280
|
+
86
|
281
|
+
87
|
282
|
+
88
|
283
|
+
89
|
284
|
+
90
|
285
|
+
91
|
286
|
+
92
|
287
|
+
93
|
288
|
+
94
|
289
|
+
95
|
290
|
+
96
|
291
|
+
97
|
292
|
+
98
|
293
|
+
99
|
294
|
+
100
|
295
|
+
101
|
296
|
+
102
|
297
|
+
103
|
298
|
+
104
|
299
|
+
105
|
300
|
+
106
|
301
|
+
107
|
302
|
+
108
|
303
|
+
109
|
304
|
+
110</pre>
|
305
|
+
</td>
|
306
|
+
<td>
|
307
|
+
<pre class="code"><span class="info file"># File 'lib/blackbox/unix.rb', line 16</span>
|
308
|
+
|
309
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_run_each'>run_each</span><span class='lparen'>(</span><span class='id identifier rubyid_script'>script</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
310
|
+
<span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
311
|
+
<span class='label'>quiet:</span> <span class='kw'>false</span><span class='comma'>,</span>
|
312
|
+
<span class='label'>failfast:</span> <span class='kw'>true</span><span class='comma'>,</span>
|
313
|
+
<span class='label'>spinner:</span> <span class='kw'>nil</span><span class='comma'>,</span>
|
314
|
+
<span class='label'>stream:</span> <span class='kw'>false</span>
|
315
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
|
316
|
+
|
317
|
+
<span class='ivar'>@minispinlock</span> <span class='op'>||=</span> <span class='const'>Mutex</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
318
|
+
<span class='id identifier rubyid_script'>script</span><span class='period'>.</span><span class='id identifier rubyid_lines'>lines</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_line'>line</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
|
319
|
+
<span class='id identifier rubyid_line'>line</span><span class='period'>.</span><span class='id identifier rubyid_chomp!'>chomp!</span>
|
320
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_line'>line</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
|
321
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>#</span><span class='tstring_end'>'</span></span>
|
322
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span> <span class='op'>+</span> <span class='id identifier rubyid_line'>line</span><span class='period'>.</span><span class='id identifier rubyid_bright'>bright</span> <span class='kw'>unless</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:quiet</span><span class='rbracket'>]</span>
|
323
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>:</span><span class='tstring_end'>'</span></span>
|
324
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:quiet</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='id identifier rubyid_line'>line</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>:quiet</span><span class='tstring_end'>'</span></span>
|
325
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:failfast</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_line'>line</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>:return</span><span class='tstring_end'>'</span></span>
|
326
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:spinner</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_line'>line</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>:nospinner</span><span class='tstring_end'>'</span></span>
|
327
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_line'>line</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>:stream</span><span class='tstring_end'>'</span></span>
|
328
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:stream</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>true</span>
|
329
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:quiet</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>false</span>
|
330
|
+
<span class='kw'>end</span>
|
331
|
+
<span class='kw'>end</span>
|
332
|
+
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_line'>line</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>#</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>:</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_line'>line</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
333
|
+
|
334
|
+
<span class='id identifier rubyid_status'>status</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
335
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:stream</span><span class='rbracket'>]</span>
|
336
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n> </span><span class='tstring_end'>"</span></span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='symbol'>:green</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='id identifier rubyid_line'>line</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='symbol'>:black</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_bright'>bright</span>
|
337
|
+
<span class='id identifier rubyid_rows'>rows</span><span class='comma'>,</span> <span class='id identifier rubyid_cols'>cols</span> <span class='op'>=</span> <span class='const'>STDIN</span><span class='period'>.</span><span class='id identifier rubyid_winsize'>winsize</span>
|
338
|
+
<span class='ivar'>@minispin_disable</span> <span class='op'>=</span> <span class='kw'>false</span>
|
339
|
+
<span class='ivar'>@minispin_last_char_at</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
|
340
|
+
<span class='ivar'>@tspin</span> <span class='op'>||=</span> <span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
|
341
|
+
<span class='id identifier rubyid_i'>i</span> <span class='op'>=</span> <span class='int'>0</span>
|
342
|
+
<span class='id identifier rubyid_loop'>loop</span> <span class='kw'>do</span>
|
343
|
+
<span class='kw'>break</span> <span class='kw'>if</span> <span class='ivar'>@minispin_last_char_at</span> <span class='op'>==</span> <span class='symbol'>:end</span>
|
344
|
+
<span class='kw'>if</span> <span class='float'>0.23</span> <span class='op'>></span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='ivar'>@minispin_last_char_at</span> <span class='op'>||</span> <span class='ivar'>@minispin_disable</span>
|
345
|
+
<span class='id identifier rubyid_sleep'>sleep</span> <span class='float'>0.1</span>
|
346
|
+
<span class='kw'>next</span>
|
347
|
+
<span class='kw'>end</span>
|
348
|
+
<span class='ivar'>@minispinlock</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
349
|
+
<span class='kw'>next</span> <span class='kw'>if</span> <span class='ivar'>@minispin_disable</span>
|
350
|
+
<span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\e[?25l</span><span class='tstring_end'>"</span></span>
|
351
|
+
<span class='id identifier rubyid_print'>print</span> <span class='const'>Paint</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> </span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>#000</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='const'>Lol</span><span class='period'>.</span><span class='id identifier rubyid_rainbow'>rainbow</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span> <span class='op'>/</span> <span class='float'>3.0</span><span class='rparen'>)</span><span class='rbracket'>]</span>
|
352
|
+
<span class='id identifier rubyid_sleep'>sleep</span> <span class='float'>0.12</span>
|
353
|
+
<span class='id identifier rubyid_print'>print</span> <span class='int'>8</span><span class='period'>.</span><span class='id identifier rubyid_chr'>chr</span>
|
354
|
+
<span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> </span><span class='tstring_end'>'</span></span>
|
355
|
+
<span class='id identifier rubyid_print'>print</span> <span class='int'>8</span><span class='period'>.</span><span class='id identifier rubyid_chr'>chr</span>
|
356
|
+
<span class='id identifier rubyid_i'>i</span> <span class='op'>+=</span> <span class='int'>1</span>
|
357
|
+
<span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\e[?25h</span><span class='tstring_end'>"</span></span>
|
358
|
+
<span class='kw'>end</span>
|
359
|
+
<span class='kw'>end</span>
|
360
|
+
<span class='kw'>end</span>
|
361
|
+
|
362
|
+
<span class='const'>PTY</span><span class='period'>.</span><span class='id identifier rubyid_spawn'>spawn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>stty rows </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rows'>rows</span><span class='embexpr_end'>}</span><span class='tstring_content'> cols </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_cols'>cols</span><span class='embexpr_end'>}</span><span class='tstring_content'>; </span><span class='tstring_end'>"</span></span> <span class='op'>+</span> <span class='id identifier rubyid_line'>line</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_r'>r</span><span class='comma'>,</span> <span class='id identifier rubyid__w'>_w</span><span class='comma'>,</span> <span class='id identifier rubyid_pid'>pid</span><span class='op'>|</span>
|
363
|
+
<span class='kw'>begin</span>
|
364
|
+
<span class='kw'>until</span> <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_eof?'>eof?</span>
|
365
|
+
<span class='id identifier rubyid_c'>c</span> <span class='op'>=</span> <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_getc'>getc</span>
|
366
|
+
<span class='ivar'>@minispinlock</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
367
|
+
<span class='id identifier rubyid_print'>print</span> <span class='id identifier rubyid_c'>c</span>
|
368
|
+
<span class='ivar'>@minispin_last_char_at</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
|
369
|
+
<span class='id identifier rubyid_c'>c</span> <span class='op'>=</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_encode'>encode</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>UTF-8</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>binary</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>invalid:</span> <span class='symbol'>:replace</span><span class='comma'>,</span> <span class='label'>undef:</span> <span class='symbol'>:replace</span><span class='comma'>,</span> <span class='label'>replace:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\e</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='comment'># barf.
|
370
|
+
</span> <span class='comment'># hold on when we are (likely) inside an escape sequence
|
371
|
+
</span> <span class='ivar'>@minispin_disable</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_ord'>ord</span> <span class='op'>==</span> <span class='int'>27</span> <span class='op'>||</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_ord'>ord</span> <span class='op'><</span> <span class='int'>9</span>
|
372
|
+
<span class='ivar'>@minispin_disable</span> <span class='op'>=</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_c'>c</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[A-Za-z]</span><span class='regexp_end'>/</span></span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='int'>13</span><span class='comma'>,</span> <span class='int'>10</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_ord'>ord</span><span class='rparen'>)</span>
|
373
|
+
<span class='kw'>end</span>
|
374
|
+
<span class='kw'>end</span>
|
375
|
+
<span class='kw'>rescue</span> <span class='const'>Errno</span><span class='op'>::</span><span class='const'>EIO</span>
|
376
|
+
<span class='comment'># Linux raises EIO on EOF, cf.
|
377
|
+
</span> <span class='comment'># https://github.com/ruby/ruby/blob/57fb2199059cb55b632d093c2e64c8a3c60acfbb/ext/pty/pty.c#L519
|
378
|
+
</span> <span class='kw'>nil</span>
|
379
|
+
<span class='kw'>end</span>
|
380
|
+
|
381
|
+
<span class='id identifier rubyid__pid'>_pid</span><span class='comma'>,</span> <span class='id identifier rubyid_status'>status</span> <span class='op'>=</span> <span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_wait2'>wait2</span><span class='lparen'>(</span><span class='id identifier rubyid_pid'>pid</span><span class='rparen'>)</span>
|
382
|
+
<span class='ivar'>@minispin_last_char_at</span> <span class='op'>=</span> <span class='symbol'>:end</span>
|
383
|
+
<span class='ivar'>@tspin</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span>
|
384
|
+
<span class='ivar'>@tspin</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
385
|
+
<span class='kw'>end</span>
|
386
|
+
<span class='kw'>else</span>
|
387
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:spinner</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>true</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:spinner</span><span class='rbracket'>]</span>
|
388
|
+
<span class='id identifier rubyid_output'>output</span><span class='comma'>,</span> <span class='id identifier rubyid_status'>status</span> <span class='op'>=</span> <span class='const'>Open3</span><span class='period'>.</span><span class='id identifier rubyid_capture2e'>capture2e</span><span class='lparen'>(</span><span class='id identifier rubyid_line'>line</span><span class='rparen'>)</span>
|
389
|
+
<span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:spinner</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='kw'>false</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:spinner</span><span class='rbracket'>]</span>
|
390
|
+
<span class='id identifier rubyid_color'>color</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_status'>status</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>==</span> <span class='int'>0</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='symbol'>:green</span> <span class='op'>:</span> <span class='symbol'>:red</span>
|
391
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_status'>status</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>!=</span> <span class='int'>0</span> <span class='op'>||</span> <span class='op'>!</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:quiet</span><span class='rbracket'>]</span>
|
392
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n> </span><span class='tstring_end'>"</span></span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='id identifier rubyid_color'>color</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='id identifier rubyid_line'>line</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='symbol'>:black</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_bright'>bright</span>
|
393
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_output'>output</span>
|
394
|
+
<span class='kw'>end</span>
|
395
|
+
<span class='kw'>end</span>
|
396
|
+
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_status'>status</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='op'>!=</span> <span class='int'>0</span>
|
397
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Error, exit </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_status'>status</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_line'>line</span><span class='embexpr_end'>}</span><span class='tstring_content'> (L</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_i'>i</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</span></span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='lparen'>(</span><span class='symbol'>:red</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_bright'>bright</span>
|
398
|
+
|
399
|
+
<span class='id identifier rubyid_exit'>exit</span> <span class='id identifier rubyid_status'>status</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span> <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:failfast</span><span class='rbracket'>]</span>
|
400
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_status'>status</span><span class='period'>.</span><span class='id identifier rubyid_exitstatus'>exitstatus</span>
|
401
|
+
<span class='kw'>end</span>
|
402
|
+
<span class='int'>0</span>
|
403
|
+
<span class='kw'>end</span></pre>
|
404
|
+
</td>
|
405
|
+
</tr>
|
406
|
+
</table>
|
407
|
+
</div>
|
408
|
+
|
409
|
+
</div>
|
410
|
+
|
411
|
+
</div>
|
412
|
+
|
413
|
+
<div id="footer">
|
414
|
+
Generated on Mon Jun 13 02:13:50 2016 by
|
415
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
416
|
+
0.8.7.6 (ruby-2.3.1).
|
417
|
+
</div>
|
418
|
+
|
419
|
+
</body>
|
420
|
+
</html>
|