insidious 0.1.2 → 0.2
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 +4 -4
- data/lib/error.rb +2 -0
- data/lib/insidious.rb +9 -12
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad7509659f0b9ee6452f114f372f7fe80c9fda90
|
4
|
+
data.tar.gz: 7d19317732b6409eddcff3bca14161d4df0f30bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71ca90b365af0c14934e9eec46d20333cbc167b4d014dcb8177edd38d239c8f24d22c10832cf0125721f69a0102272650239f6322582b24ffe6528550ca6afd6
|
7
|
+
data.tar.gz: 07205f48fa03b51f78a7fc208d0f2392b511ad020b1d5268a8a2ced9d662d65726c11780e991c94ebfbfb9057d0cc99194a9fc3d316673410e2536a836483370
|
data/lib/error.rb
ADDED
data/lib/insidious.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'error'
|
2
|
+
|
1
3
|
class Insidious
|
2
4
|
attr_accessor :pid_file
|
3
5
|
attr_accessor :pid
|
@@ -45,17 +47,12 @@ class Insidious
|
|
45
47
|
# is already running, in which case insidious will exit with an error
|
46
48
|
# code.
|
47
49
|
def start!(&block)
|
48
|
-
if
|
49
|
-
|
50
|
-
|
51
|
-
STDERR.puts("Daemon is already running with PID #{pid}")
|
52
|
-
exit 2
|
53
|
-
rescue Errno::ESRCH
|
54
|
-
run!(&block)
|
55
|
-
end
|
50
|
+
if running?
|
51
|
+
fail InsidiousError.new("Process is already running with PID #{pid}")
|
52
|
+
exit 2
|
56
53
|
else
|
57
|
-
if
|
58
|
-
|
54
|
+
if pid_file.nil? && daemonize
|
55
|
+
fail InsidiousError.new('No PID file is set but daemonize is set to true')
|
59
56
|
exit 1
|
60
57
|
end
|
61
58
|
|
@@ -73,11 +70,11 @@ class Insidious
|
|
73
70
|
Process.kill(:INT, pid)
|
74
71
|
File.delete(pid_file)
|
75
72
|
rescue Errno::ESRCH
|
76
|
-
|
73
|
+
fail InsidiousError.new("No process is running with PID #{pid}")
|
77
74
|
exit 3
|
78
75
|
end
|
79
76
|
else
|
80
|
-
|
77
|
+
fail InsidiousError.new("Couldn't find the PID file: '#{pid_file}'")
|
81
78
|
exit 1
|
82
79
|
end
|
83
80
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: insidious
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James White
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -20,6 +20,7 @@ files:
|
|
20
20
|
- LICENSE
|
21
21
|
- README.md
|
22
22
|
- Rakefile
|
23
|
+
- lib/error.rb
|
23
24
|
- lib/insidious.rb
|
24
25
|
homepage: https://github.com/jamesrwhite/insidious
|
25
26
|
licenses:
|
@@ -31,12 +32,12 @@ require_paths:
|
|
31
32
|
- lib
|
32
33
|
required_ruby_version: !ruby/object:Gem::Requirement
|
33
34
|
requirements:
|
34
|
-
- -
|
35
|
+
- - ">="
|
35
36
|
- !ruby/object:Gem::Version
|
36
37
|
version: 1.9.3
|
37
38
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
39
|
requirements:
|
39
|
-
- -
|
40
|
+
- - ">="
|
40
41
|
- !ruby/object:Gem::Version
|
41
42
|
version: '0'
|
42
43
|
requirements: []
|