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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32d50b829c0ddc8747b50eaf9f25bcb4bcbf4d42858e4271ece9b92ac650a6e9
4
- data.tar.gz: 034eeff20d6f3d8015fca8d4dada4002c9afeefbb49c8f0a94eaf9db45049562
3
+ metadata.gz: 7955c6c026633ceb489c05357e4d0383aca879252680a87053339682e014fe0f
4
+ data.tar.gz: ab010bcab3569cce98f608c38dfe23929ff5d8c94bba8a15e46c1e486aef71d0
5
5
  SHA512:
6
- metadata.gz: 74b9f7720d63cb7c30bcc0fb3e14a82832a2de8a36eb8e7025261d0b7073d75ea73fd9d7d4a58be5afb350e616bf0a95954cd4e798d1482f6844a87ac537fe9c
7
- data.tar.gz: e0532ba0cc8d19fa521f236c1a7ca6d265a603b6207880217b4101c3466f625e1b03029983967c4956a7f163ced06e70c31670665d9224bf7f4c278253a267ad
6
+ metadata.gz: 5861bf9d24fbb7c4cdc9ca9393736c0d65ee3e30f207a715ac0f7366f8b13ebaf442e5ebff10ae1787515bceab7f257aea44b9592a09c7f9f27d57015805ac2b
7
+ data.tar.gz: de319e8a9c70bc72a98ea456297079c732a41a3deac2b9c943065a601446ff2f828cfc7bb1a0a25f24327ed72fd6605129021aa06e23defe89095a7257bfe0a8
@@ -28,7 +28,7 @@ name: actionlint
28
28
  - master
29
29
  jobs:
30
30
  actionlint:
31
- runs-on: ubuntu-22.04
31
+ runs-on: ubuntu-24.04
32
32
  steps:
33
33
  - uses: actions/checkout@v4
34
34
  - name: Download actionlint
@@ -25,7 +25,7 @@ on:
25
25
  - master
26
26
  jobs:
27
27
  codecov:
28
- runs-on: ubuntu-22.04
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@v4
36
+ - uses: codecov/codecov-action@v5
37
37
  with:
38
38
  token: ${{ secrets.CODECOV_TOKEN }}
@@ -24,7 +24,7 @@ name: copyrights
24
24
  pull_request:
25
25
  jobs:
26
26
  copyrights:
27
- runs-on: ubuntu-22.04
27
+ runs-on: ubuntu-24.04
28
28
  steps:
29
29
  - uses: actions/checkout@v4
30
- - uses: yegor256/copyrights-action@0.0.4
30
+ - uses: yegor256/copyrights-action@0.0.8
@@ -32,7 +32,7 @@ concurrency:
32
32
  cancel-in-progress: true
33
33
  jobs:
34
34
  markdown-lint:
35
- runs-on: ubuntu-22.04
35
+ runs-on: ubuntu-24.04
36
36
  steps:
37
37
  - uses: actions/checkout@v4
38
38
  - uses: articulate/actions-markdownlint@v1
@@ -28,7 +28,7 @@ on:
28
28
  - master
29
29
  jobs:
30
30
  pdd:
31
- runs-on: ubuntu-22.04
31
+ runs-on: ubuntu-24.04
32
32
  steps:
33
33
  - uses: actions/checkout@v4
34
34
  - uses: volodya-lombrozo/pdd-action@master
@@ -31,8 +31,8 @@ jobs:
31
31
  name: test
32
32
  strategy:
33
33
  matrix:
34
- os: [ubuntu-20.04, macos-12]
35
- ruby: [2.7, 3.2]
34
+ os: [ubuntu-24.04, macos-15]
35
+ ruby: [2.7, 3.3]
36
36
  runs-on: ${{ matrix.os }}
37
37
  steps:
38
38
  - uses: actions/checkout@v4
@@ -24,7 +24,7 @@ on:
24
24
  pull_request:
25
25
  jobs:
26
26
  xcop:
27
- runs-on: ubuntu-22.04
27
+ runs-on: ubuntu-24.04
28
28
  steps:
29
29
  - uses: actions/checkout@v4
30
30
  - uses: g4s8/xcop-action@master
data/.rultor.yml CHANGED
@@ -19,7 +19,7 @@
19
19
  # SOFTWARE.
20
20
  ---
21
21
  docker:
22
- image: yegor256/rultor-image:1.23.1
22
+ image: yegor256/rultor-ruby
23
23
  assets:
24
24
  rubygems.yml: yegor256/home#assets/rubygems.yml
25
25
  install: |-
data/Gemfile CHANGED
@@ -23,10 +23,10 @@
23
23
  source 'https://rubygems.org'
24
24
  gemspec
25
25
 
26
- gem 'minitest', '5.24.1', require: false
26
+ gem 'minitest', '5.25.4', require: false
27
27
  gem 'rake', '13.2.1', require: false
28
- gem 'rubocop', '1.65.0', require: false
29
- gem 'rubocop-rspec', '3.0.3', require: false
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.0', require: false
32
- gem 'yard', '0.9.36', require: false
31
+ gem 'threads', '0.4.1', require: false
32
+ gem 'yard', '0.9.37', require: false
@@ -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 = 0
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), in #{format('%.02f', Time.now - start)}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.1'
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.1
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-07-15 00:00:00.000000000 Z
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: []