console 1.18.0 → 1.20.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5e54a0a87d6c2ad440476163691fcc67016d8cdabd95f218f0e55db0a311ffd
4
- data.tar.gz: a1cc36ed4d66731525458abebac6ba9081e68c17524bc32a0125291684b8107b
3
+ metadata.gz: d974c867b670b89c2b04c83f640f46217e9836e3eec7f92903bc062e6c59458c
4
+ data.tar.gz: 4bc1d803689cad17d85a36d7da8c172a63ea869e6fa060f9c85702c1da365b90
5
5
  SHA512:
6
- metadata.gz: 864fb845fbdb448f16a7c6b43d024ab5581ad42eb3187efcba046f9feff43f59bdb0164e5fb94fac34bd1387d26742d32395827d9e5d30a158ea8dbc8cd47391
7
- data.tar.gz: 6af247ea1c0c9df853dfae8de8c651ed487e4ae010d46975586e23a6fc1925cd7a20d27545495cba3e14ea0e8246fc87f88c51acbd226cd10d7ce092338c0efe
6
+ metadata.gz: 1db5693110b3a7f48b17abdf58eb74ac5269f4748d0746df057c7dbe01ddee228db5bcc74bd581c1e9bddf94602943682feb4cf50c7b14312d23db47e5209206
7
+ data.tar.gz: 3209fa49d39e7de2040610187599b7b22e41af0da3c2749b7a7c939ce40d07c2101472fec9a47a20de754d216f780ab59f508a3b4ddc17dd5c251d4a94e215f3
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2023, by Samuel Williams.
5
+
6
+ module Console
7
+ module Adapter
8
+ end
9
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2022, by Samuel Williams.
4
+ # Copyright, 2019-2023, by Samuel Williams.
5
5
  # Copyright, 2019, by Bryan Powell.
6
6
  # Copyright, 2020, by Michael Adams.
7
7
  # Copyright, 2021, by Robert Schulze.
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2023, by Samuel Williams.
5
+
6
+ module Console
7
+ module Output
8
+ class Encoder
9
+ def initialize(output, encoding = ::Encoding::UTF_8)
10
+ @output = output
11
+ @encoding = encoding
12
+ end
13
+
14
+ attr :output
15
+
16
+ attr :encoding
17
+
18
+ def call(subject = nil, *arguments, **options, &block)
19
+ subject = encode(subject)
20
+ arguments = encode(arguments)
21
+ options = encode(options)
22
+
23
+ @output.call(subject, *arguments, **options, &block)
24
+ end
25
+
26
+ def encode(value)
27
+ case value
28
+ when String
29
+ value.encode(@encoding, invalid: :replace, undef: :replace)
30
+ when Array
31
+ value.map{|item| encode(item)}
32
+ when Hash
33
+ value.transform_values{|item| encode(item)}
34
+ else
35
+ value
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -4,12 +4,16 @@
4
4
  # Copyright, 2021-2022, by Samuel Williams.
5
5
 
6
6
  require_relative '../serialized/logger'
7
+ require_relative 'encoder'
7
8
 
8
9
  module Console
9
10
  module Output
10
11
  module JSON
11
12
  def self.new(output, **options)
12
- Serialized::Logger.new(output, format: ::JSON, **options)
13
+ # The output encoder can prevent encoding issues (e.g. invalid UTF-8):
14
+ Output::Encoder.new(
15
+ Serialized::Logger.new(output, format: ::JSON, **options)
16
+ )
13
17
  end
14
18
  end
15
19
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2022, by Samuel Williams.
4
+ # Copyright, 2022-2023, by Samuel Williams.
5
5
 
6
6
  module Console
7
7
  module Output
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  require_relative 'output/default'
7
7
  require_relative 'output/json'
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2022, by Samuel Williams.
4
+ # Copyright, 2020-2023, by Samuel Williams.
5
+ # Copyright, 2022, by Anton Sozontov.
5
6
 
6
7
  require_relative 'event/progress'
7
8
  require_relative 'clock'
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2022, by Samuel Williams.
4
+ # Copyright, 2019-2023, by Samuel Williams.
5
5
 
6
6
  require_relative '../buffer'
7
7
  require_relative '../filter'
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2022, by Samuel Williams.
4
+ # Copyright, 2019-2023, by Samuel Williams.
5
5
  # Copyright, 2021, by Robert Schulze.
6
6
 
7
7
  require_relative '../buffer'
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2022, by Samuel Williams.
4
+ # Copyright, 2019-2023, by Samuel Williams.
5
5
 
6
6
  require 'io/console'
7
7
 
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2022, by Samuel Williams.
4
+ # Copyright, 2019-2023, by Samuel Williams.
5
5
 
6
6
  module Console
7
- VERSION = "1.18.0"
7
+ VERSION = "1.20.0"
8
8
  end
data/license.md CHANGED
@@ -1,12 +1,15 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2019-2022, by Samuel Williams.
3
+ Copyright, 2019-2023, by Samuel Williams.
4
4
  Copyright, 2019-2021, by Bryan Powell.
5
5
  Copyright, 2019, by Cyril Roelandt.
6
6
  Copyright, 2020, by Olle Jonsson.
7
7
  Copyright, 2020, by Michael Adams.
8
8
  Copyright, 2021, by Cédric Boutillier.
9
9
  Copyright, 2021, by Robert Schulze.
10
+ Copyright, 2022, by Anton Sozontov.
11
+ Copyright, 2022, by William T. Nelson.
12
+ Copyright, 2023, by Felix Yan.
10
13
 
11
14
  Permission is hereby granted, free of charge, to any person obtaining a copy
12
15
  of this software and associated documentation files (the "Software"), to deal
data/readme.md CHANGED
@@ -6,7 +6,7 @@ Provides beautiful console logging for Ruby applications. Implements fast, buffe
6
6
 
7
7
  ## Motivation
8
8
 
9
- When Ruby decided to reverse the order of exception backtraces, I finally gave up using the built in logging and decided restore sanity to the output of my programs once and for all!
9
+ When Ruby decided to reverse the order of exception backtraces, I finally gave up using the built in logging and decided restore sanity to the output of my programs once and for all\!
10
10
 
11
11
  ## Features
12
12
 
@@ -29,3 +29,11 @@ We welcome contributions to this project.
29
29
  3. Commit your changes (`git commit -am 'Add some feature'`).
30
30
  4. Push to the branch (`git push origin my-new-feature`).
31
31
  5. Create new Pull Request.
32
+
33
+ ### Developer Certificate of Origin
34
+
35
+ This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
36
+
37
+ ### Contributor Covenant
38
+
39
+ This project is governed by [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,16 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: console
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.0
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  - Robert Schulze
9
9
  - Bryan Powell
10
10
  - Michael Adams
11
+ - Anton Sozontov
11
12
  - Cyril Roelandt
12
13
  - Cédric Boutillier
14
+ - Felix Yan
13
15
  - Olle Jonsson
16
+ - William T. Nelson
14
17
  autorequire:
15
18
  bindir: bin
16
19
  cert_chain:
@@ -43,22 +46,8 @@ cert_chain:
43
46
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
44
47
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
45
48
  -----END CERTIFICATE-----
46
- date: 2023-07-21 00:00:00.000000000 Z
49
+ date: 2023-08-03 00:00:00.000000000 Z
47
50
  dependencies:
48
- - !ruby/object:Gem::Dependency
49
- name: fiber-local
50
- requirement: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- type: :runtime
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
51
  - !ruby/object:Gem::Dependency
63
52
  name: fiber-annotation
64
53
  requirement: !ruby/object:Gem::Requirement
@@ -74,89 +63,19 @@ dependencies:
74
63
  - !ruby/object:Gem::Version
75
64
  version: '0'
76
65
  - !ruby/object:Gem::Dependency
77
- name: bake
78
- requirement: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- type: :development
84
- prerelease: false
85
- version_requirements: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- - !ruby/object:Gem::Dependency
91
- name: bake-test
92
- requirement: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- type: :development
98
- prerelease: false
99
- version_requirements: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- - !ruby/object:Gem::Dependency
105
- name: bake-test-external
106
- requirement: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- type: :development
112
- prerelease: false
113
- version_requirements: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- - !ruby/object:Gem::Dependency
119
- name: bundler
66
+ name: fiber-local
120
67
  requirement: !ruby/object:Gem::Requirement
121
68
  requirements:
122
69
  - - ">="
123
70
  - !ruby/object:Gem::Version
124
71
  version: '0'
125
- type: :development
72
+ type: :runtime
126
73
  prerelease: false
127
74
  version_requirements: !ruby/object:Gem::Requirement
128
75
  requirements:
129
76
  - - ">="
130
77
  - !ruby/object:Gem::Version
131
78
  version: '0'
132
- - !ruby/object:Gem::Dependency
133
- name: covered
134
- requirement: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: 0.18.1
139
- type: :development
140
- prerelease: false
141
- version_requirements: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: 0.18.1
146
- - !ruby/object:Gem::Dependency
147
- name: sus
148
- requirement: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '0.14'
153
- type: :development
154
- prerelease: false
155
- version_requirements: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: '0.14'
160
79
  description:
161
80
  email:
162
81
  executables: []
@@ -165,6 +84,7 @@ extra_rdoc_files: []
165
84
  files:
166
85
  - bake/console.rb
167
86
  - lib/console.rb
87
+ - lib/console/adapter.rb
168
88
  - lib/console/buffer.rb
169
89
  - lib/console/capture.rb
170
90
  - lib/console/clock.rb
@@ -178,6 +98,7 @@ files:
178
98
  - lib/console/logger.rb
179
99
  - lib/console/output.rb
180
100
  - lib/console/output/default.rb
101
+ - lib/console/output/encoder.rb
181
102
  - lib/console/output/json.rb
182
103
  - lib/console/output/null.rb
183
104
  - lib/console/output/sensitive.rb
@@ -207,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
207
128
  requirements:
208
129
  - - ">="
209
130
  - !ruby/object:Gem::Version
210
- version: 2.7.3
131
+ version: '3.0'
211
132
  required_rubygems_version: !ruby/object:Gem::Requirement
212
133
  requirements:
213
134
  - - ">="
metadata.gz.sig CHANGED
Binary file