capistrano-unicorn-methods 0.0.5 → 0.0.6
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.
- data/.gitignore +1 -0
- data/CHANGELOG.md +4 -0
- data/lib/capistrano-unicorn-methods.rb +42 -37
- data/lib/capistrano-unicorn-methods/version.rb +1 -1
- metadata +10 -10
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,47 +1,52 @@
|
|
|
1
1
|
require "capistrano-unicorn-methods/version"
|
|
2
|
-
Capistrano::Configuration.instance.load do
|
|
3
|
-
namespace :unicorn do
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
set(:unicorn_port) { 3000 }
|
|
10
|
-
set(:use_bundler) { true }
|
|
11
|
-
set(:rails_env) { "production" }
|
|
3
|
+
module CapistranoUnicornMethods
|
|
4
|
+
def self.load
|
|
5
|
+
Capistrano::Configuration.instance(true).load do
|
|
6
|
+
namespace :unicorn do
|
|
12
7
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
# Lazy setting these variables, as they (might) depend on other settings
|
|
9
|
+
set(:unicorn_pid) { "#{current_path}/tmp/pids/unicorn.pid" }
|
|
10
|
+
set(:unicorn_old_pid) { "#{current_path}/tmp/pids/unicorn.pid.oldbin" }
|
|
11
|
+
set(:unicorn_config) { "#{current_path}/config/unicorn.rb" }
|
|
12
|
+
set(:unicorn_port) { 3000 }
|
|
13
|
+
set(:use_bundler) { true }
|
|
14
|
+
set(:rails_env) { "production" }
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
desc "Zero-downtime restart of Unicorn"
|
|
17
|
+
task :restart do
|
|
18
|
+
unicorn.cleanup
|
|
19
|
+
run "touch #{unicorn_pid}"
|
|
20
|
+
pid = capture("cat #{unicorn_pid}").to_i
|
|
21
|
+
run "kill -s USR2 #{pid}" if pid > 0
|
|
22
|
+
end
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
end
|
|
24
|
+
desc "Starts unicorn"
|
|
25
|
+
task :start do
|
|
26
|
+
unicorn.cleanup
|
|
27
|
+
run "cd #{current_path} ; #{'bundle exec' if use_bundler} unicorn_rails -c #{unicorn_config} -D -p #{unicorn_port} -E #{rails_env}"
|
|
28
|
+
end
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
desc "Stop unicorn"
|
|
31
|
+
task :stop do
|
|
32
|
+
run "touch #{unicorn_pid}"
|
|
33
|
+
pid = capture("cat #{unicorn_pid}").to_i
|
|
34
|
+
run "kill -s QUIT #{pid}" if pid > 0
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
desc "Cleans up the old unicorn processes"
|
|
38
|
+
task :cleanup do
|
|
39
|
+
run "touch #{unicorn_old_pid}"
|
|
40
|
+
pid = capture("cat #{unicorn_old_pid}").to_i
|
|
41
|
+
run "kill -s QUIT #{pid}" if pid > 0
|
|
42
|
+
ensure_writable_dirs
|
|
43
|
+
end
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
task :ensure_writable_dirs do
|
|
46
|
+
dir = File.dirname(unicorn_pid)
|
|
47
|
+
run "chmod a+w #{dir}"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
45
50
|
end
|
|
46
51
|
end
|
|
47
52
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capistrano-unicorn-methods
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.6
|
|
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-01-
|
|
12
|
+
date: 2012-01-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rake
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &70173126662600 !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: :development
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *70173126662600
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: rspec
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &70173126660160 !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: *70173126660160
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: rspec-rails
|
|
38
|
-
requirement: &
|
|
38
|
+
requirement: &70173126659560 !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: *70173126659560
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: unicorn
|
|
49
|
-
requirement: &
|
|
49
|
+
requirement: &70173126658780 !ruby/object:Gem::Requirement
|
|
50
50
|
none: false
|
|
51
51
|
requirements:
|
|
52
52
|
- - ! '>='
|
|
@@ -54,7 +54,7 @@ dependencies:
|
|
|
54
54
|
version: '0'
|
|
55
55
|
type: :runtime
|
|
56
56
|
prerelease: false
|
|
57
|
-
version_requirements: *
|
|
57
|
+
version_requirements: *70173126658780
|
|
58
58
|
description: Contains a unicorn namespace with methods for starting stopping and maintaining
|
|
59
59
|
the unicorn server to serve the rails app.
|
|
60
60
|
email:
|