capistrano-opscomplete 1.2.0 → 1.3.1
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +3 -3
- data/README.md +4 -1
- data/lib/capistrano/dsl/opscomplete.rb +21 -5
- data/lib/capistrano/opscomplete/supervisor.rake +9 -0
- data/lib/capistrano/opscomplete/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a20eef8ec0a80982b18b4ce9f01d0b1596b56ae46f49ef1c8fcaf90d0172e7f0
|
4
|
+
data.tar.gz: b01fc372be74a269ff2d31e8e5f004624b45f1e42b247a8b1435c7c2ab17ec18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23d4853424d027318d5054fde4e024a849b2575b75a07ee754177a7eb43a14262bee6bcb8cb956236bccf9ea7d625d4bb42b23ec20b895499346f8c2b50b8bb7
|
7
|
+
data.tar.gz: 07ef3b9da3ec41136d4a2698e649b3413ebe035d294cb59546411a0111f571a45b9c2b64b8e542c299b7db1c033a47d1681dfcee9326db89b70389d773aa7e8b
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
capistrano-opscomplete (1.
|
4
|
+
capistrano-opscomplete (1.3.1)
|
5
5
|
capistrano (>= 3.0, < 4.0.0)
|
6
6
|
rake
|
7
7
|
|
@@ -32,7 +32,7 @@ GEM
|
|
32
32
|
parallel (1.20.1)
|
33
33
|
parser (3.0.1.1)
|
34
34
|
ast (~> 2.4.1)
|
35
|
-
rack (3.0.
|
35
|
+
rack (3.0.12)
|
36
36
|
rainbow (3.0.0)
|
37
37
|
rake (13.0.6)
|
38
38
|
rubocop (0.76.0)
|
@@ -63,4 +63,4 @@ DEPENDENCIES
|
|
63
63
|
rake (~> 13)
|
64
64
|
|
65
65
|
BUNDLED WITH
|
66
|
-
2.
|
66
|
+
2.4.22
|
data/README.md
CHANGED
@@ -52,8 +52,11 @@ And in case you enabled [`Procfile support`](https://makandracards.com/opscomple
|
|
52
52
|
e.g. like this:
|
53
53
|
|
54
54
|
```ruby
|
55
|
-
# Update
|
55
|
+
# Update supervisor config
|
56
56
|
after 'deploy:updating', 'opscomplete:supervisor:gen_config'
|
57
|
+
# Stop processes and remove config on non :procfile_role servers
|
58
|
+
after 'deploy:published', 'opscomplete:supervisor:disable'
|
59
|
+
# Restart supervisor processes
|
57
60
|
after 'deploy:published', 'opscomplete:supervisor:restart_procs'
|
58
61
|
```
|
59
62
|
|
@@ -89,32 +89,48 @@ module Capistrano
|
|
89
89
|
# 1) Get version from capistrano configuration (highest precedence, 'override')
|
90
90
|
if fetch(:opscomplete_nodejs_version)
|
91
91
|
debug("Using version from :opscomplete_nodejs_version setting: #{fetch(:opscomplete_nodejs_version)}.")
|
92
|
-
fetch(:opscomplete_nodejs_version)
|
92
|
+
app_version = fetch(:opscomplete_nodejs_version)
|
93
93
|
|
94
94
|
# 2) Get version from version file in release dir (after deploy:updating, before deploy:updated)
|
95
95
|
elsif capture(:nodejs_get_version, release_path)
|
96
96
|
debug("Using version from server's release_dir/.nvmrc, .node-version or .tool-versions file: #{capture(:nodejs_get_version, release_path)}")
|
97
|
-
capture(:nodejs_get_version, release_path)
|
97
|
+
app_version = capture(:nodejs_get_version, release_path)
|
98
98
|
|
99
99
|
else
|
100
100
|
raise Capistrano::ValidationError, 'Could not find application\'s Node.js version. Consider setting opscomplete_ruby_version.'
|
101
101
|
end
|
102
|
+
|
103
|
+
normalize_nodejs_version(app_version)
|
102
104
|
end
|
103
105
|
|
104
106
|
def nodejs_installable_versions
|
105
107
|
nodejs_installable_versions = capture(:nodejs_installable_versions).split("\n")
|
106
|
-
nodejs_installable_versions.map
|
107
|
-
nodejs_installable_versions
|
108
|
+
nodejs_installable_versions.map { |version| normalize_nodejs_version(version) }
|
108
109
|
end
|
109
110
|
|
110
111
|
def nodejs_installed_versions
|
111
112
|
nodejs_installed_versions = capture(:nodejs_installed_versions).split("\n")
|
112
|
-
nodejs_installed_versions.map
|
113
|
+
nodejs_installed_versions.map { |version| normalize_nodejs_version(version) }
|
113
114
|
end
|
114
115
|
|
115
116
|
def validation_error!(message)
|
116
117
|
raise Capistrano::ValidationError, message unless dry_run?
|
117
118
|
end
|
119
|
+
|
120
|
+
private
|
121
|
+
|
122
|
+
def normalize_nodejs_version(version)
|
123
|
+
version = version.strip
|
124
|
+
# Make sure the versions returned by our Node version manager have the same format
|
125
|
+
# as the one in our .nvmrc or .tools-versions:
|
126
|
+
#
|
127
|
+
# - In .nvmrc, we often document node versions as "1.2.3". But some people use "v1.2.3".
|
128
|
+
# - When asking NVM for Node versions, it gives us "v1.2.3".
|
129
|
+
# - When asking asdf for Node versions, it gives us "1.2.3" (without the leading "v").
|
130
|
+
version = version.sub(/\A[vV]/, '') # remove leading "v" or "V"
|
131
|
+
version
|
132
|
+
end
|
133
|
+
|
118
134
|
end
|
119
135
|
end
|
120
136
|
end
|
@@ -10,6 +10,15 @@ namespace :opscomplete do
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
desc 'Remove supervisor configuration and stop all Procfile processes on non :procfile_role servers.'
|
14
|
+
task :disable do
|
15
|
+
on roles(:all) - roles(fetch(:procfile_role, :app)) do
|
16
|
+
within release_path do
|
17
|
+
execute :supervisor_disable
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
13
22
|
desc 'Reread the supervisor configuration and (re)start all Procfile processes'
|
14
23
|
task :restart_procs do
|
15
24
|
on roles fetch(:procfile_role, :app) do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-opscomplete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Makandra Operations
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 2.0.1
|
139
139
|
requirements: []
|
140
|
-
rubygems_version: 3.
|
140
|
+
rubygems_version: 3.2.3
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: Capistrano tasks for easy deployment to a makandra opscomplete environment.
|