random-port 0.7.1 → 0.7.2
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 +4 -4
- data/.github/workflows/actionlint.yml +1 -1
- data/.github/workflows/codecov.yml +2 -2
- data/.github/workflows/copyrights.yml +2 -2
- data/.github/workflows/markdown-lint.yml +1 -1
- data/.github/workflows/pdd.yml +1 -1
- data/.github/workflows/rake.yml +2 -2
- data/.github/workflows/xcop.yml +1 -1
- data/.rultor.yml +1 -1
- data/Gemfile +5 -5
- data/lib/random-port/pool.rb +6 -3
- data/random-port.gemspec +2 -1
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7955c6c026633ceb489c05357e4d0383aca879252680a87053339682e014fe0f
|
4
|
+
data.tar.gz: ab010bcab3569cce98f608c38dfe23929ff5d8c94bba8a15e46c1e486aef71d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5861bf9d24fbb7c4cdc9ca9393736c0d65ee3e30f207a715ac0f7366f8b13ebaf442e5ebff10ae1787515bceab7f257aea44b9592a09c7f9f27d57015805ac2b
|
7
|
+
data.tar.gz: de319e8a9c70bc72a98ea456297079c732a41a3deac2b9c943065a601446ff2f828cfc7bb1a0a25f24327ed72fd6605129021aa06e23defe89095a7257bfe0a8
|
@@ -25,7 +25,7 @@ on:
|
|
25
25
|
- master
|
26
26
|
jobs:
|
27
27
|
codecov:
|
28
|
-
runs-on: ubuntu-
|
28
|
+
runs-on: ubuntu-24.04
|
29
29
|
steps:
|
30
30
|
- uses: actions/checkout@v4
|
31
31
|
- uses: ruby/setup-ruby@v1
|
@@ -33,6 +33,6 @@ jobs:
|
|
33
33
|
ruby-version: 2.7
|
34
34
|
- run: bundle update
|
35
35
|
- run: bundle exec rake
|
36
|
-
- uses: codecov/codecov-action@
|
36
|
+
- uses: codecov/codecov-action@v5
|
37
37
|
with:
|
38
38
|
token: ${{ secrets.CODECOV_TOKEN }}
|
data/.github/workflows/pdd.yml
CHANGED
data/.github/workflows/rake.yml
CHANGED
data/.github/workflows/xcop.yml
CHANGED
data/.rultor.yml
CHANGED
data/Gemfile
CHANGED
@@ -23,10 +23,10 @@
|
|
23
23
|
source 'https://rubygems.org'
|
24
24
|
gemspec
|
25
25
|
|
26
|
-
gem 'minitest', '5.
|
26
|
+
gem 'minitest', '5.25.4', require: false
|
27
27
|
gem 'rake', '13.2.1', require: false
|
28
|
-
gem 'rubocop', '1.
|
29
|
-
gem 'rubocop-rspec', '3.0
|
28
|
+
gem 'rubocop', '1.69.2', require: false
|
29
|
+
gem 'rubocop-rspec', '3.3.0', require: false
|
30
30
|
gem 'simplecov', '0.22.0', require: false
|
31
|
-
gem 'threads', '0.4.
|
32
|
-
gem 'yard', '0.9.
|
31
|
+
gem 'threads', '0.4.1', require: false
|
32
|
+
gem 'yard', '0.9.37', require: false
|
data/lib/random-port/pool.rb
CHANGED
@@ -22,8 +22,9 @@
|
|
22
22
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
23
|
# SOFTWARE.
|
24
24
|
|
25
|
-
require 'socket'
|
26
25
|
require 'monitor'
|
26
|
+
require 'socket'
|
27
|
+
require 'tago'
|
27
28
|
require_relative 'module'
|
28
29
|
|
29
30
|
# Pool of TPC ports.
|
@@ -59,7 +60,7 @@ class RandomPort::Pool
|
|
59
60
|
@sync = sync
|
60
61
|
@monitor = Monitor.new
|
61
62
|
@limit = limit
|
62
|
-
@next =
|
63
|
+
@next = 1024
|
63
64
|
end
|
64
65
|
|
65
66
|
# Application wide pool of ports
|
@@ -85,13 +86,15 @@ class RandomPort::Pool
|
|
85
86
|
# is available.
|
86
87
|
def acquire(total = 1, timeout: 4)
|
87
88
|
start = Time.now
|
89
|
+
attempt = 0
|
88
90
|
loop do
|
89
91
|
if Time.now > start + timeout
|
90
92
|
raise \
|
91
93
|
Timeout,
|
92
94
|
"Can't find a place in the pool of #{@limit} ports " \
|
93
|
-
"for #{total} port(s),
|
95
|
+
"for #{total} port(s), after #{attempt} attempts in #{start.ago}"
|
94
96
|
end
|
97
|
+
attempt += 1
|
95
98
|
opts = safe do
|
96
99
|
next if @ports.count + total > @limit
|
97
100
|
opts = Array.new(0, total)
|
data/random-port.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
28
28
|
s.required_ruby_version = '>=2.3'
|
29
29
|
s.name = 'random-port'
|
30
|
-
s.version = '0.7.
|
30
|
+
s.version = '0.7.2'
|
31
31
|
s.license = 'MIT'
|
32
32
|
s.summary = 'Random TCP port'
|
33
33
|
s.description = 'Reserves a random TCP port'
|
@@ -37,5 +37,6 @@ 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_dependency 'tago', '>0'
|
40
41
|
s.metadata['rubygems_mfa_required'] = 'true'
|
41
42
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: random-port
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
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: 2024-
|
12
|
-
dependencies:
|
11
|
+
date: 2024-12-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: tago
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
description: Reserves a random TCP port
|
14
28
|
email: yegor256@gmail.com
|
15
29
|
executables: []
|
@@ -45,7 +59,7 @@ licenses:
|
|
45
59
|
- MIT
|
46
60
|
metadata:
|
47
61
|
rubygems_mfa_required: 'true'
|
48
|
-
post_install_message:
|
62
|
+
post_install_message:
|
49
63
|
rdoc_options:
|
50
64
|
- "--charset=UTF-8"
|
51
65
|
require_paths:
|
@@ -62,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
76
|
version: '0'
|
63
77
|
requirements: []
|
64
78
|
rubygems_version: 3.4.10
|
65
|
-
signing_key:
|
79
|
+
signing_key:
|
66
80
|
specification_version: 4
|
67
81
|
summary: Random TCP port
|
68
82
|
test_files: []
|