lockfile 2.1.2 → 2.1.3
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 +8 -8
- data/lib/lockfile.rb +55 -41
- data/lockfile.gemspec +2 -2
- data/rakefile +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjM2ODRmNTEyZTFhNjhkMjYwOGNmYTEyZTcyZDA0ZDRkOTIxZjNhMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2U4NTZmNmRhODY5YjQ2MWE2Mzk3NmI4YzcxMjJhN2VhNzVmMzU5MQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDNlNTJjZGIwOWMwMmU5YzJhNWE2YTI4YjQ3ZDgxNjA4MzAzNTM4Y2Q3OTFm
|
10
|
+
YTNjOGY1MDIwMTQzMWExYTFhZjc1MDMyMDdkOTg3MmVhNjY5MGVjZjhjM2Jk
|
11
|
+
MjgxN2E5MDMwNDFmNWM5ZDUxMDljNTk0YTEzMmQxMTViYmM2ZGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2FjYzk1MDk1ODY0ZDhhOWExNWJmZDA4ZTg3ZjdjM2FjYzMwYWE5ZWQyN2Vj
|
14
|
+
MTE3OWNlMWViMDRhNDI1ZmFmODcwYmEyMWQyMjZkNTI2Njk3MTg5MWMxZjI2
|
15
|
+
NjExNjE2NzMzNjUyM2Q1MjNlZTM1OTFjNzNmOWMxMmExMjNlNTg=
|
data/lib/lockfile.rb
CHANGED
@@ -6,7 +6,7 @@ unless(defined?($__lockfile__) or defined?(Lockfile))
|
|
6
6
|
|
7
7
|
class Lockfile
|
8
8
|
|
9
|
-
VERSION = '2.1.
|
9
|
+
VERSION = '2.1.3'
|
10
10
|
def Lockfile.version() Lockfile::VERSION end
|
11
11
|
def version() Lockfile::VERSION end
|
12
12
|
|
@@ -24,10 +24,10 @@ unless(defined?($__lockfile__) or defined?(Lockfile))
|
|
24
24
|
class UnLockError < LockError; end
|
25
25
|
|
26
26
|
class SleepCycle < Array
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
attr_reader :min
|
28
|
+
attr_reader :max
|
29
|
+
attr_reader :range
|
30
|
+
attr_reader :inc
|
31
31
|
|
32
32
|
def initialize(min, max, inc)
|
33
33
|
@min, @max, @inc = Float(min), Float(max), Float(inc)
|
@@ -72,20 +72,20 @@ unless(defined?($__lockfile__) or defined?(Lockfile))
|
|
72
72
|
DEFAULT_DEBUG = ENV['LOCKFILE_DEBUG'] || false
|
73
73
|
|
74
74
|
class << Lockfile
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
75
|
+
attr_accessor :retries
|
76
|
+
attr_accessor :max_age
|
77
|
+
attr_accessor :sleep_inc
|
78
|
+
attr_accessor :min_sleep
|
79
|
+
attr_accessor :max_sleep
|
80
|
+
attr_accessor :suspend
|
81
|
+
attr_accessor :timeout
|
82
|
+
attr_accessor :refresh
|
83
|
+
attr_accessor :debug
|
84
|
+
attr_accessor :dont_clean
|
85
|
+
attr_accessor :poll_retries
|
86
|
+
attr_accessor :poll_max_sleep
|
87
|
+
attr_accessor :dont_sweep
|
88
|
+
attr_accessor :dont_use_lock_id
|
89
89
|
|
90
90
|
def init
|
91
91
|
@retries = DEFAULT_RETRIES
|
@@ -111,28 +111,28 @@ unless(defined?($__lockfile__) or defined?(Lockfile))
|
|
111
111
|
|
112
112
|
Lockfile.init
|
113
113
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
114
|
+
attr_reader :klass
|
115
|
+
attr_reader :path
|
116
|
+
attr_reader :opts
|
117
|
+
attr_reader :locked
|
118
|
+
attr_reader :thief
|
119
|
+
attr_reader :refresher
|
120
|
+
attr_reader :dirname
|
121
|
+
attr_reader :basename
|
122
|
+
attr_reader :clean
|
123
|
+
attr_reader :retries
|
124
|
+
attr_reader :max_age
|
125
|
+
attr_reader :sleep_inc
|
126
|
+
attr_reader :min_sleep
|
127
|
+
attr_reader :max_sleep
|
128
|
+
attr_reader :suspend
|
129
|
+
attr_reader :refresh
|
130
|
+
attr_reader :timeout
|
131
|
+
attr_reader :dont_clean
|
132
|
+
attr_reader :poll_retries
|
133
|
+
attr_reader :poll_max_sleep
|
134
|
+
attr_reader :dont_sweep
|
135
|
+
attr_reader :dont_use_lock_id
|
136
136
|
|
137
137
|
attr_accessor :debug
|
138
138
|
|
@@ -195,6 +195,20 @@ unless(defined?($__lockfile__) or defined?(Lockfile))
|
|
195
195
|
lock(&block) if block
|
196
196
|
end
|
197
197
|
|
198
|
+
##
|
199
|
+
# Executes the given block after acquiring the lock and
|
200
|
+
# ensures that the lock is relinquished afterwards.
|
201
|
+
#
|
202
|
+
def synchronize
|
203
|
+
raise ArgumentError, 'block must be given' unless block_given?
|
204
|
+
begin
|
205
|
+
lock
|
206
|
+
yield
|
207
|
+
ensure
|
208
|
+
unlock
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
198
212
|
def lock
|
199
213
|
raise StackingLockError, "<#{ @path }> is locked!" if @locked
|
200
214
|
|
data/lockfile.gemspec
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "lockfile"
|
6
|
-
spec.version = "2.1.
|
6
|
+
spec.version = "2.1.3"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "lockfile"
|
9
9
|
spec.description = "a ruby library for creating perfect and NFS safe lockfiles"
|
10
|
-
spec.license = "
|
10
|
+
spec.license = "Ruby"
|
11
11
|
|
12
12
|
spec.files =
|
13
13
|
["README",
|
data/rakefile
CHANGED
@@ -4,7 +4,7 @@ This.email = "ara.t.howard@gmail.com"
|
|
4
4
|
This.homepage = "https://github.com/ahoward/#{ This.lib }"
|
5
5
|
|
6
6
|
task :license do
|
7
|
-
open('LICENSE', 'w'){|fd| fd.puts "
|
7
|
+
open('LICENSE', 'w'){|fd| fd.puts "Ruby"}
|
8
8
|
end
|
9
9
|
|
10
10
|
task :default do
|
@@ -93,7 +93,7 @@ task :gemspec do
|
|
93
93
|
test_files = "test/#{ lib }.rb" if File.file?("test/#{ lib }.rb")
|
94
94
|
summary = object.respond_to?(:summary) ? object.summary : "summary: #{ lib } kicks the ass"
|
95
95
|
description = object.respond_to?(:description) ? object.description : "description: #{ lib } kicks the ass"
|
96
|
-
license = object.respond_to?(:license) ? object.license : "
|
96
|
+
license = object.respond_to?(:license) ? object.license : "Ruby"
|
97
97
|
|
98
98
|
if This.extensions.nil?
|
99
99
|
This.extensions = []
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lockfile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ara T. Howard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: a ruby library for creating perfect and NFS safe lockfiles
|
14
14
|
email: ara.t.howard@gmail.com
|
@@ -32,7 +32,7 @@ files:
|
|
32
32
|
- samples/out
|
33
33
|
homepage: https://github.com/ahoward/lockfile
|
34
34
|
licenses:
|
35
|
-
-
|
35
|
+
- Ruby
|
36
36
|
metadata: {}
|
37
37
|
post_install_message:
|
38
38
|
rdoc_options: []
|