guard-unicorn 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/guard/unicorn.rb +16 -6
- data/lib/guard/unicorn/version.rb +1 -1
- metadata +12 -12
data/lib/guard/unicorn.rb
CHANGED
@@ -27,14 +27,13 @@ module Guard
|
|
27
27
|
# @raise [:task_has_failed] when start has failed
|
28
28
|
def start
|
29
29
|
info "Starting Unicorn..."
|
30
|
-
|
31
30
|
start_unicorn
|
32
31
|
end
|
33
32
|
|
34
33
|
# Called when `stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
|
35
34
|
# @raise [:task_has_failed] when stop has failed
|
36
35
|
def stop
|
37
|
-
info "Stopping
|
36
|
+
info "Stopping Unicorn"
|
38
37
|
stop_unicorn
|
39
38
|
end
|
40
39
|
|
@@ -42,7 +41,7 @@ module Guard
|
|
42
41
|
# This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
|
43
42
|
# @raise [:task_has_failed] when reload has failed
|
44
43
|
def reload
|
45
|
-
info "
|
44
|
+
info "Reloading Unicorn"
|
46
45
|
restart_unicorn
|
47
46
|
end
|
48
47
|
|
@@ -88,15 +87,26 @@ module Guard
|
|
88
87
|
def stop_unicorn
|
89
88
|
return unless pid
|
90
89
|
|
91
|
-
|
90
|
+
begin
|
91
|
+
Process.kill("QUIT", pid) if Process.getpgid(pid)
|
92
|
+
|
93
|
+
# Unicorn won't always shut down right away, so we're waiting for
|
94
|
+
# the getpgid method to raise an Errno::ESRCH that will tell us
|
95
|
+
# the process is not longer active.
|
96
|
+
sleep 1 while Process.getpgid(pid)
|
97
|
+
rescue Errno::ESRCH
|
98
|
+
# Don't do anything, the process does not exist
|
99
|
+
end
|
92
100
|
end
|
93
101
|
|
94
102
|
def pid
|
95
|
-
|
96
|
-
|
103
|
+
# Favor the pid in the pidfile, since some processes
|
104
|
+
# might daemonize properly and fork twice.
|
97
105
|
if File.exists?(@pid_path)
|
98
106
|
@pid = File.open(@pid_path) { |f| f.gets.to_i }
|
99
107
|
end
|
108
|
+
|
109
|
+
@pid
|
100
110
|
end
|
101
111
|
|
102
112
|
def info(msg)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-unicorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
16
|
-
requirement: &
|
16
|
+
requirement: &70253598121000 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70253598121000
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70253598120540 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70253598120540
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &70253598119960 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70253598119960
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: minitest
|
49
|
-
requirement: &
|
49
|
+
requirement: &70253598119420 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70253598119420
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: guard
|
60
|
-
requirement: &
|
60
|
+
requirement: &70253598118920 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70253598118920
|
69
69
|
description: Guard plug-in that allows you to restart Unicorn
|
70
70
|
email:
|
71
71
|
- andrei@andreimaxim.ro
|