capistrano-background 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +6 -5
- data/lib/capistrano/background/version.rb +1 -1
- data/lib/capistrano/tasks/background.rake +8 -12
- metadata +3 -5
- data/bin/console +0 -14
- data/bin/setup +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf36b42b2735b7e571137771f131ffc4e979454a
|
4
|
+
data.tar.gz: 12f0d135735a6d1f0a17195cbef3342297f6e4f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53d8cb1b7d8b40520812000265f5dd9bbcbf43e1b5c375107404f75f138d7a919631b11804ceb35eacb6d7bc5918e8a054c8dcc89e3e35c398433899ed9e02f2
|
7
|
+
data.tar.gz: 47adfc11b15c3ba8a0880a8044260859a278611b3027b83f83ac47399dd1197bdc9a532d02d85c75d850d794f236f5ee0fdd04e76c8d19369a3a0254bd7bf659
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -26,11 +26,12 @@ require 'capistrano/background'
|
|
26
26
|
```
|
27
27
|
Add your background processes.
|
28
28
|
```Ruby
|
29
|
-
|
30
|
-
:
|
31
|
-
|
32
|
-
|
33
|
-
}
|
29
|
+
set :background_processes, {
|
30
|
+
:scheduler => {
|
31
|
+
:execute => [:rake, 'scheduler'],
|
32
|
+
:timeout => 60 # kill process after waiting this time (seconds)
|
33
|
+
}
|
34
|
+
}
|
34
35
|
```
|
35
36
|
It will run `rake scheduler` in background when deploy. You can also use command:
|
36
37
|
|
@@ -15,8 +15,6 @@ namespace :deploy do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
namespace :background do
|
18
|
-
processes = []
|
19
|
-
|
20
18
|
def get_pid_file(options)
|
21
19
|
options[:pid_file] || File.join(shared_path, 'tmp', 'pids', "#{options[:id]}.pid")
|
22
20
|
end
|
@@ -30,7 +28,7 @@ namespace :background do
|
|
30
28
|
end
|
31
29
|
|
32
30
|
def quiet_process(pid_file)
|
33
|
-
if
|
31
|
+
if pid_process_exists? pid_file
|
34
32
|
background "kill -TERM `cat #{pid_file}`"
|
35
33
|
end
|
36
34
|
end
|
@@ -47,7 +45,7 @@ namespace :background do
|
|
47
45
|
def stop_process(pid_file, timeout)
|
48
46
|
if file_exists? pid_file
|
49
47
|
if pid_process_exists? pid_file
|
50
|
-
|
48
|
+
execute :bundle, :exec, *%{terminate `cat #{pid_file}` -t #{timeout}}
|
51
49
|
end
|
52
50
|
execute "rm #{pid_file}"
|
53
51
|
end
|
@@ -63,7 +61,8 @@ namespace :background do
|
|
63
61
|
desc 'Quiet background processes'
|
64
62
|
task :quiet do
|
65
63
|
background_processes = fetch :background_processes
|
66
|
-
background_processes.each do |options|
|
64
|
+
background_processes.each do |id, options|
|
65
|
+
options[:id] = id
|
67
66
|
role = options[:role] || :app
|
68
67
|
on roles role do
|
69
68
|
within release_path do
|
@@ -76,7 +75,8 @@ namespace :background do
|
|
76
75
|
desc 'Stop background processes'
|
77
76
|
task :stop do
|
78
77
|
background_processes = fetch :background_processes
|
79
|
-
background_processes.each do |options|
|
78
|
+
background_processes.each do |id, options|
|
79
|
+
options[:id] = id
|
80
80
|
role = options[:role] || :app
|
81
81
|
on roles role do
|
82
82
|
within release_path do
|
@@ -89,7 +89,8 @@ namespace :background do
|
|
89
89
|
desc 'Start background processes'
|
90
90
|
task :start do
|
91
91
|
background_processes = fetch :background_processes
|
92
|
-
background_processes.each do |options|
|
92
|
+
background_processes.each do |id, options|
|
93
|
+
options[:id] = id
|
93
94
|
role = options[:role] || :app
|
94
95
|
on roles role do
|
95
96
|
within release_path do
|
@@ -106,8 +107,3 @@ namespace :background do
|
|
106
107
|
invoke 'background:start'
|
107
108
|
end
|
108
109
|
end
|
109
|
-
|
110
|
-
def add_background_process(options)
|
111
|
-
background_processes = fetch :background_processes
|
112
|
-
background_processes << options
|
113
|
-
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-background
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chen Yi-Cyuan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -95,8 +95,6 @@ files:
|
|
95
95
|
- LICENSE.txt
|
96
96
|
- README.md
|
97
97
|
- Rakefile
|
98
|
-
- bin/console
|
99
|
-
- bin/setup
|
100
98
|
- capistrano-background.gemspec
|
101
99
|
- lib/capistrano-background.rb
|
102
100
|
- lib/capistrano/background.rb
|
@@ -123,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
121
|
version: '0'
|
124
122
|
requirements: []
|
125
123
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.4.
|
124
|
+
rubygems_version: 2.4.8
|
127
125
|
signing_key:
|
128
126
|
specification_version: 4
|
129
127
|
summary: Run background process for capistrano.
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "capistrano/background"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|