zold-score 0.5.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40c626e1e9548df5b68c7a7ef8838c17da7d1922c9e84001da16ef44f68b92bd
4
- data.tar.gz: 43bee09ba07edb706dd36b6b68cc54771dd42f623ecd6eaa25a5bbf30595c1e8
3
+ metadata.gz: dac51b7d65ae8e4850d4fa7377b165f0cc74b1754e07165b1999bbadc6d2c4a5
4
+ data.tar.gz: 2fbf8f49a88f0eec7e91f9bc383eb9d9a4c4e3c184ec3247e8e0860ed78800b2
5
5
  SHA512:
6
- metadata.gz: f306461a07c4bf6f5b6bb5933d3f424e440db4f1629d95ec0cf68620c8848672dcee5c50d38473cdc5244254536da0d1c64ee57c6eed188564c48cd84aec3515
7
- data.tar.gz: 64fc40a4c7e241fe3f5724311098a52bc8e2acec28482efd1b4aac5ee53e581f987d4edc83013927d20ad88e2e7b33e54b087ab01f7c3cf42dc49c6b80b4096d
6
+ metadata.gz: d7419912f9df6476e4c0322449bc32051e8613e5b012941f183f5011c498258f6e634df781ae145e560afbddd9315a9edda5741b84efaa31075c02a70a2d514f
7
+ data.tar.gz: f34c9b86ee7880218632513984815a678db68229313b3dc45ffd9866ffb3222641a1fd4836bd30cd6dd94da0497acb793a248cdfd901e931ea4745e4b782beb7
data/.0pdd.yml CHANGED
@@ -1,3 +1,6 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
2
+ # SPDX-License-Identifier: MIT
3
+ ---
1
4
  errors:
2
5
  - yegor256@gmail.com
3
6
  # alerts:
@@ -0,0 +1,25 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
2
+ # SPDX-License-Identifier: MIT
3
+ ---
4
+ # yamllint disable rule:line-length
5
+ name: actionlint
6
+ 'on':
7
+ push:
8
+ branches:
9
+ - master
10
+ pull_request:
11
+ branches:
12
+ - master
13
+ jobs:
14
+ actionlint:
15
+ timeout-minutes: 15
16
+ runs-on: ubuntu-24.04
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - name: Download actionlint
20
+ id: get_actionlint
21
+ run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
22
+ shell: bash
23
+ - name: Check workflow files
24
+ run: ${{ steps.get_actionlint.outputs.executable }} -color
25
+ shell: bash
@@ -1,20 +1,27 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
2
+ # SPDX-License-Identifier: MIT
1
3
  ---
4
+ # yamllint disable rule:line-length
2
5
  name: codecov
3
- on:
6
+ 'on':
4
7
  push:
5
8
  branches:
6
9
  - master
7
10
  jobs:
8
11
  codecov:
9
- runs-on: ubuntu-20.04
12
+ timeout-minutes: 15
13
+ runs-on: ubuntu-24.04
10
14
  steps:
11
- - uses: actions/checkout@v3
15
+ - uses: actions/checkout@v4
12
16
  - uses: ruby/setup-ruby@v1
13
17
  with:
14
- ruby-version: 2.7
15
- - run: bundle update
18
+ ruby-version: 3.3
19
+ bundler-cache: true
20
+ - run: bundle config set --global path "$(pwd)/vendor/bundle"
21
+ - run: bundle install --no-color
16
22
  - run: bundle exec rake
17
- - uses: codecov/codecov-action@v3
23
+ - uses: codecov/codecov-action@v5
18
24
  with:
19
- file: coverage/.resultset.json
25
+ token: ${{ secrets.CODECOV_TOKEN }}
26
+ files: coverage/.resultset.json
20
27
  fail_ci_if_error: true
@@ -0,0 +1,19 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
2
+ # SPDX-License-Identifier: MIT
3
+ ---
4
+ # yamllint disable rule:line-length
5
+ name: copyrights
6
+ 'on':
7
+ push:
8
+ branches:
9
+ - master
10
+ pull_request:
11
+ branches:
12
+ - master
13
+ jobs:
14
+ copyrights:
15
+ timeout-minutes: 15
16
+ runs-on: ubuntu-24.04
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: yegor256/copyrights-action@0.0.12
@@ -0,0 +1,19 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
2
+ # SPDX-License-Identifier: MIT
3
+ ---
4
+ # yamllint disable rule:line-length
5
+ name: markdown-lint
6
+ 'on':
7
+ push:
8
+ branches:
9
+ - master
10
+ pull_request:
11
+ branches:
12
+ - master
13
+ jobs:
14
+ markdown-lint:
15
+ timeout-minutes: 15
16
+ runs-on: ubuntu-24.04
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: DavidAnson/markdownlint-cli2-action@v22.0.0
@@ -1,11 +1,19 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
2
+ # SPDX-License-Identifier: MIT
1
3
  ---
4
+ # yamllint disable rule:line-length
2
5
  name: pdd
3
- on:
6
+ 'on':
4
7
  push:
8
+ branches:
9
+ - master
5
10
  pull_request:
11
+ branches:
12
+ - master
6
13
  jobs:
7
14
  pdd:
8
- runs-on: ubuntu-20.04
15
+ timeout-minutes: 15
16
+ runs-on: ubuntu-24.04
9
17
  steps:
10
- - uses: actions/checkout@v3
11
- - uses: g4s8/pdd-action@master
18
+ - uses: actions/checkout@v4
19
+ - uses: volodya-lombrozo/pdd-action@master
@@ -1,6 +1,9 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
2
+ # SPDX-License-Identifier: MIT
1
3
  ---
4
+ # yamllint disable rule:line-length
2
5
  name: rake
3
- on:
6
+ 'on':
4
7
  push:
5
8
  branches:
6
9
  - master
@@ -11,13 +14,15 @@ jobs:
11
14
  test:
12
15
  strategy:
13
16
  matrix:
14
- os: [ubuntu-20.04]
15
- ruby: ['3.0']
17
+ os: [ubuntu-24.04]
18
+ ruby: [3.3]
16
19
  runs-on: ${{ matrix.os }}
17
20
  steps:
18
- - uses: actions/checkout@v3
21
+ - uses: actions/checkout@v4
19
22
  - uses: ruby/setup-ruby@v1
20
23
  with:
21
24
  ruby-version: ${{ matrix.ruby }}
22
- - run: bundle update
25
+ bundler-cache: true
26
+ - run: bundle config set --global path "$(pwd)/vendor/bundle"
27
+ - run: bundle install --no-color
23
28
  - run: bundle exec rake
@@ -0,0 +1,19 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
2
+ # SPDX-License-Identifier: MIT
3
+ ---
4
+ # yamllint disable rule:line-length
5
+ name: reuse
6
+ 'on':
7
+ push:
8
+ branches:
9
+ - master
10
+ pull_request:
11
+ branches:
12
+ - master
13
+ jobs:
14
+ reuse:
15
+ timeout-minutes: 15
16
+ runs-on: ubuntu-24.04
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: fsfe/reuse-action@v5
@@ -0,0 +1,19 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
2
+ # SPDX-License-Identifier: MIT
3
+ ---
4
+ # yamllint disable rule:line-length
5
+ name: typos
6
+ 'on':
7
+ push:
8
+ branches:
9
+ - master
10
+ pull_request:
11
+ branches:
12
+ - master
13
+ jobs:
14
+ typos:
15
+ timeout-minutes: 15
16
+ runs-on: ubuntu-24.04
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: crate-ci/typos@v1.40.0
@@ -1,11 +1,15 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
2
+ # SPDX-License-Identifier: MIT
1
3
  ---
4
+ # yamllint disable rule:line-length
2
5
  name: xcop
3
- on:
6
+ 'on':
4
7
  push:
5
8
  pull_request:
6
9
  jobs:
7
10
  xcop:
8
- runs-on: ubuntu-20.04
11
+ timeout-minutes: 15
12
+ runs-on: ubuntu-24.04
9
13
  steps:
10
- - uses: actions/checkout@v3
14
+ - uses: actions/checkout@v4
11
15
  - uses: g4s8/xcop-action@master
@@ -0,0 +1,19 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
2
+ # SPDX-License-Identifier: MIT
3
+ ---
4
+ # yamllint disable rule:line-length
5
+ name: yamllint
6
+ 'on':
7
+ push:
8
+ branches:
9
+ - master
10
+ pull_request:
11
+ branches:
12
+ - master
13
+ jobs:
14
+ yamllint:
15
+ timeout-minutes: 15
16
+ runs-on: ubuntu-24.04
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: ibiqlik/action-yamllint@v3
data/.gitignore CHANGED
@@ -1,9 +1,14 @@
1
- coverage/
2
- .idea/
3
1
  *.gem
4
2
  .bundle/
3
+ .claude
5
4
  .DS_Store
6
- rdoc/
5
+ .idea/
6
+ .yardoc/
7
+ coverage/
8
+ doc/
7
9
  Gemfile.lock
8
- tmp/
9
10
  lib/score_suffix
11
+ node_modules/
12
+ rdoc/
13
+ tmp/
14
+ vendor/
data/.rubocop.yml CHANGED
@@ -1,7 +1,15 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
2
+ # SPDX-License-Identifier: MIT
3
+ ---
1
4
  AllCops:
2
5
  DisplayCopNames: true
3
6
  TargetRubyVersion: 2.5
4
-
7
+ SuggestExtensions: false
8
+ NewCops: enable
9
+ plugins:
10
+ - rubocop-rake
11
+ - rubocop-minitest
12
+ - rubocop-performance
5
13
  Layout/EmptyLineAfterGuardClause:
6
14
  Enabled: false
7
15
  Layout/EndOfLine:
@@ -16,9 +24,11 @@ Metrics/ClassLength:
16
24
  Max: 180
17
25
  Metrics/ParameterLists:
18
26
  Max: 7
19
- Layout/AlignParameters:
27
+ Layout/ParameterAlignment:
20
28
  Enabled: false
21
29
  Metrics/CyclomaticComplexity:
22
30
  Max: 20
23
31
  Metrics/PerceivedComplexity:
24
32
  Max: 20
33
+ Minitest/EmptyLineBeforeAssertionMethods:
34
+ Enabled: false
data/.rultor.yml CHANGED
@@ -1,14 +1,18 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
2
+ # SPDX-License-Identifier: MIT
3
+ ---
4
+ # yamllint disable rule:line-length
1
5
  docker:
2
- image: yegor256/rultor-image:1.20.0
6
+ image: yegor256/ruby
3
7
  assets:
4
8
  rubygems.yml: zerocracy/home#assets/rubygems.yml
5
9
  install: |-
6
10
  pdd -f /dev/null
7
11
  sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
8
12
  release:
13
+ pre: false
9
14
  script: |-
10
- bundle install
11
- rake
15
+ bundle exec rake
12
16
  rm -rf *.gem
13
17
  sed -i "s/0\.0\.0/${tag}/g" zold-score.gemspec
14
18
  git add zold-score.gemspec
@@ -18,5 +22,4 @@ release:
18
22
  gem push *.gem --config-file ../rubygems.yml
19
23
  merge:
20
24
  script: |-
21
- bundle install
22
- rake
25
+ bundle exec rake
data/.simplecov CHANGED
@@ -1,40 +1,19 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2018-2023 Yegor Bugayenko
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 all
13
- # copies or substantial portions of the Software.
1
+ # frozen_string_literal: true
2
+
14
3
  #
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 NONINFINGEMENT. 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 THE
21
- # SOFTWARE.
4
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
5
+ # SPDX-License-Identifier: MIT
22
6
 
23
- if Gem.win_platform? then
24
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
25
- SimpleCov::Formatter::HTMLFormatter
26
- ]
27
- SimpleCov.start do
28
- add_filter "/test/"
29
- add_filter "/features/"
30
- end
31
- else
32
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
33
- [SimpleCov::Formatter::HTMLFormatter]
34
- )
35
- SimpleCov.start do
36
- add_filter "/test/"
37
- add_filter "/features/"
38
- # minimum_coverage 30
39
- end
7
+ SimpleCov.formatter = if Gem.win_platform?
8
+ SimpleCov::Formatter::MultiFormatter[
9
+ SimpleCov::Formatter::HTMLFormatter
10
+ ]
11
+ else
12
+ SimpleCov::Formatter::MultiFormatter.new(
13
+ [SimpleCov::Formatter::HTMLFormatter]
14
+ )
15
+ end
16
+ SimpleCov.start do
17
+ add_filter '/test/'
18
+ add_filter '/features/'
40
19
  end
data/Gemfile CHANGED
@@ -1,33 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Yegor Bugayenko
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 all
13
- # 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 THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  source 'https://rubygems.org'
24
7
  gemspec
25
8
 
26
- gem 'minitest', '5.11.3', require: false
27
- gem 'minitest-hooks', '1.5.0', require: false
28
- gem 'rake-compiler', '1.0.4', require: false
29
- gem 'rdoc', '4.3.0', require: false
30
- gem 'rspec-rails', '3.8.1', require: false
31
- gem 'rubocop', '0.62.0', require: false
32
- gem 'rubocop-rspec', '1.31.0', require: false
33
- gem 'simplecov', '0.22.0', require: false
9
+ gem 'minitest', '~>6.0', require: false
10
+ gem 'minitest-hooks', '~>1.5', require: false
11
+ gem 'minitest-reporters', '~>1.7', require: false
12
+ gem 'rake-compiler', '~>1.2', require: false
13
+ gem 'rdoc', '7.0.2', require: false
14
+ gem 'rspec-rails', '~>6.0', require: false
15
+ gem 'rubocop', '~>1.53', require: false
16
+ gem 'rubocop-minitest', '>0', require: false
17
+ gem 'rubocop-performance', '>0', require: false
18
+ gem 'rubocop-rake', '>0', require: false
19
+ gem 'rubocop-rspec', '~>2.22', require: false
20
+ gem 'simplecov', '~>0.22', require: false
21
+ gem 'simplecov-cobertura', '~>3.0', require: false
22
+ gem 'webmock', '~>3.23', require: false
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2018-2023 Yegor Bugayenko
3
+ Copyright (c) 2018-2025 Zerocracy
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/LICENSES/MIT.txt ADDED
@@ -0,0 +1,21 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2018-2025 Zerocracy
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
- <img src="https://www.zold.io/logo.svg" width="92px" height="92px"/>
1
+ # Zold Score Calculator, in Ruby and C++
2
2
 
3
- [![EO principles respected here](http://www.elegantobjects.org/badge.svg)](http://www.elegantobjects.org)
4
- [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/zold)](http://www.rultor.com/p/yegor256/zold)
5
- [![We recommend RubyMine](http://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
3
+ [![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
4
+ [![DevOps By Rultor.com](https://www.rultor.com/b/yegor256/zold)](https://www.rultor.com/p/yegor256/zold)
5
+ [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
6
6
 
7
7
  [![rake](https://github.com/zold-io/zold-score/actions/workflows/rake.yml/badge.svg)](https://github.com/zold-io/zold-score/actions/workflows/rake.yml)
8
- [![PDD status](http://www.0pdd.com/svg?name=zold-io/zold-score)](http://www.0pdd.com/p?name=zold-io/zold-score)
9
- [![Gem Version](https://badge.fury.io/rb/zold-score.svg)](http://badge.fury.io/rb/zold-score)
8
+ [![PDD status](https://www.0pdd.com/svg?name=zold-io/zold-score)](https://www.0pdd.com/p?name=zold-io/zold-score)
9
+ [![Gem Version](https://badge.fury.io/rb/zold-score.svg)](https://badge.fury.io/rb/zold-score)
10
10
  [![Test Coverage](https://img.shields.io/codecov/c/github/zold-io/zold-score.svg)](https://codecov.io/github/zold-io/zold-score?branch=master)
11
11
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/takes/blob/master/LICENSE.txt)
12
12
  [![Hits-of-Code](https://hitsofcode.com/github/zold-io/zold-score)](https://hitsofcode.com/view/github/zold-io/zold-score)
@@ -16,8 +16,8 @@ Here is the [White Paper](https://papers.zold.io/wp.pdf).
16
16
  Join our [Telegram group](https://t.me/zold_io) to discuss it all live.
17
17
 
18
18
  This small Ruby Gem calculates the score for Zold nodes. The idea of the
19
- "score" is explained in the [White Paper](https://papers.zold.io/wp.pdf). To
20
- get a better understanding of it you may want to read
19
+ "score" is explained in the [White Paper](https://papers.zold.io/wp.pdf).
20
+ To get a better understanding of it you may want to read
21
21
  [our blog](https://blog.zold.io).
22
22
 
23
23
  To calculate a new Score you create an object first:
@@ -31,7 +31,8 @@ score = Zold::Score.new(
31
31
  )
32
32
  ```
33
33
 
34
- This score has zero value and the strength of six. Then you just ask it to calculate the next score:
34
+ This score has zero value and the strength of six.
35
+ Then you just ask it to calculate the next score:
35
36
 
36
37
  ```ruby
37
38
  n = score.next
@@ -39,18 +40,22 @@ n = score.next
39
40
 
40
41
  That's it.
41
42
 
42
- This project is actively used in our [main Ruby repo](https://github.com/zold-io/zold).
43
+ This project is actively used in our
44
+ [main Ruby repo](https://github.com/zold-io/zold).
43
45
 
44
46
  ## How to contribute
45
47
 
46
- Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
47
- Make sure you build is green before you contribute
48
- your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
49
- [Bundler](https://bundler.io/) installed. Then:
48
+ Read these [guidelines].
49
+ Make sure your build is green before you contribute your pull request.
50
+ You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
51
+ [Bundler](https://bundler.io/) installed.
52
+ Then:
50
53
 
51
- ```
52
- $ bundle update
53
- $ bundle exec rake
54
+ ```bash
55
+ bundle update
56
+ bundle exec rake
54
57
  ```
55
58
 
56
59
  If it's clean and you don't see any error messages, submit your pull request.
60
+
61
+ [guidelines]: https://www.yegor256.com/2014/04/15/github-guidelines.html
data/REUSE.toml ADDED
@@ -0,0 +1,35 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ version = 1
5
+ [[annotations]]
6
+ path = [
7
+ ".DS_Store",
8
+ ".gitattributes",
9
+ ".gitignore",
10
+ ".pdd",
11
+ "**.json",
12
+ "**.md",
13
+ "**.png",
14
+ "**.txt",
15
+ "**/.DS_Store",
16
+ "**/.gitignore",
17
+ "**/.pdd",
18
+ "**/*.csv",
19
+ "**/*.jpg",
20
+ "**/*.json",
21
+ "**/*.md",
22
+ "**/*.pdf",
23
+ "**/*.png",
24
+ "**/*.svg",
25
+ "**/*.txt",
26
+ "**/*.vm",
27
+ "**/CNAME",
28
+ "**/Gemfile.lock",
29
+ "Gemfile.lock",
30
+ "README.md",
31
+ "renovate.json",
32
+ ]
33
+ precedence = "override"
34
+ SPDX-FileCopyrightText = "Copyright (c) 2025 Yegor Bugayenko"
35
+ SPDX-License-Identifier = "MIT"
data/Rakefile CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Yegor Bugayenko
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 all
13
- # 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 THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'rubygems'
24
7
  require 'rake'
@@ -33,7 +16,7 @@ def version
33
16
  Gem::Specification.load(Dir['*.gemspec'].first).version
34
17
  end
35
18
 
36
- task default: %i[clean compile test rubocop copyright]
19
+ task default: %i[clean compile test rubocop]
37
20
 
38
21
  require 'rake/extensiontask'
39
22
  Rake::ExtensionTask.new 'score_suffix' do |ext|
@@ -64,13 +47,4 @@ require 'rubocop/rake_task'
64
47
  desc 'Run RuboCop on all directories'
65
48
  RuboCop::RakeTask.new(:rubocop) do |task|
66
49
  task.fail_on_error = true
67
- task.requires << 'rubocop-rspec'
68
- end
69
-
70
- task :copyright do
71
- sh "grep -q -r '2018-#{Date.today.strftime('%Y')}' \
72
- --include '*.rb' \
73
- --include '*.txt' \
74
- --include 'Rakefile' \
75
- ."
76
50
  end
@@ -1,32 +1,17 @@
1
- // Copyright (c) 2018-2023 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
11
- // all 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 NONINFINGEMENT. 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.
1
+ // SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
2
+ // SPDX-License-Identifier: MIT
20
3
 
21
4
  #include <array>
22
5
  #include <random>
23
6
  #include <vector>
24
- #include <openssl/sha.h>
7
+ #include <openssl/evp.h>
25
8
  #include <ruby.h>
26
9
  #include <ruby/thread.h>
27
10
 
28
11
  using namespace std;
29
12
 
13
+ const size_t SHA256_LEN = 32;
14
+
30
15
  struct index_params {
31
16
  string prefix;
32
17
  int strength;
@@ -35,18 +20,20 @@ struct index_params {
35
20
  };
36
21
 
37
22
  static
38
- array<uint8_t, SHA256_DIGEST_LENGTH> sha256(const string &string)
23
+ array<uint8_t, SHA256_LEN> sha256(const string &input)
39
24
  {
40
- SHA256_CTX ctx;
41
- SHA256_Init(&ctx);
42
- SHA256_Update(&ctx, string.data(), string.size());
43
- array<uint8_t, SHA256_DIGEST_LENGTH> hash;
44
- SHA256_Final(&hash[0], &ctx);
25
+ array<uint8_t, SHA256_LEN> hash;
26
+ unsigned int len = 0;
27
+ EVP_MD_CTX *ctx = EVP_MD_CTX_new();
28
+ EVP_DigestInit_ex(ctx, EVP_sha256(), nullptr);
29
+ EVP_DigestUpdate(ctx, input.data(), input.size());
30
+ EVP_DigestFinal_ex(ctx, hash.data(), &len);
31
+ EVP_MD_CTX_free(ctx);
45
32
  return hash;
46
33
  }
47
34
 
48
35
  static
49
- bool check_hash(const array<uint8_t, SHA256_DIGEST_LENGTH> &hash, int strength)
36
+ bool check_hash(const array<uint8_t, SHA256_LEN> &hash, int strength)
50
37
  {
51
38
  int current_strength = 0;
52
39
  const auto rend = hash.rend();
@@ -1,33 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Yegor Bugayenko
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 all
13
- # 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 NONINFINGEMENT. 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 THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'mkmf'
24
7
 
25
8
  # rubocop:disable Style/GlobalVars
26
9
  $warnflags = ''
27
10
  $CXXFLAGS << ' -std=c++11 -Wno-deprecated-register'
28
- $CXXFLAGS.gsub!(/-Wimplicit-int/, '')
29
- $CXXFLAGS.gsub!(/-Wdeclaration-after-statement/, '')
30
- $CXXFLAGS.gsub!(/-Wimplicit-function-declaration/, '')
11
+
12
+ dir_config('openssl')
13
+ pkg_config('openssl') || dir_config('openssl',
14
+ ['/opt/homebrew/opt/openssl@3/include', '/usr/local/opt/openssl@3/include'],
15
+ ['/opt/homebrew/opt/openssl@3/lib', '/usr/local/opt/openssl@3/lib'])
16
+ $CXXFLAGS.gsub!('-Wimplicit-int', '')
17
+ $CXXFLAGS.gsub!('-Wdeclaration-after-statement', '')
18
+ $CXXFLAGS.gsub!('-Wimplicit-function-declaration', '')
31
19
  # rubocop:enable Style/GlobalVars
32
20
 
33
21
  create_makefile 'score_suffix/score_suffix'
data/lib/zold/score.rb CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Yegor Bugayenko
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 all
13
- # 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 NONINFINGEMENT. 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 THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'openssl'
24
7
  require 'score_suffix/score_suffix'
@@ -36,7 +19,7 @@ require 'time'
36
19
  # {White Paper}[https://papers.zold.io/wp.pdf].
37
20
  #
38
21
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
39
- # Copyright:: Copyright (c) 2018-2023 Yegor Bugayenko
22
+ # Copyright:: Copyright (c) 2018-2025 Zerocracy
40
23
  # License:: MIT
41
24
  module Zold
42
25
  # Score
@@ -58,46 +41,30 @@ module Zold
58
41
  attr_reader :time, :host, :port, :invoice, :suffixes, :strength, :created
59
42
 
60
43
  # Makes a new object of the class.
61
- def initialize(time: Time.now, host:, port: 4096, invoice:, suffixes: [],
44
+ def initialize(host:, invoice:, time: Time.now, port: 4096, suffixes: [],
62
45
  strength: Score::STRENGTH, created: Time.now)
63
46
  raise 'Time can\'t be nil' if time.nil?
64
- unless time.is_a?(Time)
65
- raise "Time must be Time, while #{time.class.name} is provided"
66
- end
47
+ raise "Time must be Time, while #{time.class.name} is provided" unless time.is_a?(Time)
67
48
  @time = time
68
49
  raise 'Host can\'t be nil' if host.nil?
69
- unless /^[0-9a-z\.\-]+$/.match?(host)
70
- raise "Host \"#{host}\" is in a wrong format"
71
- end
50
+ raise "Host \"#{host}\" is in a wrong format" unless /^[0-9a-z.-]+$/.match?(host)
72
51
  @host = host
73
52
  raise 'Port can\'t be nil' if port.nil?
74
- unless port.is_a?(Integer)
75
- raise "Port must be Integer, while #{port.class.name} is provided"
76
- end
77
- if port > 65_535
78
- raise "Port must be less than 65535, while #{port} is provided"
79
- end
80
- unless port.positive?
81
- raise "Port must be positive integer, while #{port} is provided"
82
- end
53
+ raise "Port must be Integer, while #{port.class.name} is provided" unless port.is_a?(Integer)
54
+ raise "Port must be less than 65535, while #{port} is provided" if port > 65_535
55
+ raise "Port must be positive integer, while #{port} is provided" unless port.positive?
83
56
  @port = port
84
57
  raise 'Invoice can\'t be nil' if invoice.nil?
85
- unless /^[a-zA-Z0-9]{8,32}@[a-f0-9]{16}$/.match?(invoice)
86
- raise "Invoice \"#{invoice}\" is wrong"
87
- end
58
+ raise "Invoice \"#{invoice}\" is wrong" unless /^[a-zA-Z0-9]{8,32}@[a-f0-9]{16}$/.match?(invoice)
88
59
  @invoice = invoice
89
60
  raise 'Suffixes can\'t be nil' if suffixes.nil?
90
61
  raise 'Suffixes are not an array' unless suffixes.is_a?(Array)
91
62
  @suffixes = suffixes
92
63
  raise 'Strength can\'t be nil' if strength.nil?
93
- unless strength.positive?
94
- raise "Strength must be positive integer, while #{strength} is provided"
95
- end
64
+ raise "Strength must be positive integer, while #{strength} is provided" unless strength.positive?
96
65
  @strength = strength
97
66
  raise 'Created can\'t be nil' if created.nil?
98
- unless created.is_a?(Time)
99
- raise "Created must be Time, while #{created.class.name} is provided"
100
- end
67
+ raise "Created must be Time, while #{created.class.name} is provided" unless created.is_a?(Time)
101
68
  @created = created
102
69
  end
103
70
 
@@ -172,7 +139,7 @@ module Zold
172
139
  host: parts[2],
173
140
  port: parts[3].hex,
174
141
  invoice: "#{parts[4]}@#{parts[5]}",
175
- suffixes: parts[6] ? parts[6].split(' ') : [],
142
+ suffixes: parts[6] ? parts[6].split : [],
176
143
  strength: parts[0].to_i
177
144
  )
178
145
  rescue StandardError => e
@@ -184,7 +151,7 @@ module Zold
184
151
  def hash
185
152
  raise 'Score has zero value, there is no hash' if @suffixes.empty?
186
153
  @suffixes.reduce(prefix) do |pfx, suffix|
187
- OpenSSL::Digest::SHA256.new("#{pfx} #{suffix}").hexdigest
154
+ OpenSSL::Digest.new('SHA256', "#{pfx} #{suffix}").hexdigest
188
155
  end
189
156
  end
190
157
 
@@ -219,7 +186,7 @@ module Zold
219
186
  raise "Max can't be negative: #{max}" if max.negative?
220
187
  Score.new(
221
188
  time: @time, host: @host, port: @port, invoice: @invoice,
222
- suffixes: @suffixes[0..[max, suffixes.count].min - 1],
189
+ suffixes: @suffixes[0..([max, suffixes.count].min - 1)],
223
190
  strength: @strength
224
191
  )
225
192
  end
data/renovate.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ "config:base"
5
+ ]
6
+ }
data/test/test__helper.rb CHANGED
@@ -1,28 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Yegor Bugayenko
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 all
13
- # 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 NONINFINGEMENT. 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 THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  $stdout.sync = true
24
7
 
25
8
  require 'simplecov'
26
- SimpleCov.start
9
+ require 'simplecov-cobertura'
10
+ unless SimpleCov.running || ENV['PICKS']
11
+ SimpleCov.command_name('test')
12
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
13
+ [
14
+ SimpleCov::Formatter::HTMLFormatter,
15
+ SimpleCov::Formatter::CoberturaFormatter
16
+ ]
17
+ )
18
+ SimpleCov.minimum_coverage 85
19
+ SimpleCov.minimum_coverage_by_file 60
20
+ SimpleCov.start do
21
+ add_filter 'test/'
22
+ add_filter 'vendor/'
23
+ add_filter 'target/'
24
+ track_files 'lib/**/*.rb'
25
+ track_files '*.rb'
26
+ end
27
+ end
27
28
 
28
29
  require 'minitest/autorun'
30
+ require 'minitest/reporters'
31
+ require 'webmock/minitest'
32
+ Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new]
33
+ Minitest.load :minitest_reporter
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Yegor Bugayenko
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 all
13
- # 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 NONINFINGEMENT. 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 THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'minitest/autorun'
24
7
  require 'minitest/hooks/test'
@@ -29,7 +12,7 @@ require_relative '../../lib/zold/score'
29
12
 
30
13
  # Score test.
31
14
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
32
- # Copyright:: Copyright (c) 2018-2023 Yegor Bugayenko
15
+ # Copyright:: Copyright (c) 2018-2025 Zerocracy
33
16
  # License:: MIT
34
17
  class TestScore < Minitest::Test
35
18
  include Minitest::Hooks
@@ -37,7 +20,7 @@ class TestScore < Minitest::Test
37
20
  # We need this in order to make sure any test is faster than a minute. This
38
21
  # should help spotting tests that hang out sometimes. The number of seconds
39
22
  # to wait can be increased, but try to make it as little as possible,
40
- # in order to catch problems ealier.
23
+ # in order to catch problems earlier.
41
24
  def around
42
25
  Timeout.timeout(10) do
43
26
  super
@@ -60,17 +43,17 @@ class TestScore < Minitest::Test
60
43
  host: 'localhost', port: 443, invoice: 'NOPREFIX@ffffffffffffffff',
61
44
  suffixes: %w[A B C D E F G]
62
45
  )
63
- assert(score == score.reduced(10))
46
+ assert_equal(score, score.reduced(10))
64
47
  end
65
48
 
66
49
  def test_drops_to_zero_when_expired
67
50
  score = Zold::Score.new(
68
- time: Time.now - Zold::Score::BEST_BEFORE * 60 * 60,
51
+ time: Time.now - (Zold::Score::BEST_BEFORE * 60 * 60),
69
52
  host: 'some-host', port: 9999, invoice: 'NOPREFIX@ffffffffffffffff',
70
53
  strength: 50
71
54
  ).next
72
- assert(score.valid?)
73
- assert(!score.expired?)
55
+ assert_predicate(score, :valid?)
56
+ refute_predicate(score, :expired?)
74
57
  assert_equal(0, score.value)
75
58
  end
76
59
 
@@ -81,7 +64,7 @@ class TestScore < Minitest::Test
81
64
  suffixes: %w[xxx yyy zzz]
82
65
  )
83
66
  assert_equal(3, score.value)
84
- assert(!score.valid?)
67
+ refute_predicate(score, :valid?)
85
68
  end
86
69
 
87
70
  def test_prints_mnemo
@@ -112,7 +95,7 @@ class TestScore < Minitest::Test
112
95
  ex = assert_raises(Zold::Score::CantParse) do
113
96
  Zold::Score.parse(text)
114
97
  end
115
- assert(ex.message.include?(text), ex)
98
+ assert_includes(ex.message, text, ex)
116
99
  end
117
100
 
118
101
  def test_prints_and_parses_zero_score
@@ -124,7 +107,7 @@ class TestScore < Minitest::Test
124
107
  text = before.to_s.strip
125
108
  after = Zold::Score.parse(text)
126
109
  assert_equal(before.value, after.value)
127
- assert(!after.expired?)
110
+ refute_predicate(after, :expired?)
128
111
  end
129
112
 
130
113
  def test_finds_next_score
@@ -133,24 +116,24 @@ class TestScore < Minitest::Test
133
116
  invoice: 'NOPREFIX@ffffffffffffffff', strength: 2
134
117
  ).next.next.next
135
118
  assert_equal(3, score.value)
136
- assert(score.valid?)
137
- assert(!score.expired?)
119
+ assert_predicate(score, :valid?)
120
+ refute_predicate(score, :expired?)
138
121
  end
139
122
 
140
123
  def test_dont_expire_correctly
141
124
  score = Zold::Score.new(
142
- time: Time.now - 10 * 60 * 60, host: 'localhost', port: 443,
125
+ time: Time.now - (10 * 60 * 60), host: 'localhost', port: 443,
143
126
  invoice: 'NOPREFIX@ffffffffffffffff', strength: 2
144
127
  ).next.next.next
145
- assert(!score.expired?)
128
+ refute_predicate(score, :expired?)
146
129
  end
147
130
 
148
131
  def test_is_not_valid_if_time_is_in_future
149
132
  score = Zold::Score.new(
150
- time: Time.now + 60 * 60, host: 'localhost', port: 443,
133
+ time: Time.now + (60 * 60), host: 'localhost', port: 443,
151
134
  invoice: 'NOPREFIX@ffffffffffffffff', strength: 2
152
135
  )
153
- assert(!score.valid?)
136
+ refute_predicate(score, :valid?)
154
137
  end
155
138
 
156
139
  def test_correct_number_of_zeroes
data/zold-score.gemspec CHANGED
@@ -1,45 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Yegor Bugayenko
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 all
13
- # 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 THE
21
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'English'
24
7
  Gem::Specification.new do |s|
25
- s.specification_version = 2 if s.respond_to? :specification_version=
26
- if s.respond_to? :required_rubygems_version=
27
- s.required_rubygems_version = Gem::Requirement.new('>= 0')
28
- end
29
- s.rubygems_version = '2.2'
8
+ s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
30
9
  s.required_ruby_version = '>=2.5'
31
10
  s.name = 'zold-score'
32
- s.version = '0.5.0'
11
+ s.version = '0.6.0'
33
12
  s.license = 'MIT'
34
13
  s.summary = 'Zold score'
35
14
  s.description = 'Score calculating Ruby Gem for Zold'
36
15
  s.authors = ['Yegor Bugayenko']
37
16
  s.email = 'yegor256@gmail.com'
38
- s.homepage = 'http://github.com/zold-io/zold-score'
17
+ s.homepage = 'https://github.com/zold-io/zold-score'
39
18
  s.files = `git ls-files`.split($RS)
40
19
  s.extensions = %w[ext/score_suffix/extconf.rb]
41
20
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
42
- s.test_files = s.files.grep(%r{^(test|features)/})
43
21
  s.rdoc_options = ['--charset=UTF-8']
44
22
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
23
+ s.add_dependency 'openssl', '~>3.0'
24
+ s.metadata['rubygems_mfa_required'] = 'true'
45
25
  end
metadata CHANGED
@@ -1,30 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zold-score
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-06-25 00:00:00.000000000 Z
12
- dependencies: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: openssl
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '3.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '3.0'
13
26
  description: Score calculating Ruby Gem for Zold
14
27
  email: yegor256@gmail.com
15
28
  executables: []
16
29
  extensions:
17
30
  - ext/score_suffix/extconf.rb
18
31
  extra_rdoc_files:
19
- - README.md
20
32
  - LICENSE.txt
33
+ - README.md
21
34
  files:
22
35
  - ".0pdd.yml"
23
36
  - ".gitattributes"
37
+ - ".github/workflows/actionlint.yml"
24
38
  - ".github/workflows/codecov.yml"
39
+ - ".github/workflows/copyrights.yml"
40
+ - ".github/workflows/markdown-lint.yml"
25
41
  - ".github/workflows/pdd.yml"
26
42
  - ".github/workflows/rake.yml"
43
+ - ".github/workflows/reuse.yml"
44
+ - ".github/workflows/typos.yml"
27
45
  - ".github/workflows/xcop.yml"
46
+ - ".github/workflows/yamllint.yml"
28
47
  - ".gitignore"
29
48
  - ".pdd"
30
49
  - ".rubocop.yml"
@@ -32,19 +51,22 @@ files:
32
51
  - ".simplecov"
33
52
  - Gemfile
34
53
  - LICENSE.txt
54
+ - LICENSES/MIT.txt
35
55
  - README.md
56
+ - REUSE.toml
36
57
  - Rakefile
37
58
  - ext/score_suffix/ScoreSuffix.cpp
38
59
  - ext/score_suffix/extconf.rb
39
60
  - lib/zold/score.rb
61
+ - renovate.json
40
62
  - test/test__helper.rb
41
63
  - test/zold/test_score.rb
42
64
  - zold-score.gemspec
43
- homepage: http://github.com/zold-io/zold-score
65
+ homepage: https://github.com/zold-io/zold-score
44
66
  licenses:
45
67
  - MIT
46
- metadata: {}
47
- post_install_message:
68
+ metadata:
69
+ rubygems_mfa_required: 'true'
48
70
  rdoc_options:
49
71
  - "--charset=UTF-8"
50
72
  require_paths:
@@ -60,10 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
82
  - !ruby/object:Gem::Version
61
83
  version: '0'
62
84
  requirements: []
63
- rubygems_version: 3.2.15
64
- signing_key:
65
- specification_version: 2
85
+ rubygems_version: 3.6.9
86
+ specification_version: 4
66
87
  summary: Zold score
67
- test_files:
68
- - test/test__helper.rb
69
- - test/zold/test_score.rb
88
+ test_files: []