Skip to content

Commit

Permalink
#13 fresh versions
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed May 25, 2023
1 parent b9deeee commit 316f7d0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
AllCops:
DisplayCopNames: true
TargetRubyVersion: 2.3.3
NewCops: enable
SuggestExtensions: false

Layout/EmptyLineAfterGuardClause:
Enabled: false
Expand Down
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,11 @@

source 'https://rubygems.org'
gemspec

gem 'minitest', '5.18.0', require: false
gem 'rake', '13.0.6', require: false
gem 'rdoc', '6.5.0', require: false
gem 'rubocop', '1.51.0', require: false
gem 'rubocop-rspec', '2.22.0', require: false
gem 'simplecov', '0.22.0', require: false
gem 'threads', '0.3.0', require: false
6 changes: 3 additions & 3 deletions lib/random-port/pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def acquire(total = 1, timeout: 4)
end
next if opts.any? { |p| @ports.include?(p) }
d = total * (total - 1) / 2
next unless opts.inject(&:+) - total * opts.min == d
next unless opts.inject(&:+) - (total * opts.min) == d
@ports += opts
opts
end
Expand Down Expand Up @@ -133,9 +133,9 @@ def take(opt = 0)
p
end

def safe
def safe(&block)
if @sync
@monitor.synchronize { yield }
@monitor.synchronize(&block)
else
yield
end
Expand Down
15 changes: 2 additions & 13 deletions random-port.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@

require 'English'
Gem::Specification.new do |s|
s.specification_version = 2 if s.respond_to? :specification_version=
if s.respond_to? :required_rubygems_version=
s.required_rubygems_version = Gem::Requirement.new('>= 0')
end
s.rubygems_version = '2.3.3'
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
s.required_ruby_version = '>=2.3'
s.name = 'random-port'
s.version = '0.0.0'
Expand All @@ -39,14 +35,7 @@ Gem::Specification.new do |s|
s.email = 'yegor256@gmail.com'
s.homepage = 'http://github.com/yegor256/random-port'
s.files = `git ls-files`.split($RS)
s.test_files = s.files.grep(%r{^(test)/})
s.rdoc_options = ['--charset=UTF-8']
s.extra_rdoc_files = ['README.md']
s.add_development_dependency 'codecov', '0.1.10'
s.add_development_dependency 'minitest', '5.11.3'
s.add_development_dependency 'rake', '12.3.1'
s.add_development_dependency 'rdoc', '4.3.0'
s.add_development_dependency 'rubocop', '0.58.1'
s.add_development_dependency 'rubocop-rspec', '1.27.0'
s.add_development_dependency 'threads', '0.3.0'
s.metadata['rubygems_mfa_required'] = 'true'
end
7 changes: 1 addition & 6 deletions test/test__helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

STDOUT.sync = true
$stdout.sync = true

require 'simplecov'
SimpleCov.start
if ENV['CI'] == 'true'
require 'codecov'
SimpleCov.formatter = SimpleCov::Formatter::Codecov
end

require 'minitest/autorun'

0 comments on commit 316f7d0

Please sign in to comment.