run_checker 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +3 -0
- data/VERSION +1 -1
- data/lib/run_checker/run_checker.rb +6 -0
- data/spec/run_checker/run_checker_spec.rb +10 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb6cb44b9cbeec695b462dbb7e6018864843800e
|
4
|
+
data.tar.gz: 9479466ad884b88befc7c1014d9613d4068be13e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ec03139e92cd33c3042fc5982ad20576bbe8133d6eed2551656dca9547491ebbc1373707a2d8bacf5be19028907477f1b9cd39733850ca865f23b64c7becbbc
|
7
|
+
data.tar.gz: 4b7cfd8c560c03f62ec6b98a2de65cd58d988e0369b1a5f03b3d7713b8d1175e47e0b8db52043e86aea66fd96a657532927c59802b0f5610c4627d969e186d10
|
data/CHANGELOG.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
@@ -29,6 +29,11 @@ class RunChecker
|
|
29
29
|
# If this method returns true, other process didn't run.
|
30
30
|
# If this method returns false, other process runs.
|
31
31
|
def lock
|
32
|
+
if !@lock_path || @lock_path.empty?
|
33
|
+
@logger.warn('lock file pass is nil')
|
34
|
+
return true
|
35
|
+
end
|
36
|
+
|
32
37
|
if File.exist? @lock_path
|
33
38
|
pid = 0
|
34
39
|
File.open(@lock_path, 'r') do |f|
|
@@ -58,6 +63,7 @@ class RunChecker
|
|
58
63
|
end
|
59
64
|
|
60
65
|
def cleanup
|
66
|
+
return if !@lock_path || @lock_path.empty?
|
61
67
|
return unless File.exist? @lock_path
|
62
68
|
|
63
69
|
pid = 0
|
@@ -52,4 +52,14 @@ describe RunChecker do
|
|
52
52
|
FileUtils.touch(@lock_file_path)
|
53
53
|
expect(@run_checker.lock).to eq(true)
|
54
54
|
end
|
55
|
+
|
56
|
+
it 'nil lock file lock' do
|
57
|
+
expect(RunChecker.new(nil).lock).to eq(true)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'nil lock file cleanup' do
|
61
|
+
expect do
|
62
|
+
RunChecker.new(nil).cleanup
|
63
|
+
end.to_not raise_error
|
64
|
+
end
|
55
65
|
end
|