random-port 0.7.5 → 0.7.6

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: 685cbbb964686d55837c88f3856b60207d3abaadb76e96ba9f9093bc8aba0a9c
4
- data.tar.gz: 83e7ea6c0ac635b3c06cb1d190d3a991be61d4d534596ae10852c1a7a8df542d
3
+ metadata.gz: 19a3b6d51277760ad0638f741ef63bf1fbc8a4b77663b41569da4c34e251353a
4
+ data.tar.gz: 96e0c4061b43248cbf091e318b9e6645371a7fd11189a43cd1cadccf23b9704d
5
5
  SHA512:
6
- metadata.gz: 48adf68a56c6ac4550287538b7cefa09cf033575e56dd8cdd6d53f0bc49004c87270f4c3b1d5c30576e721bf9c0589245c50854b494a3ec191588fc9e974253a
7
- data.tar.gz: bd33bb2321ea165a1e9e546fa257db2a824572a07462af36ebd0e4e2fe93a4679c16f269170f51042046e139c7ed35a76bd4bd39338dd6a00777ddb4c1fb1214
6
+ metadata.gz: 6ac6711969efbcd97a534391cff9b3bb3e4244a5fe0a4518d7cbb3644a6b849507db8025af1491fac615c1aa9f3edf4db7d7bd9e42faf5619304191c1265afa0
7
+ data.tar.gz: f01a9a30993fcc100fd5946290a8f8b60d94cb8a19db6ab8b918527ca48086f92cff89723391d99302f79fc264ed9f4d76a2225bfdfa24819e3af51ec8971396
data/Gemfile CHANGED
@@ -1,34 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2025 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 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  source 'https://rubygems.org'
24
7
  gemspec
25
8
 
26
- gem 'minitest', '5.25.4', require: false
27
- gem 'qbash', '>=0.2.2', require: false
28
- gem 'rake', '13.2.1', require: false
29
- gem 'rubocop', '1.71.0', require: false
30
- gem 'rubocop-minitest', '0.36.0', require: false
31
- gem 'rubocop-rspec', '3.4.0', require: false
32
- gem 'simplecov', '0.22.0', require: false
33
- gem 'threads', '0.4.1', require: false
34
- gem 'yard', '0.9.37', require: false
9
+ gem 'minitest', '~>5.25', require: false
10
+ gem 'qbash', '~>0.2', require: false
11
+ gem 'rake', '~>13.2', require: false
12
+ gem 'rubocop', '~>1.75', require: false
13
+ gem 'rubocop-minitest', '~>0.38', require: false
14
+ gem 'rubocop-performance', '~>1.25', require: false
15
+ gem 'rubocop-rake', '~>0.7', require: false
16
+ gem 'rubocop-rspec', '~> 3.7', require: false
17
+ gem 'simplecov', '~>0.22', require: false
18
+ gem 'threads', '~>0.4', require: false
19
+ gem 'yard', '~>0.9', require: false
data/Gemfile.lock ADDED
@@ -0,0 +1,104 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ random-port (0.0.0)
5
+ tago (~> 0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.3)
11
+ backtrace (0.4.1)
12
+ concurrent-ruby (1.3.5)
13
+ docile (1.4.1)
14
+ elapsed (0.2.0)
15
+ loog (~> 0.6)
16
+ tago (~> 0.1)
17
+ json (2.15.0)
18
+ language_server-protocol (3.17.0.5)
19
+ lint_roller (1.1.0)
20
+ logger (1.7.0)
21
+ loog (0.6.1)
22
+ logger (~> 1.0)
23
+ minitest (5.25.5)
24
+ parallel (1.27.0)
25
+ parser (3.3.9.0)
26
+ ast (~> 2.4.1)
27
+ racc
28
+ prism (1.5.1)
29
+ qbash (0.4.5)
30
+ backtrace (> 0)
31
+ elapsed (> 0)
32
+ loog (> 0)
33
+ tago (> 0)
34
+ racc (1.8.1)
35
+ rainbow (3.1.1)
36
+ rake (13.3.0)
37
+ regexp_parser (2.11.3)
38
+ rubocop (1.80.2)
39
+ json (~> 2.3)
40
+ language_server-protocol (~> 3.17.0.2)
41
+ lint_roller (~> 1.1.0)
42
+ parallel (~> 1.10)
43
+ parser (>= 3.3.0.2)
44
+ rainbow (>= 2.2.2, < 4.0)
45
+ regexp_parser (>= 2.9.3, < 3.0)
46
+ rubocop-ast (>= 1.46.0, < 2.0)
47
+ ruby-progressbar (~> 1.7)
48
+ unicode-display_width (>= 2.4.0, < 4.0)
49
+ rubocop-ast (1.47.1)
50
+ parser (>= 3.3.7.2)
51
+ prism (~> 1.4)
52
+ rubocop-minitest (0.38.2)
53
+ lint_roller (~> 1.1)
54
+ rubocop (>= 1.75.0, < 2.0)
55
+ rubocop-ast (>= 1.38.0, < 2.0)
56
+ rubocop-performance (1.26.0)
57
+ lint_roller (~> 1.1)
58
+ rubocop (>= 1.75.0, < 2.0)
59
+ rubocop-ast (>= 1.44.0, < 2.0)
60
+ rubocop-rake (0.7.1)
61
+ lint_roller (~> 1.1)
62
+ rubocop (>= 1.72.1)
63
+ rubocop-rspec (3.7.0)
64
+ lint_roller (~> 1.1)
65
+ rubocop (~> 1.72, >= 1.72.1)
66
+ ruby-progressbar (1.13.0)
67
+ simplecov (0.22.0)
68
+ docile (~> 1.1)
69
+ simplecov-html (~> 0.11)
70
+ simplecov_json_formatter (~> 0.1)
71
+ simplecov-html (0.13.2)
72
+ simplecov_json_formatter (0.1.4)
73
+ tago (0.2.0)
74
+ threads (0.4.1)
75
+ backtrace (~> 0)
76
+ concurrent-ruby (~> 1.0)
77
+ unicode-display_width (3.2.0)
78
+ unicode-emoji (~> 4.1)
79
+ unicode-emoji (4.1.0)
80
+ yard (0.9.37)
81
+
82
+ PLATFORMS
83
+ arm64-darwin-22
84
+ arm64-darwin-23
85
+ arm64-darwin-24
86
+ x64-mingw-ucrt
87
+ x86_64-linux
88
+
89
+ DEPENDENCIES
90
+ minitest (~> 5.25)
91
+ qbash (~> 0.2)
92
+ rake (~> 13.2)
93
+ random-port!
94
+ rubocop (~> 1.75)
95
+ rubocop-minitest (~> 0.38)
96
+ rubocop-performance (~> 1.25)
97
+ rubocop-rake (~> 0.7)
98
+ rubocop-rspec (~> 3.7)
99
+ simplecov (~> 0.22)
100
+ threads (~> 0.4)
101
+ yard (~> 0.9)
102
+
103
+ BUNDLED WITH
104
+ 2.5.16
data/LICENSES/MIT.txt ADDED
@@ -0,0 +1,21 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2018-2025 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.
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Random TCP Port Generator for Ruby
2
2
 
3
- [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/random-port)](http://www.rultor.com/p/yegor256/random-port)
4
- [![We recommend RubyMine](http://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
3
+ [![DevOps By Rultor.com](https://www.rultor.com/b/yegor256/random-port)](https://www.rultor.com/p/yegor256/random-port)
4
+ [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
5
5
 
6
6
  [![rake](https://github.com/yegor256/random-port/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/random-port/actions/workflows/rake.yml)
7
- [![Gem Version](https://badge.fury.io/rb/random-port.svg)](http://badge.fury.io/rb/random-port)
7
+ [![Gem Version](https://badge.fury.io/rb/random-port.svg)](https://badge.fury.io/rb/random-port)
8
8
  [![Maintainability](https://api.codeclimate.com/v1/badges/349b8c31884d3b34d926/maintainability)](https://codeclimate.com/github/yegor256/random-port/maintainability)
9
- [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/yegor256/random-port/master/frames)
9
+ [![Yard Docs](https://img.shields.io/badge/yard-docs-blue.svg)](https://rubydoc.info/github/yegor256/random-port/master/frames)
10
10
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/random-port/blob/master/LICENSE.txt)
11
11
  [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/random-port.svg)](https://codecov.io/github/yegor256/random-port?branch=master)
12
12
  [![Hits-of-Code](https://hitsofcode.com/github/yegor256/random-port)](https://hitsofcode.com/view/github/random-port/mailanes)
@@ -60,7 +60,7 @@ not-thread-safe, using optional `sync` argument of the constructor.
60
60
 
61
61
  Read
62
62
  [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
63
- Make sure you build is green before you contribute
63
+ Make sure your build is green before you contribute
64
64
  your pull request. You will need to have
65
65
  [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
66
66
  [Bundler](https://bundler.io/) installed. Then:
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-2025 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 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'rubygems'
24
7
  require 'rake'
@@ -48,7 +31,6 @@ require 'rubocop/rake_task'
48
31
  desc 'Run RuboCop on all directories'
49
32
  RuboCop::RakeTask.new(:rubocop) do |task|
50
33
  task.fail_on_error = true
51
- task.requires << 'rubocop-rspec'
52
34
  end
53
35
 
54
36
  require 'yard'
@@ -1,26 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # (The MIT License)
4
- #
5
- # Copyright (c) 2018-2025 Yegor Bugayenko
6
- #
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the 'Software'), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be included in all
15
- # copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  # The module for all classes.
26
7
  #
@@ -1,26 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # (The MIT License)
4
- #
5
- # Copyright (c) 2018-2025 Yegor Bugayenko
6
- #
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the 'Software'), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be included in all
15
- # copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  require 'monitor'
26
7
  require 'socket'
@@ -159,7 +140,11 @@ class RandomPort::Pool
159
140
  # @return [Integer] The same port number
160
141
  def take(port)
161
142
  ['127.0.0.1', '::1', '0.0.0.0', 'localhost'].each do |host|
162
- TCPServer.new(host, port).close
143
+ begin
144
+ TCPServer.new(host, port).close
145
+ rescue Errno::EADDRNOTAVAIL
146
+ next
147
+ end
163
148
  end
164
149
  port
165
150
  end
data/lib/random-port.rb CHANGED
@@ -1,26 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # (The MIT License)
4
- #
5
- # Copyright (c) 2018-2025 Yegor Bugayenko
6
- #
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the 'Software'), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be included in all
15
- # copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  require_relative 'random-port/module'
26
7
  require_relative 'random-port/pool'
data/random-port.gemspec CHANGED
@@ -1,42 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # (The MIT License)
4
- #
5
- # Copyright (c) 2018-2025 Yegor Bugayenko
6
- #
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the 'Software'), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be included in all
15
- # copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- # SOFTWARE.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  require 'English'
26
7
  Gem::Specification.new do |s|
27
8
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
28
9
  s.required_ruby_version = '>=2.3'
29
10
  s.name = 'random-port'
30
- s.version = '0.7.5'
11
+ s.version = '0.7.6'
31
12
  s.license = 'MIT'
32
13
  s.summary = 'Random TCP port'
33
14
  s.description = 'Reserves a random TCP port'
34
15
  s.authors = ['Yegor Bugayenko']
35
16
  s.email = 'yegor256@gmail.com'
36
- s.homepage = 'http://github.com/yegor256/random-port'
37
- s.files = `git ls-files`.split($RS)
17
+ s.homepage = 'https://github.com/yegor256/random-port'
18
+ s.files = `git ls-files | grep -v -E '^(test/|\\.|renovate)'`.split($RS)
38
19
  s.rdoc_options = ['--charset=UTF-8']
39
20
  s.extra_rdoc_files = ['README.md']
40
- s.add_dependency 'tago', '>0'
21
+ s.add_dependency 'tago', '~>0.0'
41
22
  s.metadata['rubygems_mfa_required'] = 'true'
42
23
  end
metadata CHANGED
@@ -1,29 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: random-port
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-01-27 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: tago
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - ">"
16
+ - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '0'
18
+ version: '0.0'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - ">"
23
+ - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '0'
25
+ version: '0.0'
27
26
  description: Reserves a random TCP port
28
27
  email: yegor256@gmail.com
29
28
  executables: []
@@ -31,35 +30,22 @@ extensions: []
31
30
  extra_rdoc_files:
32
31
  - README.md
33
32
  files:
34
- - ".0pdd.yml"
35
- - ".github/workflows/actionlint.yml"
36
- - ".github/workflows/codecov.yml"
37
- - ".github/workflows/copyrights.yml"
38
- - ".github/workflows/markdown-lint.yml"
39
- - ".github/workflows/pdd.yml"
40
- - ".github/workflows/rake.yml"
41
- - ".github/workflows/xcop.yml"
42
- - ".gitignore"
43
- - ".pdd"
44
- - ".rubocop.yml"
45
- - ".rultor.yml"
46
33
  - Gemfile
34
+ - Gemfile.lock
47
35
  - LICENSE.txt
36
+ - LICENSES/MIT.txt
48
37
  - README.md
38
+ - REUSE.toml
49
39
  - Rakefile
50
40
  - lib/random-port.rb
51
41
  - lib/random-port/module.rb
52
42
  - lib/random-port/pool.rb
53
43
  - random-port.gemspec
54
- - renovate.json
55
- - test/test__helper.rb
56
- - test/test_pool.rb
57
- homepage: http://github.com/yegor256/random-port
44
+ homepage: https://github.com/yegor256/random-port
58
45
  licenses:
59
46
  - MIT
60
47
  metadata:
61
48
  rubygems_mfa_required: 'true'
62
- post_install_message:
63
49
  rdoc_options:
64
50
  - "--charset=UTF-8"
65
51
  require_paths:
@@ -75,8 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
61
  - !ruby/object:Gem::Version
76
62
  version: '0'
77
63
  requirements: []
78
- rubygems_version: 3.4.10
79
- signing_key:
64
+ rubygems_version: 3.6.9
80
65
  specification_version: 4
81
66
  summary: Random TCP port
82
67
  test_files: []
data/.0pdd.yml DELETED
@@ -1,29 +0,0 @@
1
- # Copyright (c) 2018-2025 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
- errors:
22
- - yegor256@gmail.com
23
- # alerts:
24
- # github:
25
- # - yegor256
26
-
27
- tags:
28
- - pdd
29
- - bug
@@ -1,41 +0,0 @@
1
- # Copyright (c) 2018-2025 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-24.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
@@ -1,41 +0,0 @@
1
- # Copyright (c) 2018-2025 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: codecov
22
- 'on':
23
- push:
24
- branches:
25
- - master
26
- jobs:
27
- codecov:
28
- timeout-minutes: 5
29
- runs-on: ubuntu-24.04
30
- steps:
31
- - uses: actions/checkout@v4
32
- - uses: ruby/setup-ruby@v1
33
- with:
34
- ruby-version: 3.3
35
- - run: bundle update
36
- - run: bundle exec rake
37
- - uses: codecov/codecov-action@v5
38
- with:
39
- token: ${{ secrets.CODECOV_TOKEN }}
40
- files: coverage/.resultset.json
41
- fail_ci_if_error: true
@@ -1,34 +0,0 @@
1
- # Copyright (c) 2018-2025 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
- branches:
25
- - master
26
- pull_request:
27
- branches:
28
- - master
29
- jobs:
30
- copyrights:
31
- runs-on: ubuntu-24.04
32
- steps:
33
- - uses: actions/checkout@v4
34
- - uses: yegor256/copyrights-action@0.0.8
@@ -1,38 +0,0 @@
1
- # Copyright (c) 2018-2025 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-24.04
36
- steps:
37
- - uses: actions/checkout@v4
38
- - uses: articulate/actions-markdownlint@v1
@@ -1,34 +0,0 @@
1
- # Copyright (c) 2018-2025 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: pdd
22
- 'on':
23
- push:
24
- branches:
25
- - master
26
- pull_request:
27
- branches:
28
- - master
29
- jobs:
30
- pdd:
31
- runs-on: ubuntu-24.04
32
- steps:
33
- - uses: actions/checkout@v4
34
- - uses: volodya-lombrozo/pdd-action@master
@@ -1,43 +0,0 @@
1
- # Copyright (c) 2018-2025 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: rake
22
- 'on':
23
- push:
24
- branches:
25
- - master
26
- pull_request:
27
- branches:
28
- - master
29
- jobs:
30
- rake:
31
- timeout-minutes: 5
32
- strategy:
33
- matrix:
34
- os: [ubuntu-24.04, macos-15, windows-2022]
35
- ruby: [3.3]
36
- runs-on: ${{ matrix.os }}
37
- steps:
38
- - uses: actions/checkout@v4
39
- - uses: ruby/setup-ruby@v1
40
- with:
41
- ruby-version: ${{ matrix.ruby }}
42
- - run: bundle update
43
- - run: bundle exec rake
@@ -1,34 +0,0 @@
1
- # Copyright (c) 2018-2025 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: xcop
22
- 'on':
23
- push:
24
- branches:
25
- - master
26
- pull_request:
27
- branches:
28
- - master
29
- jobs:
30
- xcop:
31
- runs-on: ubuntu-24.04
32
- steps:
33
- - uses: actions/checkout@v4
34
- - uses: g4s8/xcop-action@master
data/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- Gemfile.lock
2
- *.gem
3
- .bundle/
4
- .DS_Store
5
- rdoc/
6
- coverage/
7
- .yardoc/
8
- doc/
data/.pdd DELETED
@@ -1,5 +0,0 @@
1
- --source=.
2
- --verbose
3
- --rule min-words:20
4
- --rule min-estimate:15
5
- --rule max-estimate:90
data/.rubocop.yml DELETED
@@ -1,52 +0,0 @@
1
- # Copyright (c) 2018-2025 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
- AllCops:
22
- DisplayCopNames: true
23
- TargetRubyVersion: 2.3.3
24
- NewCops: enable
25
- SuggestExtensions: false
26
- require:
27
- - rubocop-minitest
28
-
29
- Minitest/EmptyLineBeforeAssertionMethods:
30
- Enabled: false
31
- Layout/EmptyLineAfterGuardClause:
32
- Enabled: false
33
- Style/ClassAndModuleChildren:
34
- Enabled: false
35
- Naming/FileName:
36
- Enabled: false
37
- Metrics/MethodLength:
38
- Max: 50
39
- Metrics/BlockLength:
40
- Max: 50
41
- Style/ConditionalAssignment:
42
- Enabled: false
43
- Style/ClassVars:
44
- Enabled: false
45
- Metrics/PerceivedComplexity:
46
- Max: 20
47
- Metrics/CyclomaticComplexity:
48
- Max: 20
49
- Metrics/AbcSize:
50
- Max: 60
51
- Metrics/ClassLength:
52
- Max: 150
data/.rultor.yml DELETED
@@ -1,41 +0,0 @@
1
- # Copyright (c) 2018-2025 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
- docker:
22
- image: yegor256/rultor-ruby
23
- assets:
24
- rubygems.yml: yegor256/home#assets/rubygems.yml
25
- install: |-
26
- pdd -f /dev/null
27
- sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
28
- release:
29
- pre: false
30
- script: |-
31
- bundle exec rake
32
- rm -rf *.gem
33
- sed -i "s/0\.0\.0/${tag}/g" random-port.gemspec
34
- git add random-port.gemspec
35
- git commit -m "Version set to ${tag}"
36
- gem build random-port.gemspec
37
- chmod 0600 ../rubygems.yml
38
- gem push *.gem --config-file ../rubygems.yml
39
- merge:
40
- script: |-
41
- bundle exec rake
data/renovate.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": [
4
- "config:recommended"
5
- ]
6
- }
data/test/test__helper.rb DELETED
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright (c) 2018-2025 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.
22
-
23
- $stdout.sync = true
24
-
25
- require 'simplecov'
26
- SimpleCov.start
27
-
28
- require 'minitest/autorun'
data/test/test_pool.rb DELETED
@@ -1,189 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # (The MIT License)
4
- #
5
- # Copyright (c) 2018-2025 Yegor Bugayenko
6
- #
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the 'Software'), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be included in all
15
- # copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- # SOFTWARE.
24
-
25
- require 'minitest/autorun'
26
- require 'qbash'
27
- require 'shellwords'
28
- require 'socket'
29
- require 'threads'
30
- require_relative '../lib/random-port/pool'
31
-
32
- # Pool test.
33
- # Author:: Yegor Bugayenko (yegor256@gmail.com)
34
- # Copyright:: Copyright (c) 2018-2025 Yegor Bugayenko
35
- # License:: MIT
36
- class RandomPort::TestPool < Minitest::Test
37
- def test_acquires_and_releases
38
- pool = RandomPort::Pool.new
39
- port = pool.acquire
40
- server = TCPServer.new('localhost', port)
41
- server.close
42
- refute_nil(port)
43
- assert_predicate(port, :positive?)
44
- pool.release(port)
45
- end
46
-
47
- def test_acquires_and_releases_three_ports
48
- pool = RandomPort::Pool.new(limit: 3)
49
- assert_equal(0, pool.size)
50
- ports = pool.acquire(3, timeout: 16)
51
- ports.each do |p|
52
- server = TCPServer.new('localhost', p)
53
- server.close
54
- end
55
- assert_equal(3, pool.size)
56
- assert_equal(3, ports.count)
57
- pool.release(ports)
58
- assert_equal(0, pool.size)
59
- end
60
-
61
- def test_skips_truly_busy_port
62
- port = RandomPort::Pool.new.acquire
63
- server = TCPServer.new('127.0.0.1', port)
64
- other = RandomPort::Pool.new(start: port).acquire
65
- refute_equal(other, port)
66
- server.close
67
- end
68
-
69
- def test_skips_externally_busy_port
70
- skip 'Not supported on Windows' if Gem.win_platform?
71
- ['127.0.0.1', 'localhost', '::1', '0.0.0.0'].each do |host|
72
- Dir.mktmpdir do |home|
73
- port = RandomPort::Pool.new.acquire
74
- started = File.join(home, 'started.txt')
75
- enough = File.join(home, 'enough.txt')
76
- t =
77
- Thread.new do
78
- qbash(
79
- [
80
- 'ruby', '-e',
81
- Shellwords.escape(
82
- "
83
- require 'socket'
84
- require 'fileutils'
85
- TCPServer.new('#{host}', #{port})
86
- FileUtils.touch('#{started}')
87
- loop do
88
- break if File.exist?('#{enough}')
89
- end
90
- "
91
- )
92
- ]
93
- )
94
- end
95
- loop do
96
- break if File.exist?(started)
97
- end
98
- other = RandomPort::Pool.new(start: port).acquire
99
- FileUtils.touch(enough)
100
- t.join
101
- refute_equal(other, port)
102
- end
103
- end
104
- end
105
-
106
- def test_acquires_and_releases_three_ports_in_block
107
- pool = RandomPort::Pool.new(limit: 3)
108
- assert_equal(0, pool.size)
109
- pool.acquire(3, timeout: 16) do |ports|
110
- assert_kind_of(Array, ports)
111
- assert_equal(3, ports.count)
112
- assert_equal(3, pool.size)
113
- ports.each do |p|
114
- server = TCPServer.new('localhost', p)
115
- server.close
116
- end
117
- end
118
- assert_equal(0, pool.size)
119
- end
120
-
121
- def test_acquires_and_releases_in_block
122
- result = RandomPort::Pool.new.acquire do |port|
123
- refute_nil(port)
124
- assert_predicate(port, :positive?)
125
- 123
126
- end
127
- assert_equal(123, result)
128
- end
129
-
130
- def test_acquires_and_releases_in_threads
131
- pool = RandomPort::Pool.new
132
- Threads.new(100).assert do
133
- pool.acquire(5) do |ports|
134
- ports.each do |p|
135
- server = TCPServer.new('localhost', p)
136
- server.close
137
- end
138
- end
139
- end
140
- end
141
-
142
- def test_acquires_and_releases_safely
143
- pool = RandomPort::Pool.new
144
- assert_raises(StandardError) do
145
- pool.acquire do
146
- raise 'Itended'
147
- end
148
- end
149
- assert_predicate(pool.count, :zero?)
150
- end
151
-
152
- def test_acquires_and_releases_from_singleton
153
- RandomPort::Pool::SINGLETON.acquire do |port|
154
- refute_nil(port)
155
- assert_predicate(port, :positive?)
156
- end
157
- end
158
-
159
- def test_acquires_unique_numbers
160
- total = 25
161
- numbers = (0..total - 1).map { RandomPort::Pool::SINGLETON.acquire }
162
- assert_equal(total, numbers.uniq.count)
163
- end
164
-
165
- def test_acquires_unique_numbers_in_block
166
- total = 25
167
- numbers = (0..total - 1).map do
168
- RandomPort::Pool::SINGLETON.acquire do |port|
169
- port
170
- end
171
- end
172
- assert_equal(total, numbers.uniq.count)
173
- end
174
-
175
- def test_raises_when_too_many
176
- pool = RandomPort::Pool.new(limit: 1)
177
- pool.acquire
178
- assert_raises RandomPort::Pool::Timeout do
179
- pool.acquire(timeout: 0.1)
180
- end
181
- end
182
-
183
- def test_acquires_unique_numbers_in_no_sync_mode
184
- total = 25
185
- pool = RandomPort::Pool.new(sync: false)
186
- numbers = (0..total - 1).map { pool.acquire }
187
- assert_equal(total, numbers.uniq.count)
188
- end
189
- end