capistrano-pm2 1.0.4 → 1.0.5

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: e7fc73b9347c0362e4cc28f993d58d47f5331bb0
4
- data.tar.gz: 242a27205de8cef7f283dc9d6366cd8cd77a02f5
3
+ metadata.gz: 563568286ec77bdb5708e62b3f1fda71ac5c3623
4
+ data.tar.gz: 5e138cd5f54a7da45fb9f39feb5ea246b85dd0b3
5
5
  SHA512:
6
- metadata.gz: b9e06fdc349a55468d498b145ce9e13f0f7c525653477caf8ee4c6b683545e9f5557a6f30cf059c7551195a4755b57cd6e7809de61d445fddcdd7650ec0f6d9e
7
- data.tar.gz: 7b8a7481deb4d2143dc00c2da41be377840cbcdef25595580c92d99186c86be61f57feb86dd0ebaef2aa94500e540a968dc5e6172abbceb08f23be5a5520ed98
6
+ metadata.gz: 4580848f12a2f09669cc7644f731e352d6b8952141f9a95a9930963ee3b98a817ef6d92169c350b2c3dcf5d80fa157a3cdf28e1f4295bbbb0251599acaa1d765
7
+ data.tar.gz: 759cd11aa69106de8719e67adcf4bcc6a570ade103da194a139451419e0d6b41c1460ef8c09c7719e4737d682b7e0eaeb9c9f989d523b6783f9fcb7ee2ac008c
data/README.md CHANGED
@@ -52,16 +52,17 @@ cap pm2:setup # Install pm2 via npm on the remote host
52
52
  cap pm2:start # Start pm2 application
53
53
  cap pm2:status # List all pm2 applications
54
54
  cap pm2:stop # Stop pm2 application
55
+ cap pm2:save # Save pm2 state so it can be loaded after restart
55
56
  ```
56
57
 
57
58
  Configurable options:
58
59
  ```ruby
59
- set :pm2_app_command, 'main.js' # default, runs main.js
60
- set :pm2_app_name, nil # app name for pm2, default cap :application
61
- set :pm2_target_path, -> { release_path.join('subdir') } # default not set
62
- set :pm2_roles, :all # default, cap roles to run on
63
- set :pm2_env_variables, {} # default, env vars for pm2
64
- set :pm2_start_params, '' # default, pm2 start params see http://pm2.keymetrics.io/docs/usage/quick-start/#cheat-sheet
60
+ set :pm2_app_command, 'main.js' # the main program
61
+ set :pm2_app_name, fetch(:application) # name for pm2 app
62
+ set :pm2_target_path, -> { release_path } # where to run pm2 commands
63
+ set :pm2_roles, :all # server roles where pm2 runs on
64
+ set :pm2_env_variables, {} # default: env vars for pm2
65
+ set :pm2_start_params, '' # pm2 start params see http://pm2.keymetrics.io/docs/usage/quick-start/#cheat-sheet
65
66
  ```
66
67
 
67
68
  ## Contributing
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'capistrano-pm2'
7
- spec.version = '1.0.4'
7
+ spec.version = '1.0.5'
8
8
  spec.authors = ['Tom Hanoldt']
9
9
  spec.email = ['monotom@gmail.com']
10
10
  spec.description = 'nodejs pm2 support for Capistrano 3.x'
@@ -68,24 +68,28 @@ namespace :pm2 do
68
68
  end
69
69
 
70
70
  def app_status
71
- within current_path do
72
- ps = JSON.parse(capture :pm2, :jlist)
73
-
74
- # find the process with our app name
75
- ps.each do |child|
76
- if child['name'] == app_name
77
- # status: online, errored, stopped
78
- return child['pm2_env']['status']
71
+ within release_path do
72
+ with fetch(:pm2_env_variables) do
73
+ ps = JSON.parse(capture :pm2, :jlist, :'-s')
74
+
75
+ # find the process with our app name
76
+ ps.each do |child|
77
+ if child['name'] == app_name
78
+ # status: online, errored, stopped
79
+ return child['pm2_env']['status']
80
+ end
79
81
  end
80
- end
81
82
 
82
- return nil
83
+ return nil
84
+ end
83
85
  end
84
86
  end
85
87
 
86
88
  def restart_app
87
- within current_path do
88
- execute :pm2, :restart, app_name
89
+ within release_path do
90
+ with fetch(:pm2_env_variables) do
91
+ execute :pm2, :restart, app_name
92
+ end
89
93
  end
90
94
  end
91
95
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-pm2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Hanoldt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-22 00:00:00.000000000 Z
11
+ date: 2017-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  requirements: []
90
90
  rubyforge_project:
91
- rubygems_version: 2.4.6
91
+ rubygems_version: 2.6.11
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: nodejs pm2 support for Capistrano 3.x