capistrano-opscomplete 1.2.0 → 1.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1dc8672500d3727450f6cd8c1f9c5147075eaca449a70d98c80bd9e62d4d2d6c
4
- data.tar.gz: 169c87773b79febd6c15ab73a0273684f415827d44ebe5316abc4dd42b5f8971
3
+ metadata.gz: 41def2299510940af3ecf7d7400f1ffdedd794bbc75ff1b76f02925daec96b0e
4
+ data.tar.gz: 3c817b17846045ab58c6a0c8fe6a8b31752de7844ffd1edd1fca4c89dc29df25
5
5
  SHA512:
6
- metadata.gz: d70ce60b0bfd31c95d8fa145a1c7c9a9e00f96be9757eb8b8c025a7fc86a5dff79eefa0a1e79aafbc1bca106239d0c1e94f869d7091e80343f5b55f2ba893de1
7
- data.tar.gz: 8d8d31c2445212faf6bdc05b83a299bbb3bf7eec9ab3360f0b6abad77c7628cbbb1773e31eddff3baa5e5a6f823bab9b9cd6d57740e6ea4e30f835adf29c738a
6
+ metadata.gz: ec6794d100216b3fc49673a4e8e2a10f70ef434c2669ca88f563d206f63a41db4adedfb10a0bbbf655af4ef176bd68bb8c8a420d02bcf85fd438095eba394346
7
+ data.tar.gz: 1c0df6d6780d8141557894d56bad781b0125fbf82a7c7d41585c651871c0d1f2e48f3c3c9fc8af31750fe99c64c0421f3c4f1de3a7d976e84894134f951f7972
@@ -8,7 +8,7 @@ on:
8
8
 
9
9
  jobs:
10
10
  test:
11
- runs-on: ubuntu-20.04
11
+ runs-on: ubuntu-24.04
12
12
  strategy:
13
13
  fail-fast: false
14
14
  matrix:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## [1.4.0] - 2025-11-11
2
+ ### Added
3
+ - Extended `opscomplete:nodejs:ensure` task with option to manage and install `corepack`
4
+ - Fixed Node.js version missing error message
5
+
6
+ ## [1.3.1] - 2025-03-07
7
+ ### Fixed
8
+ - Fix error with nvm: "Configured Node.js version: X.Y.Z is not installable"
9
+
10
+ ## [1.3.0] - 2025-02-18
11
+ ### Added
12
+ - Add new capistrano task (`opscomplete:supervisor:disable`) which disables supervisor on non-procfile servers
13
+
1
14
  ## [1.2.0] - 2024-08-23
2
15
  ### Changed
3
16
  - Added a feature to restart Puma
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-opscomplete (1.2.0)
4
+ capistrano-opscomplete (1.4.0)
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.9.1)
35
+ rack (3.1.18)
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.3.10
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 and Restart supervisor config
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
 
@@ -179,6 +182,18 @@ after 'deploy:published', 'opscomplete:puma:reload'
179
182
 
180
183
  The version for the NodeJS installation has to be a specific version and not a floating version like, e.g. lts/gallium.
181
184
 
185
+ ### Using Corepack
186
+
187
+ You may use Corepack to control your project's package manager, e.g. to use a modern version of Yarn or pnpm.
188
+
189
+ `capistrano-opscomplete` can install and enable Corepack for you during deployment. To do so, set the version with `:opscomplete_corepack_version` in your capistrano configuration. Then, add a [hook](#using-capistrano-hooks) in your capistrano configuration (e.g. `deploy.rb`), for example:
190
+
191
+ ```ruby
192
+ set :opscomplete_corepack_version, 'latest'
193
+
194
+ after 'deploy:updating', 'opscomplete:nodejs:ensure'
195
+ ```
196
+
182
197
  ## Contributing
183
198
 
184
199
  Bug reports and pull requests are welcome. Don't hesitate to [open a new issue](https://github.com/makandra/capistrano-opscomplete/issues/new).
@@ -89,32 +89,60 @@ 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
- raise Capistrano::ValidationError, 'Could not find application\'s Node.js version. Consider setting opscomplete_ruby_version.'
100
+ raise Capistrano::ValidationError, 'Could not find application\'s Node.js version. Consider setting opscomplete_nodejs_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!(&:strip)
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!(&:strip)
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
+ def app_corepack_version
121
+ if fetch(:opscomplete_corepack_version)
122
+ debug("Using version from :opscomplete_corepack_version setting: #{fetch(:opscomplete_corepack_version)}.")
123
+ corepack_version = fetch(:opscomplete_corepack_version)
124
+
125
+ else
126
+ corepack_version = nil
127
+ end
128
+
129
+ corepack_version
130
+ end
131
+
132
+ private
133
+
134
+ def normalize_nodejs_version(version)
135
+ version = version.strip
136
+ # Make sure the versions returned by our Node version manager have the same format
137
+ # as the one in our .nvmrc or .tools-versions:
138
+ #
139
+ # - In .nvmrc, we often document node versions as "1.2.3". But some people use "v1.2.3".
140
+ # - When asking NVM for Node versions, it gives us "v1.2.3".
141
+ # - When asking asdf for Node versions, it gives us "1.2.3" (without the leading "v").
142
+ version = version.sub(/\A[vV]/, '') # remove leading "v" or "V"
143
+ version
144
+ end
145
+
118
146
  end
119
147
  end
120
148
  end
@@ -49,6 +49,9 @@ namespace :opscomplete do
49
49
  validation_error!("#{host}: Configured Node.js version: #{app_nodejs_version} is not installable.")
50
50
  end
51
51
  execute(:nodejs_set_version, "'#{app_nodejs_version}'")
52
+ unless app_corepack_version.nil?
53
+ execute(:nodejs_install_corepack_version, "'#{app_corepack_version}'")
54
+ end
52
55
  end
53
56
  end
54
57
  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
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Opscomplete
3
- VERSION = '1.2.0'.freeze
3
+ VERSION = '1.4.0'.freeze
4
4
  end
5
5
  end
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.2.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Makandra Operations
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-23 00:00:00.000000000 Z
11
+ date: 2025-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -86,7 +86,7 @@ dependencies:
86
86
  - - "<"
87
87
  - !ruby/object:Gem::Version
88
88
  version: 4.0.0
89
- description:
89
+ description:
90
90
  email:
91
91
  - ops@makandra.de
92
92
  executables: []
@@ -122,7 +122,7 @@ metadata:
122
122
  bug_tracker_uri: https://github.com/makandra/capistrano-opscomplete/issues
123
123
  changelog_uri: https://github.com/makandra/capistrano-opscomplete/blob/master/CHANGELOG.md
124
124
  source_code_uri: https://github.com/makandra/capistrano-opscomplete
125
- post_install_message:
125
+ post_install_message:
126
126
  rdoc_options: []
127
127
  require_paths:
128
128
  - lib
@@ -137,8 +137,8 @@ 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.4.6
141
- signing_key:
140
+ rubygems_version: 3.0.3
141
+ signing_key:
142
142
  specification_version: 4
143
143
  summary: Capistrano tasks for easy deployment to a makandra opscomplete environment.
144
144
  test_files: []