console 1.24.0 → 1.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/console/adapter.rb +2 -1
- data/lib/console/capture.rb +6 -2
- data/lib/console/compatible/logger.rb +2 -1
- data/lib/console/event/failure.rb +39 -48
- data/lib/console/event/generic.rb +9 -6
- data/lib/console/event/spawn.rb +29 -26
- data/lib/console/event.rb +1 -2
- data/lib/console/filter.rb +2 -4
- data/lib/console/format.rb +1 -5
- data/lib/console/logger.rb +19 -9
- data/lib/console/output/default.rb +5 -5
- data/lib/console/output/null.rb +1 -1
- data/lib/console/output/sensitive.rb +11 -9
- data/lib/console/{serialized/logger.rb → output/serialized.rb} +7 -47
- data/lib/console/output/split.rb +3 -3
- data/lib/console/{terminal/logger.rb → output/terminal.rb} +79 -47
- data/lib/console/output/wrapper.rb +22 -0
- data/lib/console/output.rb +3 -4
- data/lib/console/progress.rb +18 -8
- data/lib/console/terminal/formatter/failure.rb +57 -0
- data/lib/console/terminal/formatter/progress.rb +58 -0
- data/lib/console/terminal/formatter/spawn.rb +42 -0
- data/lib/console/terminal/text.rb +5 -1
- data/lib/console/terminal/xterm.rb +8 -1
- data/lib/console/terminal.rb +19 -2
- data/lib/console/version.rb +2 -2
- data/lib/console.rb +1 -9
- data.tar.gz.sig +0 -0
- metadata +16 -17
- metadata.gz.sig +0 -0
- data/lib/console/buffer.rb +0 -25
- data/lib/console/event/progress.rb +0 -60
- data/lib/console/output/json.rb +0 -16
- data/lib/console/output/text.rb +0 -16
- data/lib/console/output/xterm.rb +0 -16
- data/lib/console/split.rb +0 -10
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Released under the MIT License.
|
4
|
-
# Copyright, 2020-2022, by Samuel Williams.
|
5
|
-
|
6
|
-
require_relative 'generic'
|
7
|
-
|
8
|
-
module Console
|
9
|
-
module Event
|
10
|
-
class Progress < Generic
|
11
|
-
BLOCK = [
|
12
|
-
" ",
|
13
|
-
"▏",
|
14
|
-
"▎",
|
15
|
-
"▍",
|
16
|
-
"▌",
|
17
|
-
"▋",
|
18
|
-
"▊",
|
19
|
-
"▉",
|
20
|
-
"█",
|
21
|
-
]
|
22
|
-
|
23
|
-
def initialize(current, total)
|
24
|
-
@current = current
|
25
|
-
@total = total
|
26
|
-
end
|
27
|
-
|
28
|
-
attr :current
|
29
|
-
attr :total
|
30
|
-
|
31
|
-
def value
|
32
|
-
@current.to_f / @total.to_f
|
33
|
-
end
|
34
|
-
|
35
|
-
def bar(value = self.value, width = 70)
|
36
|
-
blocks = width * value
|
37
|
-
full_blocks = blocks.floor
|
38
|
-
partial_block = ((blocks - full_blocks) * BLOCK.size).floor
|
39
|
-
|
40
|
-
if partial_block.zero?
|
41
|
-
BLOCK.last * full_blocks
|
42
|
-
else
|
43
|
-
"#{BLOCK.last * full_blocks}#{BLOCK[partial_block]}"
|
44
|
-
end.ljust(width)
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.register(terminal)
|
48
|
-
terminal[:progress_bar] ||= terminal.style(:blue, :white)
|
49
|
-
end
|
50
|
-
|
51
|
-
def to_h
|
52
|
-
{current: @current, total: @total}
|
53
|
-
end
|
54
|
-
|
55
|
-
def format(output, terminal, verbose)
|
56
|
-
output.puts "#{terminal[:progress_bar]}#{self.bar}#{terminal.reset} #{sprintf('%6.2f', self.value * 100)}%"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
data/lib/console/output/json.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Released under the MIT License.
|
4
|
-
# Copyright, 2021-2023, by Samuel Williams.
|
5
|
-
|
6
|
-
require_relative '../serialized/logger'
|
7
|
-
|
8
|
-
module Console
|
9
|
-
module Output
|
10
|
-
module JSON
|
11
|
-
def self.new(output, **options)
|
12
|
-
Serialized::Logger.new(output, format: Format.default_json, **options)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/lib/console/output/text.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Released under the MIT License.
|
4
|
-
# Copyright, 2021-2022, by Samuel Williams.
|
5
|
-
|
6
|
-
require_relative '../terminal/logger'
|
7
|
-
|
8
|
-
module Console
|
9
|
-
module Output
|
10
|
-
module Text
|
11
|
-
def self.new(output, **options)
|
12
|
-
Terminal::Logger.new(output, format: Terminal::Text, **options)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/lib/console/output/xterm.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Released under the MIT License.
|
4
|
-
# Copyright, 2021-2022, by Samuel Williams.
|
5
|
-
|
6
|
-
require_relative '../terminal/logger'
|
7
|
-
|
8
|
-
module Console
|
9
|
-
module Output
|
10
|
-
module XTerm
|
11
|
-
def self.new(output, **options)
|
12
|
-
Terminal::Logger.new(output, format: Terminal::XTerm, **options)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|