tty-spinner 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -5
- data/lib/tty/spinner.rb +14 -2
- data/lib/tty/spinner/formats.rb +120 -2
- data/lib/tty/spinner/version.rb +1 -1
- metadata +12 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78cca8f09f1905f3cc652e58d71e0e9aaa0b90af
|
4
|
+
data.tar.gz: 8b4776c0f0e1e347edf5f03af42a548198ad24fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c098cbcad5c133655d05693bcbbbd4bdbc59118ae5334cb6f81fe196aa66aab6b67490b54887d467e7615847250ccf77b2d5f773c5f2f8b4c47905c18d898ba3
|
7
|
+
data.tar.gz: 690a4aa38f1b0955d9bb448e45896e3034eb4c6422aa57d177e6a6eb76148cf10d7d87c45bc6e37b79db27f68c090e3d64ab9aef02082ebf4158d941c63c32f0
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# TTY::Spinner [][gitter]
|
2
|
+
|
2
3
|
[][gem]
|
3
4
|
[][travis]
|
4
5
|
[][appveyor]
|
5
|
-
[][codeclimate]
|
6
7
|
[][coverage]
|
7
8
|
[][inchpages]
|
8
9
|
|
@@ -10,7 +11,7 @@
|
|
10
11
|
[gem]: http://badge.fury.io/rb/tty-spinner
|
11
12
|
[travis]: http://travis-ci.org/piotrmurach/tty-spinner
|
12
13
|
[appveyor]: https://ci.appveyor.com/project/piotrmurach/tty-spinner
|
13
|
-
[codeclimate]: https://codeclimate.com/github/piotrmurach/tty-spinner
|
14
|
+
[codeclimate]: https://codeclimate.com/github/piotrmurach/tty-spinner/maintainability
|
14
15
|
[coverage]: https://coveralls.io/r/piotrmurach/tty-spinner
|
15
16
|
[inchpages]: http://inch-ci.org/github/piotrmurach/tty-spinner
|
16
17
|
|
@@ -356,9 +357,11 @@ spinner = TTY::Spinner.new(error_mark: 'x')
|
|
356
357
|
|
357
358
|
### 3.8 :output
|
358
359
|
|
359
|
-
|
360
|
+
The spinner only outputs to a console and when output is redirected to a file or a pipe it does nothing. This is so, for example, your error logs do not overflow with spinner output.
|
360
361
|
|
361
|
-
|
362
|
+
You can change where console output is streamed with `:output` option:
|
363
|
+
|
364
|
+
```ruby
|
362
365
|
spinner = TTY::Spinner.new(output: $stdout)
|
363
366
|
```
|
364
367
|
|
@@ -533,4 +536,4 @@ multi_spinner = TTY::Spinner::Multi.new("[:spinner] parent", style: {
|
|
533
536
|
|
534
537
|
## Copyright
|
535
538
|
|
536
|
-
Copyright (c) 2014-
|
539
|
+
Copyright (c) 2014-2018 Piotr Murach. See LICENSE for further details.
|
data/lib/tty/spinner.rb
CHANGED
@@ -373,7 +373,8 @@ module TTY
|
|
373
373
|
if @hide_cursor
|
374
374
|
write(TTY::Cursor.show, false)
|
375
375
|
end
|
376
|
-
|
376
|
+
clear_line
|
377
|
+
return if @clear
|
377
378
|
|
378
379
|
data = message.gsub(MATCHER, next_char)
|
379
380
|
data = replace_tokens(data)
|
@@ -381,7 +382,7 @@ module TTY
|
|
381
382
|
data << ' ' + stop_message
|
382
383
|
end
|
383
384
|
|
384
|
-
write(data,
|
385
|
+
write(data, false)
|
385
386
|
write("\n", false) unless @clear || @multispinner
|
386
387
|
ensure
|
387
388
|
@state = :stopped
|
@@ -496,6 +497,8 @@ module TTY
|
|
496
497
|
#
|
497
498
|
# @api private
|
498
499
|
def write(data, clear_first = false)
|
500
|
+
return unless tty? # write only to terminal
|
501
|
+
|
499
502
|
execute_on_line do
|
500
503
|
output.print(TTY::Cursor.column(1)) if clear_first
|
501
504
|
# If there's a top level spinner, print with inset
|
@@ -505,6 +508,15 @@ module TTY
|
|
505
508
|
end
|
506
509
|
end
|
507
510
|
|
511
|
+
# Check if IO is attached to a terminal
|
512
|
+
#
|
513
|
+
# return [Boolean]
|
514
|
+
#
|
515
|
+
# @api public
|
516
|
+
def tty?
|
517
|
+
output.respond_to?(:tty?) && output.tty?
|
518
|
+
end
|
519
|
+
|
508
520
|
# Emit callback
|
509
521
|
#
|
510
522
|
# @api private
|
data/lib/tty/spinner/formats.rb
CHANGED
@@ -20,7 +20,7 @@ module TTY
|
|
20
20
|
frames: %w{◰ ◳ ◲ ◱}
|
21
21
|
},
|
22
22
|
spin_4: {
|
23
|
-
|
23
|
+
interval: 10,
|
24
24
|
frames: %w{╫ ╪'}
|
25
25
|
},
|
26
26
|
pulse: {
|
@@ -37,7 +37,47 @@ module TTY
|
|
37
37
|
},
|
38
38
|
dots: {
|
39
39
|
interval: 10,
|
40
|
-
frames:
|
40
|
+
frames: %w{⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏}
|
41
|
+
},
|
42
|
+
dots_2: {
|
43
|
+
interval: 10,
|
44
|
+
frames: %w{⣾ ⣽ ⣻ ⢿ ⡿ ⣟ ⣯ ⣷}
|
45
|
+
},
|
46
|
+
dots_3: {
|
47
|
+
interval: 10,
|
48
|
+
frames: %w{⠋ ⠙ ⠚ ⠞ ⠖ ⠦ ⠴ ⠲ ⠳ ⠓}
|
49
|
+
},
|
50
|
+
dots_4: {
|
51
|
+
interval: 10,
|
52
|
+
frames: %w{⠄ ⠆ ⠇ ⠋ ⠙ ⠸ ⠰ ⠠ ⠰ ⠸ ⠙ ⠋ ⠇ ⠆}
|
53
|
+
},
|
54
|
+
dots_5: {
|
55
|
+
interval: 10,
|
56
|
+
frames: %w{⠋ ⠙ ⠚ ⠒ ⠂ ⠂ ⠒ ⠲ ⠴ ⠦ ⠖ ⠒ ⠐ ⠐ ⠒ ⠓ ⠋}
|
57
|
+
},
|
58
|
+
dots_6: {
|
59
|
+
interval: 10,
|
60
|
+
frames: %w{⠁ ⠉ ⠙ ⠚ ⠒ ⠂ ⠂ ⠒ ⠲ ⠴ ⠤ ⠄ ⠄ ⠤ ⠴ ⠲ ⠒ ⠂ ⠂ ⠒ ⠚ ⠙ ⠉ ⠁}
|
61
|
+
},
|
62
|
+
dots_7: {
|
63
|
+
interval: 10,
|
64
|
+
frames: %w{⠈ ⠉ ⠋ ⠓ ⠒ ⠐ ⠐ ⠒ ⠖ ⠦ ⠤ ⠠ ⠠ ⠤ ⠦ ⠖ ⠒ ⠐ ⠐ ⠒ ⠓ ⠋ ⠉ ⠈}
|
65
|
+
},
|
66
|
+
dots_8: {
|
67
|
+
interval: 10,
|
68
|
+
frames: %w{⠁ ⠁ ⠉ ⠙ ⠚ ⠒ ⠂ ⠂ ⠒ ⠲ ⠴ ⠤ ⠄ ⠄ ⠤ ⠠ ⠠ ⠤ ⠦ ⠖ ⠒ ⠐ ⠐ ⠒ ⠓ ⠋ ⠉ ⠈ ⠈}
|
69
|
+
},
|
70
|
+
dots_9: {
|
71
|
+
interval: 10,
|
72
|
+
frames: %w{⢹ ⢺ ⢼ ⣸ ⣇ ⡧ ⡗ ⡏}
|
73
|
+
},
|
74
|
+
dots_10: {
|
75
|
+
interval: 10,
|
76
|
+
frames: %w{⢄ ⢂ ⢁ ⡁ ⡈ ⡐ ⡠}
|
77
|
+
},
|
78
|
+
dots_11: {
|
79
|
+
interval: 10,
|
80
|
+
frames: %w{⠁ ⠂ ⠄ ⡀ ⢀ ⠠ ⠐ ⠈}
|
41
81
|
},
|
42
82
|
arrow: {
|
43
83
|
interval: 10,
|
@@ -94,6 +134,10 @@ module TTY
|
|
94
134
|
"(● )"
|
95
135
|
]
|
96
136
|
},
|
137
|
+
bounce: {
|
138
|
+
interval: 10,
|
139
|
+
frames: %w{ ⠁ ⠂ ⠄ ⠂ }
|
140
|
+
},
|
97
141
|
box_bounce: {
|
98
142
|
interval: 10,
|
99
143
|
frames: %w{ ▌ ▀ ▐ ▄ }
|
@@ -121,6 +165,80 @@ module TTY
|
|
121
165
|
flip: {
|
122
166
|
interval: 10,
|
123
167
|
frames: '-◡⊙-◠'.freeze
|
168
|
+
},
|
169
|
+
burger: {
|
170
|
+
interval: 6,
|
171
|
+
frames: %w{ ☱ ☲ ☴ }
|
172
|
+
},
|
173
|
+
dance: {
|
174
|
+
interval: 10,
|
175
|
+
frames: [">))'>", " >))'>", " >))'>", " >))'>", " >))'>", " <'((<", " <'((<", " <'((<"]
|
176
|
+
},
|
177
|
+
shark: {
|
178
|
+
interval: 10,
|
179
|
+
frames: [
|
180
|
+
"▐|\\____________▌",
|
181
|
+
"▐_|\\___________▌",
|
182
|
+
"▐__|\\__________▌",
|
183
|
+
"▐___|\\_________▌",
|
184
|
+
"▐____|\\________▌",
|
185
|
+
"▐_____|\\_______▌",
|
186
|
+
"▐______|\\______▌",
|
187
|
+
"▐_______|\\_____▌",
|
188
|
+
"▐________|\\____▌",
|
189
|
+
"▐_________|\\___▌",
|
190
|
+
"▐__________|\\__▌",
|
191
|
+
"▐___________|\\_▌",
|
192
|
+
"▐____________|\\▌",
|
193
|
+
"▐____________/|▌",
|
194
|
+
"▐___________/|_▌",
|
195
|
+
"▐__________/|__▌",
|
196
|
+
"▐_________/|___▌",
|
197
|
+
"▐________/|____▌",
|
198
|
+
"▐_______/|_____▌",
|
199
|
+
"▐______/|______▌",
|
200
|
+
"▐_____/|_______▌",
|
201
|
+
"▐____/|________▌",
|
202
|
+
"▐___/|_________▌",
|
203
|
+
"▐__/|__________▌",
|
204
|
+
"▐_/|___________▌",
|
205
|
+
"▐/|____________▌"
|
206
|
+
]
|
207
|
+
},
|
208
|
+
pong: {
|
209
|
+
interval: 10,
|
210
|
+
frames: [
|
211
|
+
"▐⠂ ▌",
|
212
|
+
"▐⠈ ▌",
|
213
|
+
"▐ ⠂ ▌",
|
214
|
+
"▐ ⠠ ▌",
|
215
|
+
"▐ ⡀ ▌",
|
216
|
+
"▐ ⠠ ▌",
|
217
|
+
"▐ ⠂ ▌",
|
218
|
+
"▐ ⠈ ▌",
|
219
|
+
"▐ ⠂ ▌",
|
220
|
+
"▐ ⠠ ▌",
|
221
|
+
"▐ ⡀ ▌",
|
222
|
+
"▐ ⠠ ▌",
|
223
|
+
"▐ ⠂ ▌",
|
224
|
+
"▐ ⠈ ▌",
|
225
|
+
"▐ ⠂▌",
|
226
|
+
"▐ ⠠▌",
|
227
|
+
"▐ ⡀▌",
|
228
|
+
"▐ ⠠ ▌",
|
229
|
+
"▐ ⠂ ▌",
|
230
|
+
"▐ ⠈ ▌",
|
231
|
+
"▐ ⠂ ▌",
|
232
|
+
"▐ ⠠ ▌",
|
233
|
+
"▐ ⡀ ▌",
|
234
|
+
"▐ ⠠ ▌",
|
235
|
+
"▐ ⠂ ▌",
|
236
|
+
"▐ ⠈ ▌",
|
237
|
+
"▐ ⠂ ▌",
|
238
|
+
"▐ ⠠ ▌",
|
239
|
+
"▐ ⡀ ▌",
|
240
|
+
"▐⠠ ▌"
|
241
|
+
]
|
124
242
|
}
|
125
243
|
}
|
126
244
|
end # Formats
|
data/lib/tty/spinner/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tty-spinner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Murach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-cursor
|
@@ -45,33 +45,33 @@ dependencies:
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '2.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: rspec
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '3.1'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - "
|
58
|
+
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '3.1'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - "
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- - "
|
72
|
+
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '0'
|
75
75
|
description: A terminal spinner for tasks that have non-deterministic time frame.
|
76
76
|
email:
|
77
77
|
- pmurach@gmail.com
|
@@ -111,4 +111,3 @@ signing_key:
|
|
111
111
|
specification_version: 4
|
112
112
|
summary: A terminal spinner for tasks that have non-deterministic time frame.
|
113
113
|
test_files: []
|
114
|
-
has_rdoc:
|