futex 0.5.0 → 0.6.0

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: 92dabfba9a9b06fbe28ef35bc6add8eab32cb2720c4369b40bc2e491c6c3a6a0
4
- data.tar.gz: 2a52f78833399ba74f218fcd9ab370703d781f455fd44500f8f3639ff6c2294a
3
+ metadata.gz: c5106ee1a1a428a57559341311f6f66cdcff6b0d15453b1925e0ad570bf4f5a6
4
+ data.tar.gz: 88ff9063aff0aa87a71426808fd82b3324e5a819d3a3669f83e2900fb673dec0
5
5
  SHA512:
6
- metadata.gz: ce76e8fc437c55952863c2509fd1c448577419542d9cec5d4c540545d8148ad3504d084b5488599633e8653d3060e84f64dab371ee8bd3e320fb97be6ae77062
7
- data.tar.gz: 61896f299d5ab8b93bf066f7868a6ac67a68357d1e0fc5589b9aaffb8634b5fe46b114e9a0ab97d290c6aaec85b4250534fd632d10a3d770e3e51ad6e302be7f
6
+ metadata.gz: 68f618ed73bee632c43c350812cbf88aa1107871d15561e5cb76f9127fa29e5c223b523d31e34289dc87031b9b13bf5422ca6d6e031a675e934594551cfb822f
7
+ data.tar.gz: 7d666e9b80b81670bab473327c30dbd91a178ebf1690c0aae6c469d76099faf38a4fef0028b0596b94faa44f392a5eee384c2352b5e5c2184aded3124f650f57
data/.rubocop.yml CHANGED
@@ -10,6 +10,8 @@ Metrics/AbcSize:
10
10
  Max: 50
11
11
  Metrics/MethodLength:
12
12
  Max: 40
13
+ Metrics/ClassLength:
14
+ Max: 150
13
15
  Metrics/CyclomaticComplexity:
14
16
  Max: 10
15
17
  Metrics/PerceivedComplexity:
data/futex.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.rubygems_version = '2.3.3'
32
32
  s.required_ruby_version = '>=2.3'
33
33
  s.name = 'futex'
34
- s.version = '0.5.0'
34
+ s.version = '0.6.0'
35
35
  s.license = 'MIT'
36
36
  s.summary = 'File-based mutex'
37
37
  s.description = 'Ruby Gem for file-based locking'
data/lib/futex.rb CHANGED
@@ -107,7 +107,7 @@ access to #{@path}, #{age(start)} already: #{IO.read(@lock)}")
107
107
  def badge(exclusive)
108
108
  tname = Thread.current.name
109
109
  tname = 'nil' if tname.nil?
110
- "##{Process.pid}-#{exclusive ? 'ex' : 'sh'}/#{tname}"
110
+ "##{Process.pid}-#{exclusive ? 'ex' : 'sh'}/#{tname}[#{caller(2..2).first}]"
111
111
  end
112
112
 
113
113
  def age(time)
data/test/test_futex.rb CHANGED
@@ -135,9 +135,18 @@ class FutexTest < Minitest::Test
135
135
  Thread.current.thread_variable_get(:futex_lock)
136
136
  )
137
137
  assert(
138
- Thread.current.thread_variable_get(:futex_badge).end_with?('-ex/nil')
138
+ Thread.current.thread_variable_get(:futex_badge).include?('-ex/nil')
139
139
  )
140
140
  end
141
141
  end
142
142
  end
143
+
144
+ def test_saves_calling_file_name_in_lock
145
+ Dir.mktmpdir do |dir|
146
+ Futex.new(File.join(dir, 'hey.txt')).open do |f|
147
+ badge = IO.read("#{f}.lock")
148
+ assert(badge.include?('test/test_futex.rb:'), badge)
149
+ end
150
+ end
151
+ end
143
152
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: futex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko