loog 0.5.2 → 0.5.3

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: ebcf49ea46676a82c2a2c7c7e3594388b6061e16abf6e04930272f54cd283734
4
- data.tar.gz: 986657c7af1b899508956c92354a2bc70106c0f95256a2aa85ef114131753894
3
+ metadata.gz: 9c5b47cdc5645f17254a2e7aaae37b614bfb72d4da2214956727223dae990a25
4
+ data.tar.gz: 0f0d4140f159bc4b319221dd91ab842769890166d52e2c4485c7c6179f343bea
5
5
  SHA512:
6
- metadata.gz: 258a06ad6fd0905ccab372bb0333fbafe67383f336407da5140b184adfdcc96db187533d6bdd4bbb954c737057ab62a24615b2a757fe17caf99777501648193c
7
- data.tar.gz: ce25286f572ba1be51863fd9503ea8f56cc7bb801c6e9033f6e0a6b741e9dd8a595f4538fd4b342819338b103d1aaa0f6f750184e503594bcef62998cf18b4b4
6
+ metadata.gz: 581adf7dae6b421179d02146ab5b4b966689d306c5a35ea31811e3e4feb912bb138e8c1e6424474ad081d308bd08acb443b064e8f0e940d8a1ecac8c82d85c62
7
+ data.tar.gz: 9646ce3a439a25f9fe83fd0ac0e3825806643c16f918927eef4b100a67e0d9a7257b4609d50261c3ca90fb8e943ca7ac9d428a4038c04aa2832faf972dd69602
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 2018-2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ name: actionlint
22
+ 'on':
23
+ push:
24
+ branches:
25
+ - master
26
+ pull_request:
27
+ branches:
28
+ - master
29
+ jobs:
30
+ actionlint:
31
+ runs-on: ubuntu-22.04
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - name: Download actionlint
35
+ id: get_actionlint
36
+ # yamllint disable-line rule:line-length
37
+ run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
38
+ shell: bash
39
+ - name: Check workflow files
40
+ run: ${{ steps.get_actionlint.outputs.executable }} -color
41
+ shell: bash
@@ -30,10 +30,9 @@ jobs:
30
30
  - uses: actions/checkout@v4
31
31
  - uses: actions/setup-ruby@v1
32
32
  with:
33
- ruby-version: 2.7
33
+ ruby-version: 3.2
34
34
  - run: bundle update
35
35
  - run: bundle exec rake
36
36
  - uses: codecov/codecov-action@v4.0.0-beta.3
37
37
  with:
38
- file: coverage/.resultset.json
39
- fail_ci_if_error: true
38
+ token: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,30 @@
1
+ # Copyright (c) 2018-2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ name: copyrights
22
+ 'on':
23
+ push:
24
+ pull_request:
25
+ jobs:
26
+ copyrights:
27
+ runs-on: ubuntu-22.04
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ - uses: yegor256/copyrights-action@0.0.5
@@ -0,0 +1,38 @@
1
+ # Copyright (c) 2018-2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ name: markdown-lint
22
+ 'on':
23
+ push:
24
+ branches:
25
+ - master
26
+ pull_request:
27
+ branches:
28
+ - master
29
+ paths-ignore: ['paper/**', 'sandbox/**']
30
+ concurrency:
31
+ group: markdown-lint-${{ github.ref }}
32
+ cancel-in-progress: true
33
+ jobs:
34
+ markdown-lint:
35
+ runs-on: ubuntu-22.04
36
+ steps:
37
+ - uses: actions/checkout@v4
38
+ - uses: articulate/actions-markdownlint@v1
@@ -31,8 +31,8 @@ jobs:
31
31
  name: test
32
32
  strategy:
33
33
  matrix:
34
- os: [ubuntu-20.04]
35
- ruby: [2.7, 3.0]
34
+ os: [ubuntu-22.04]
35
+ ruby: [3.2]
36
36
  runs-on: ${{ matrix.os }}
37
37
  steps:
38
38
  - uses: actions/checkout@v4
data/Gemfile CHANGED
@@ -23,9 +23,9 @@
23
23
  source 'https://rubygems.org'
24
24
  gemspec
25
25
 
26
- gem 'minitest', '5.24.0', require: false
26
+ gem 'minitest', '5.24.1', require: false
27
27
  gem 'rake', '13.2.1', require: false
28
28
  gem 'rdoc', '6.7.0', require: false
29
- gem 'rubocop', '1.64.1', require: false
30
- gem 'rubocop-rspec', '3.0.1', require: false
29
+ gem 'rubocop', '1.65.1', require: false
30
+ gem 'rubocop-rspec', '3.0.3', require: false
31
31
  gem 'simplecov', '0.22.0', require: false
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2019 Yegor Bugayenko
3
+ Copyright (c) 2018-2024 Yegor Bugayenko
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the 'Software'), to deal
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <img src="/logo.svg" width="64px" height="64px"/>
1
+ # Object-Oriented Logger for Ruby
2
2
 
3
3
  [![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
4
4
  [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/loog)](http://www.rultor.com/p/yegor256/loog)
@@ -17,7 +17,7 @@ Loog is an object-oriented logging wrapper around Ruby
17
17
  First, install it:
18
18
 
19
19
  ```bash
20
- $ gem install loog
20
+ gem install loog
21
21
  ```
22
22
 
23
23
  Then, use it like this:
@@ -31,21 +31,22 @@ The gem is basically a provider of a few pre-configured loggers, which
31
31
  you can use for production (`Loog::REGULAR`) or for testing (`Loog::VERBOSE`).
32
32
  You can also shut it up with `Loog::NULL`.
33
33
 
34
- There is also `Loog::Buffer` class that you can use for testing.
34
+ There is also `Loog::Buffer` class that you can use for testing.
35
35
  It accumulates all log calls and then returns the entire output
36
36
  through the `to_s()` method.
37
37
 
38
38
  ## How to contribute
39
39
 
40
- Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
40
+ Read
41
+ [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
41
42
  Make sure you build is green before you contribute
42
- your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
43
+ your pull request. You will need to have
44
+ [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
43
45
  [Bundler](https://bundler.io/) installed. Then:
44
46
 
45
- ```
46
- $ bundle update
47
- $ bundle exec rake
47
+ ```bash
48
+ bundle update
49
+ bundle exec rake
48
50
  ```
49
51
 
50
52
  If it's clean and you don't see any error messages, submit your pull request.
51
-
data/lib/loog.rb CHANGED
@@ -23,6 +23,7 @@
23
23
  # SOFTWARE.
24
24
 
25
25
  require 'logger'
26
+ require 'time'
26
27
 
27
28
  # Loog is an object-oriented wrapper around Ruby Logger:
28
29
  #
@@ -105,7 +106,7 @@ module Loog
105
106
  end
106
107
 
107
108
  def to_s
108
- @lines.join
109
+ @lines.map { |s| s.dup.force_encoding('UTF-8') }.join
109
110
  end
110
111
  end
111
112
  end
data/loog.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
28
28
  s.required_ruby_version = '>=2.3'
29
29
  s.name = 'loog'
30
- s.version = '0.5.2'
30
+ s.version = '0.5.3'
31
31
  s.license = 'MIT'
32
32
  s.summary = 'Object-oriented logging wrapper'
33
33
  s.description = 'Object-oriented wrapper for Ruby default logging facility'
data/test/test__helper.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019 Yegor Bugayenko
3
+ # (The MIT License)
4
+ #
5
+ # Copyright (c) 2018-2024 Yegor Bugayenko
4
6
  #
5
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
8
  # of this software and associated documentation files (the 'Software'), to deal
@@ -14,7 +16,7 @@
14
16
  #
15
17
  # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
18
  # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
20
  # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
21
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
22
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
data/test/test_loog.rb CHANGED
@@ -56,4 +56,13 @@ class LoogTest < Minitest::Test
56
56
  b.error('+')
57
57
  assert_equal("Hey, друг!\nBye!\n+\n", b.to_s)
58
58
  end
59
+
60
+ def test_buffer_non_utf
61
+ b = Loog::Buffer.new
62
+ msg = [0x41, 0x42, 0xC0].pack('c*')
63
+ b.debug('привет')
64
+ b.debug(msg)
65
+ stdout = b.to_s
66
+ assert(stdout.include?('AB'), stdout)
67
+ end
59
68
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-27 00:00:00.000000000 Z
11
+ date: 2024-08-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Object-oriented wrapper for Ruby default logging facility
14
14
  email: yegor256@gmail.com
@@ -19,7 +19,10 @@ extra_rdoc_files:
19
19
  files:
20
20
  - ".0pdd.yml"
21
21
  - ".gitattributes"
22
+ - ".github/workflows/actionlint.yml"
22
23
  - ".github/workflows/codecov.yml"
24
+ - ".github/workflows/copyrights.yml"
25
+ - ".github/workflows/markdown-lint.yml"
23
26
  - ".github/workflows/pdd.yml"
24
27
  - ".github/workflows/rake.yml"
25
28
  - ".github/workflows/xcop.yml"