threads 0.4.0 → 0.4.1

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: 0a5db04c914b7f8a558b48e026ab0be0336a4cc3723a9c77999fc3d7e20a276c
4
- data.tar.gz: f694b29951c0174472b993239f30fe5318f2102eb467b44ef33af714b8fa1015
3
+ metadata.gz: 0f03d782a571ce58ab5bea05173116b3ff67ab2b53aa9f00657541fbbe2b33af
4
+ data.tar.gz: ed1c06246c1a3d096b6e0f6aed5f88aa1c2328dac5e456b4e616aa16b9b1f865
5
5
  SHA512:
6
- metadata.gz: 8e0cd08f073de1d481622deec525bf6b3ba676619260a377a89211d94201988bb5d20a2a9397fe1e7aa73f13d28332a5b276495b527c81736c49ae47a1af9dd3
7
- data.tar.gz: cc0cea726d7a3c424c3cde5c571c1a32c1b408ce55731b7a684038e0ae7c5c417c9f081870e026bea4088afa6db4905e4c969b99f394d78f06d9776f1d617ae0
6
+ metadata.gz: 8254154064db4d867cd33a05531d05929743f061771c53ca063a5419be66ee7bc2c140fc199f3f99ff1519452924da57589ac413476213cb7715b89f593007eb
7
+ data.tar.gz: 0aa17582b6df265ee702ff103d1f74539a3eae2e92706eac835ed95fc1887fae7480b87da6b32201fadcf028d6b3246545e698f34a08df6ed3890a9aa5496315
data/.0pdd.yml CHANGED
@@ -1,9 +1,27 @@
1
+ # (The MIT License)
2
+ #
3
+ # Copyright (c) 2018-2024 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.
22
+ ---
1
23
  errors:
2
24
  - yegor256@gmail.com
3
- # alerts:
4
- # github:
5
- # - yegor256
6
-
7
25
  tags:
8
26
  - pdd
9
27
  - bug
@@ -0,0 +1,43 @@
1
+ # (The MIT License)
2
+ #
3
+ # Copyright (c) 2018-2024 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.
22
+ ---
23
+ name: actionlint
24
+ 'on':
25
+ push:
26
+ branches:
27
+ - master
28
+ pull_request:
29
+ branches:
30
+ - master
31
+ jobs:
32
+ actionlint:
33
+ runs-on: ubuntu-24.04
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+ - name: Download actionlint
37
+ id: get_actionlint
38
+ # yamllint disable-line rule:line-length
39
+ run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
40
+ shell: bash
41
+ - name: Check workflow files
42
+ run: ${{ steps.get_actionlint.outputs.executable }} -color
43
+ shell: bash
@@ -1,3 +1,24 @@
1
+ # (The MIT License)
2
+ #
3
+ # Copyright (c) 2018-2024 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.
1
22
  ---
2
23
  name: codecov
3
24
  on:
@@ -6,15 +27,14 @@ on:
6
27
  - master
7
28
  jobs:
8
29
  codecov:
9
- runs-on: ubuntu-20.04
30
+ runs-on: ubuntu-24.04
10
31
  steps:
11
- - uses: actions/checkout@v3
32
+ - uses: actions/checkout@v4
12
33
  - uses: ruby/setup-ruby@v1
13
34
  with:
14
35
  ruby-version: 2.7
15
36
  - run: bundle update
16
37
  - run: bundle exec rake
17
- - uses: codecov/codecov-action@v3
38
+ - uses: codecov/codecov-action@v5
18
39
  with:
19
- file: coverage/.resultset.json
20
- fail_ci_if_error: true
40
+ token: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,32 @@
1
+ # (The MIT License)
2
+ #
3
+ # Copyright (c) 2018-2024 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.
22
+ ---
23
+ name: copyrights
24
+ 'on':
25
+ push:
26
+ pull_request:
27
+ jobs:
28
+ copyrights:
29
+ runs-on: ubuntu-24.04
30
+ steps:
31
+ - uses: actions/checkout@v4
32
+ - uses: yegor256/copyrights-action@0.0.8
@@ -0,0 +1,40 @@
1
+ # (The MIT License)
2
+ #
3
+ # Copyright (c) 2018-2024 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.
22
+ ---
23
+ name: markdown-lint
24
+ 'on':
25
+ push:
26
+ branches:
27
+ - master
28
+ pull_request:
29
+ branches:
30
+ - master
31
+ paths-ignore: ['paper/**', 'sandbox/**']
32
+ concurrency:
33
+ group: markdown-lint-${{ github.ref }}
34
+ cancel-in-progress: true
35
+ jobs:
36
+ markdown-lint:
37
+ runs-on: ubuntu-24.04
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+ - uses: articulate/actions-markdownlint@v1
@@ -1,11 +1,36 @@
1
+ # (The MIT License)
2
+ #
3
+ # Copyright (c) 2018-2024 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.
1
22
  ---
2
23
  name: pdd
3
24
  on:
4
25
  push:
26
+ branches:
27
+ - master
5
28
  pull_request:
29
+ branches:
30
+ - master
6
31
  jobs:
7
32
  pdd:
8
- runs-on: ubuntu-20.04
33
+ runs-on: ubuntu-24.04
9
34
  steps:
10
- - uses: actions/checkout@v3
11
- - uses: g4s8/pdd-action@master
35
+ - uses: actions/checkout@v4
36
+ - uses: volodya-lombrozo/pdd-action@master
@@ -1,3 +1,24 @@
1
+ # (The MIT License)
2
+ #
3
+ # Copyright (c) 2018-2024 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.
1
22
  ---
2
23
  name: rake
3
24
  on:
@@ -12,11 +33,11 @@ jobs:
12
33
  name: test
13
34
  strategy:
14
35
  matrix:
15
- os: [ubuntu-20.04, macos-12]
16
- ruby: [2.7, 3.2]
36
+ os: [ubuntu-24.04, macos-15]
37
+ ruby: [2.7, 3.3]
17
38
  runs-on: ${{ matrix.os }}
18
39
  steps:
19
- - uses: actions/checkout@v3
40
+ - uses: actions/checkout@v4
20
41
  - uses: ruby/setup-ruby@v1
21
42
  with:
22
43
  ruby-version: ${{ matrix.ruby }}
@@ -1,3 +1,24 @@
1
+ # (The MIT License)
2
+ #
3
+ # Copyright (c) 2018-2024 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.
1
22
  ---
2
23
  name: xcop
3
24
  on:
@@ -5,7 +26,7 @@ on:
5
26
  pull_request:
6
27
  jobs:
7
28
  xcop:
8
- runs-on: ubuntu-20.04
29
+ runs-on: ubuntu-24.04
9
30
  steps:
10
- - uses: actions/checkout@v3
31
+ - uses: actions/checkout@v4
11
32
  - uses: g4s8/xcop-action@master
@@ -0,0 +1,36 @@
1
+ # (The MIT License)
2
+ #
3
+ # Copyright (c) 2018-2024 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.
22
+ ---
23
+ name: yamllint
24
+ 'on':
25
+ push:
26
+ branches:
27
+ - master
28
+ pull_request:
29
+ branches:
30
+ - master
31
+ jobs:
32
+ yamllint:
33
+ runs-on: ubuntu-24.04
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+ - uses: ibiqlik/action-yamllint@v3
data/.gitignore CHANGED
@@ -3,4 +3,6 @@ Gemfile.lock
3
3
  .bundle/
4
4
  .DS_Store
5
5
  rdoc/
6
- coverage/
6
+ coverage/
7
+ .yardoc/
8
+ doc/
data/.rubocop.yml CHANGED
@@ -1,14 +1,36 @@
1
+ # (The MIT License)
2
+ #
3
+ # Copyright (c) 2018-2024 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.
22
+ ---
1
23
  AllCops:
2
24
  DisplayCopNames: true
3
25
  TargetRubyVersion: 2.3.3
4
26
  NewCops: enable
5
27
  SuggestExtensions: false
6
28
 
7
- Layout/MultilineMethodCallIndentation:
8
- Enabled: false
9
29
  Metrics/AbcSize:
10
- Max: 30
30
+ Max: 50
11
31
  Metrics/MethodLength:
12
- Max: 30
32
+ Max: 50
13
33
  Metrics/BlockLength:
14
34
  Max: 30
35
+ Layout/EmptyLineAfterGuardClause:
36
+ Enabled: false
data/.rultor.yml CHANGED
@@ -1,9 +1,32 @@
1
+ # (The MIT License)
2
+ #
3
+ # Copyright (c) 2018-2024 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.
22
+ ---
1
23
  docker:
2
- image: yegor256/rultor-image:1.19.0
24
+ image: yegor256/rultor-ruby
3
25
  assets:
4
26
  rubygems.yml: yegor256/home#assets/rubygems.yml
5
27
  install: |-
6
- sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
28
+ sudo chown -R "$(whoami)" /usr/local/rvm
29
+ bundle install --no-color "--gemfile=$(pwd)/Gemfile"
7
30
  release:
8
31
  script: |-
9
32
  bundle exec rake
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 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
@@ -24,8 +24,9 @@ source 'https://rubygems.org'
24
24
  gemspec
25
25
 
26
26
  gem 'minitest', '~>5', require: false
27
- gem 'rake', '13.0.6', require: false
28
- gem 'rdoc', '6.5.0', require: false
29
- gem 'rubocop', '1.55.1', require: false
30
- gem 'rubocop-rspec', '2.23.0', require: false
27
+ gem 'rake', '13.2.1', require: false
28
+ gem 'rdoc', '6.10.0', require: false
29
+ gem 'rubocop', '1.69.2', require: false
30
+ gem 'rubocop-rspec', '3.3.0', require: false
31
31
  gem 'simplecov', '0.22.0', require: false
32
+ gem 'yard', '0.9.37', require: false
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
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
+ # Runs Code Block in Many Threads
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/threads)](http://www.rultor.com/p/yegor256/threads)
@@ -11,20 +11,23 @@
11
11
  [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/threads.svg)](https://codecov.io/github/yegor256/threads?branch=master)
12
12
  [![Hits-of-Code](https://hitsofcode.com/github/yegor256/threads)](https://hitsofcode.com/view/github/yegor256/threads)
13
13
 
14
- Read this blog post first: [_Do You Test Ruby Code for Thread Safety?_](https://www.yegor256.com/2018/11/06/ruby-threads.html)
14
+ Read this blog post first: [Do You Test Ruby Code for Thread Safety?][blog]
15
15
 
16
16
  When you need to test your code for thread safety, what do you do?
17
17
  That's right, you just don't test it.
18
- That's [wrong](https://www.yegor256.com/2018/03/27/how-to-test-thread-safety.html)!
19
- This simple gem helps you test your code with just two additional lines of code.
18
+ That's
19
+ [wrong](https://www.yegor256.com/2018/03/27/how-to-test-thread-safety.html)!
20
+ This simple gem helps you test your code
21
+ with just two additional lines of code.
20
22
 
21
23
  First, install it:
22
24
 
23
25
  ```bash
24
- $ gem install threads
26
+ gem install threads
25
27
  ```
26
28
 
27
- Then, use it like this, to test your code from multiple concurrently running threads:
29
+ Then, use it like this, to test your code from multiple
30
+ concurrently running threads:
28
31
 
29
32
  ```ruby
30
33
  require 'threads'
@@ -33,9 +36,11 @@ Threads.new(5).assert do |i|
33
36
  end
34
37
  ```
35
38
 
36
- You can put whatever you want into the block. The code will be executed from five threads, concurrently.
39
+ You can put whatever you want into the block. The code will be executed
40
+ from five threads, concurrently.
37
41
  You can also make sure the code block runs only a specific number of times
38
- specifying the argument in the `assert` method (it can't be smaller than the amount of threads):
42
+ specifying the argument in the `assert` method (it can't be smaller
43
+ than the amount of threads):
39
44
 
40
45
  ```ruby
41
46
  Threads.new(5).assert(20) do |i, r|
@@ -56,14 +61,18 @@ That's it.
56
61
 
57
62
  ## How to contribute
58
63
 
59
- Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
64
+ Read
65
+ [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
60
66
  Make sure you build is green before you contribute
61
- your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
67
+ your pull request. You will need to have
68
+ [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
62
69
  [Bundler](https://bundler.io/) installed. Then:
63
70
 
64
- ```
65
- $ bundle update
66
- $ bundle exec rake
71
+ ```bash
72
+ bundle update
73
+ bundle exec rake
67
74
  ```
68
75
 
69
76
  If it's clean and you don't see any error messages, submit your pull request.
77
+
78
+ [blog]: https://www.yegor256.com/2018/11/06/ruby-threads.html
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 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
@@ -34,7 +34,7 @@ def version
34
34
  Gem::Specification.load(Dir['*.gemspec'].first).version
35
35
  end
36
36
 
37
- task default: %i[clean test rubocop]
37
+ task default: %i[clean test rubocop yard]
38
38
 
39
39
  require 'rake/testtask'
40
40
  desc 'Run all unit tests'
@@ -44,6 +44,12 @@ Rake::TestTask.new(:test) do |test|
44
44
  test.verbose = false
45
45
  end
46
46
 
47
+ require 'yard'
48
+ desc 'Build Yard documentation'
49
+ YARD::Rake::YardocTask.new do |t|
50
+ t.files = ['lib/**/*.rb']
51
+ end
52
+
47
53
  require 'rubocop/rake_task'
48
54
  desc 'Run RuboCop on all directories'
49
55
  RuboCop::RakeTask.new(:rubocop) do |task|
data/lib/threads.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # (The MIT License)
4
4
  #
5
- # Copyright (c) 2018-2023 Yegor Bugayenko
5
+ # Copyright (c) 2018-2024 Yegor Bugayenko
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the 'Software'), to deal
@@ -26,50 +26,71 @@ require 'concurrent'
26
26
  require 'backtrace'
27
27
 
28
28
  # Threads.
29
+ #
30
+ # This class may help you test your code for thread-safety by running
31
+ # it multiple times in a few parallel threads:
32
+ #
33
+ # require 'threads'
34
+ # Threads.new(5).assert do |i|
35
+ # puts "Hello from the thread no.#{i}"
36
+ # end
37
+ #
38
+ # Here, the message will be printed to the console five times, once in every
39
+ # thread.
40
+ #
29
41
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2018-2023 Yegor Bugayenko
42
+ # Copyright:: Copyright (c) 2018-2024 Yegor Bugayenko
31
43
  # License:: MIT
32
44
  class Threads
45
+ # Constructor.
46
+ #
47
+ # @param [Number] total How many threads to run
48
+ # @param [Logger] log Where to print output
33
49
  def initialize(total = Concurrent.processor_count * 8, log: $stdout)
34
50
  raise "Total can't be nil" if total.nil?
35
51
  raise "Total can't be negative or zero: #{total}" unless total.positive?
36
-
37
52
  @total = total
38
53
  raise "Log can't be nil" if log.nil?
39
-
40
54
  @log = log
41
55
  end
42
56
 
57
+ # Run them all and assert that all of them finished successfully.
58
+ #
59
+ # @param [Number] reps How many times to repeat the testing cycle
60
+ # @return nil
43
61
  def assert(reps = @total)
44
62
  raise "Repetition counter #{reps} can't be smaller than #{@total}" if reps < @total
45
-
46
63
  done = Concurrent::AtomicFixnum.new
47
64
  rep = Concurrent::AtomicFixnum.new
48
65
  pool = Concurrent::FixedThreadPool.new(@total)
49
66
  latch = Concurrent::CountDownLatch.new(1)
67
+ finish = Concurrent::CountDownLatch.new(@total)
50
68
  @total.times do |t|
51
69
  pool.post do
52
70
  Thread.current.name = "assert-thread-#{t}"
53
71
  latch.wait(10)
54
- loop do
55
- r = rep.increment
56
- break if r > reps
57
-
58
- begin
59
- yield(t, r - 1)
60
- rescue StandardError => e
61
- print(Backtrace.new(e))
62
- raise e
72
+ begin
73
+ loop do
74
+ r = rep.increment
75
+ break if r > reps
76
+ begin
77
+ yield(t, r - 1)
78
+ rescue StandardError => e
79
+ print(Backtrace.new(e))
80
+ raise e
81
+ end
63
82
  end
83
+ done.increment
84
+ ensure
85
+ finish.count_down
64
86
  end
65
- done.increment
66
87
  end
67
88
  end
68
89
  latch.count_down
90
+ finish.wait(10)
69
91
  pool.shutdown
70
92
  raise "Can't stop the pool" unless pool.wait_for_termination(30)
71
93
  return if done.value == @total
72
-
73
94
  raise "Only #{done.value} out of #{@total} threads completed successfully"
74
95
  end
75
96
 
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_threads.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # (The MIT License)
4
4
  #
5
- # Copyright (c) 2018-2023 Yegor Bugayenko
5
+ # Copyright (c) 2018-2024 Yegor Bugayenko
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the 'Software'), to deal
@@ -28,7 +28,7 @@ require_relative '../lib/threads'
28
28
 
29
29
  # Threads test.
30
30
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
31
- # Copyright:: Copyright (c) 2018-2023 Yegor Bugayenko
31
+ # Copyright:: Copyright (c) 2018-2024 Yegor Bugayenko
32
32
  # License:: MIT
33
33
  class ThreadsTest < Minitest::Test
34
34
  def test_multiple_threads
@@ -47,6 +47,15 @@ class ThreadsTest < Minitest::Test
47
47
  assert_equal(20, done.value)
48
48
  end
49
49
 
50
+ def test_slow_threads
51
+ done = Concurrent::AtomicFixnum.new
52
+ Threads.new(3).assert(20) do
53
+ sleep(0.1)
54
+ done.increment
55
+ end
56
+ assert_equal(20, done.value)
57
+ end
58
+
50
59
  def test_multiple_threads_with_errors
51
60
  log = FakeLog.new
52
61
  assert_raises do
data/threads.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # (The MIT License)
4
4
  #
5
- # Copyright (c) 2018-2023 Yegor Bugayenko
5
+ # Copyright (c) 2018-2024 Yegor Bugayenko
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the 'Software'), to deal
@@ -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 = 'threads'
30
- s.version = '0.4.0'
30
+ s.version = '0.4.1'
31
31
  s.license = 'MIT'
32
32
  s.summary = 'Test threads'
33
33
  s.description = 'Rugy Gem to test a piece of code in concurrent threads'
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
37
37
  s.files = `git ls-files`.split($RS)
38
38
  s.rdoc_options = ['--charset=UTF-8']
39
39
  s.extra_rdoc_files = ['README.md']
40
- s.add_runtime_dependency 'backtrace', '~>0'
41
- s.add_runtime_dependency 'concurrent-ruby', '~>1.0'
40
+ s.add_dependency 'backtrace', '~>0'
41
+ s.add_dependency 'concurrent-ruby', '~>1.0'
42
42
  s.metadata['rubygems_mfa_required'] = 'true'
43
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: threads
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-01 00:00:00.000000000 Z
11
+ date: 2024-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -46,15 +46,18 @@ extra_rdoc_files:
46
46
  - README.md
47
47
  files:
48
48
  - ".0pdd.yml"
49
+ - ".github/workflows/actionlint.yml"
49
50
  - ".github/workflows/codecov.yml"
51
+ - ".github/workflows/copyrights.yml"
52
+ - ".github/workflows/markdown-lint.yml"
50
53
  - ".github/workflows/pdd.yml"
51
54
  - ".github/workflows/rake.yml"
52
55
  - ".github/workflows/xcop.yml"
56
+ - ".github/workflows/yamllint.yml"
53
57
  - ".gitignore"
54
58
  - ".pdd"
55
59
  - ".rubocop.yml"
56
60
  - ".rultor.yml"
57
- - ".travis.yml"
58
61
  - Gemfile
59
62
  - LICENSE.txt
60
63
  - README.md
@@ -70,7 +73,7 @@ licenses:
70
73
  - MIT
71
74
  metadata:
72
75
  rubygems_mfa_required: 'true'
73
- post_install_message:
76
+ post_install_message:
74
77
  rdoc_options:
75
78
  - "--charset=UTF-8"
76
79
  require_paths:
@@ -86,8 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
89
  - !ruby/object:Gem::Version
87
90
  version: '0'
88
91
  requirements: []
89
- rubygems_version: 3.2.15
90
- signing_key:
92
+ rubygems_version: 3.4.10
93
+ signing_key:
91
94
  specification_version: 4
92
95
  summary: Test threads
93
96
  test_files: []
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.6.0
4
- branches:
5
- only:
6
- - master
7
- install:
8
- - bundle install
9
- script:
10
- - set -e
11
- - bundle exec rake
12
- after_success:
13
- - "bash <(curl -s https://codecov.io/bash)"
14
-