console 1.15.3 → 1.16.2
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/bake/console.rb +3 -0
- data/lib/console/buffer.rb +2 -19
- data/lib/console/capture.rb +13 -19
- data/lib/console/clock.rb +6 -23
- data/lib/console/compatible/logger.rb +2 -19
- data/lib/console/event/failure.rb +3 -20
- data/lib/console/event/generic.rb +2 -19
- data/lib/console/event/progress.rb +2 -19
- data/lib/console/event/spawn.rb +2 -19
- data/lib/console/event.rb +2 -20
- data/lib/console/filter.rb +10 -24
- data/lib/console/logger.rb +6 -31
- data/lib/console/output/default.rb +2 -19
- data/lib/console/output/json.rb +2 -19
- data/lib/console/output/sensitive.rb +2 -19
- data/lib/console/output/split.rb +28 -0
- data/lib/console/output/text.rb +2 -19
- data/lib/console/output/xterm.rb +2 -19
- data/lib/console/output.rb +2 -19
- data/lib/console/progress.rb +8 -25
- data/lib/console/resolver.rb +3 -19
- data/lib/console/serialized/logger.rb +2 -19
- data/lib/console/split.rb +5 -38
- data/lib/console/terminal/logger.rb +3 -19
- data/lib/console/terminal/text.rb +2 -19
- data/lib/console/terminal/xterm.rb +2 -19
- data/lib/console/terminal.rb +2 -19
- data/lib/console/version.rb +3 -20
- data/lib/console.rb +5 -20
- data/license.md +27 -0
- data/readme.md +31 -0
- data.tar.gz.sig +0 -0
- metadata +54 -39
- metadata.gz.sig +0 -0
- data/lib/console/event/measure.rb +0 -44
- data/lib/console/event/metric.rb +0 -60
- data/lib/console/measure.rb +0 -51
data/lib/console/event/metric.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
13
|
-
# all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
# THE SOFTWARE.
|
22
|
-
|
23
|
-
require_relative 'generic'
|
24
|
-
require_relative '../clock'
|
25
|
-
|
26
|
-
module Console
|
27
|
-
module Event
|
28
|
-
class Metric < Generic
|
29
|
-
def self.[](**parameters)
|
30
|
-
parameters.map(&self.method(:new))
|
31
|
-
end
|
32
|
-
|
33
|
-
def initialize(name, value, **tags)
|
34
|
-
@name = name
|
35
|
-
@value = value
|
36
|
-
@tags = tags
|
37
|
-
end
|
38
|
-
|
39
|
-
attr :name
|
40
|
-
attr :value
|
41
|
-
attr :tags
|
42
|
-
|
43
|
-
def to_h
|
44
|
-
{name: @name, value: @value, tags: @tags}
|
45
|
-
end
|
46
|
-
|
47
|
-
def value_string
|
48
|
-
"#{@name}: #{@value}"
|
49
|
-
end
|
50
|
-
|
51
|
-
def format(output, terminal, verbose)
|
52
|
-
if @tags&.any?
|
53
|
-
output.puts "#{value_string} #{@tags.inspect}"
|
54
|
-
else
|
55
|
-
output.puts value_string
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
data/lib/console/measure.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
13
|
-
# all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
# THE SOFTWARE.
|
22
|
-
|
23
|
-
require_relative 'event/measure'
|
24
|
-
require_relative 'clock'
|
25
|
-
|
26
|
-
module Console
|
27
|
-
class Measure
|
28
|
-
def initialize(output, subject, **tags)
|
29
|
-
@output = output
|
30
|
-
@subject = subject
|
31
|
-
@tags = tags
|
32
|
-
end
|
33
|
-
|
34
|
-
attr :tags
|
35
|
-
|
36
|
-
# Measure the execution of a block of code.
|
37
|
-
def duration(name, &block)
|
38
|
-
@output.info(@subject) {Event::Enter.new(name)}
|
39
|
-
|
40
|
-
start_time = Clock.now
|
41
|
-
|
42
|
-
result = yield(self)
|
43
|
-
|
44
|
-
duration = Clock.now - start_time
|
45
|
-
|
46
|
-
@output.info(@subject) {Event::Exit.new(name, duration, **@tags)}
|
47
|
-
|
48
|
-
return result
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|