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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55c9bdc306e281aae2569032a606ae52f76949e4
4
- data.tar.gz: 9fdd7077e4fe5e7e771130d8c285652df2bef188
3
+ metadata.gz: bb6cb44b9cbeec695b462dbb7e6018864843800e
4
+ data.tar.gz: 9479466ad884b88befc7c1014d9613d4068be13e
5
5
  SHA512:
6
- metadata.gz: daf4ce9414d917bc1494753661a37a1bfb37dd6da7195fe8fb839907a73e544167f53e1263114e5baa359f198ea294d4cbc8c67a8041b472d6792c376fb075f0
7
- data.tar.gz: 55eb6bc0e3a3be99e6367adf533ed1cc5a78d970d5cceaf563ee06f86c8f481f6654e9fe504f4babbf9d38c70849173e4dba6cbe98ce51c8fd2caa80762f63cf
6
+ metadata.gz: 6ec03139e92cd33c3042fc5982ad20576bbe8133d6eed2551656dca9547491ebbc1373707a2d8bacf5be19028907477f1b9cd39733850ca865f23b64c7becbbc
7
+ data.tar.gz: 4b7cfd8c560c03f62ec6b98a2de65cd58d988e0369b1a5f03b3d7713b8d1175e47e0b8db52043e86aea66fd96a657532927c59802b0f5610c4627d969e186d10
@@ -1,3 +1,6 @@
1
+ = 0.1.4
2
+ - fix crash app when lock file pass is nil
3
+
1
4
  = 0.1.3
2
5
  - fix empty lock file bug
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: run_checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - byplayer