ndr_dev_support 7.2.5 → 7.3.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 +8 -0
- data/lib/ndr_dev_support/capistrano/assets.rb +2 -2
- data/lib/ndr_dev_support/capistrano/install_ruby.rb +103 -0
- data/lib/ndr_dev_support/capistrano/ndr_model.rb +2 -1
- data/lib/ndr_dev_support/capistrano/standalone_gems.rb +0 -2
- data/lib/ndr_dev_support/version.rb +1 -1
- data/ndr_dev_support.gemspec +2 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41d7ba2652d9fa563d40304d74636a120fabce678f2dac3247be956ab448e477
|
4
|
+
data.tar.gz: 52be1d6408975a0777733c5ab9007098ffe2128360b00f13857c591ac051a0db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d83ee219968cfbffb0f3b2eb9615442c595d6013ba1e0c21f04421197cc68dd94df9338e152922b1e39a566dd4ce7a35543c9672eb6b21548f3f80688b82610a
|
7
|
+
data.tar.gz: fc6eb48554bd132c6bc9bf852ca5d708baaae03c61e36a0dfd8880665d3859418d3ba28a179939a801ba9262c956c41b5db06e5c8f11fd904da7870499c5138f
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
*no unreleased changes*
|
3
3
|
|
4
|
+
## 7.3.0 / 2024-12-19
|
5
|
+
### Added
|
6
|
+
* Capistrano: install rbenv and ruby from /opt/rbenv.tar.gz or vendor/rbenv/
|
7
|
+
|
8
|
+
## 7.2.6 / 2024-11-13
|
9
|
+
### Fixed
|
10
|
+
* Support Rails 7.2, 8.0, Ruby 3.3
|
11
|
+
|
4
12
|
## 7.2.5 / 2024-10-24
|
5
13
|
### Changed
|
6
14
|
* Capistrano: fix up installed gem permissions after deployment.
|
@@ -4,8 +4,8 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
4
4
|
task :configure_assets do
|
5
5
|
asset_script = fetch(:asset_script, <<~SHELL)
|
6
6
|
set -e
|
7
|
-
ruby -
|
8
|
-
ruby -
|
7
|
+
ruby -e "require 'yaml'; puts YAML.dump('production' => { 'secret_key_base' => 'compile_me' })" > config/secrets.yml
|
8
|
+
ruby -e "require 'yaml'; puts YAML.dump('production' => { 'adapter' => 'placeholder' })" > config/database.yml
|
9
9
|
RAILS_ENV=production bundle exec rake assets:clobber assets:precompile
|
10
10
|
rm config/secrets.yml config/database.yml
|
11
11
|
SHELL
|
@@ -0,0 +1,103 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
namespace :ndr_dev_support do
|
3
|
+
desc <<~DESC
|
4
|
+
Ensure that the required ruby version is installed.
|
5
|
+
|
6
|
+
This can be installed from /opt/rbenv.tar.gz (first installation only) or vendor/rbenv/
|
7
|
+
|
8
|
+
To place an offline copy of rbenv in /opt/rbenv.tar.gz
|
9
|
+
For ruby 3.1.6, run the following commands:
|
10
|
+
$ mkdir clone_rbenv
|
11
|
+
$ git clone https://github.com/rbenv/rbenv.git clone_rbenv/.rbenv
|
12
|
+
$ git clone https://github.com/rbenv/ruby-build.git clone_rbenv/.rbenv/plugins/ruby-build
|
13
|
+
$ mkdir clone_rbenv/.rbenv/cache
|
14
|
+
$ (cd clone_rbenv/.rbenv/cache; curl -O https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.6.tar.gz)
|
15
|
+
$ (cd clone_rbenv; rm -f ../rbenv.tar.gz; tar czf ../rbenv.tar.gz .rbenv)
|
16
|
+
$ rm -rf clone_rbenv
|
17
|
+
$ scp -p rbenv.tar.gz app-server:/opt/rbenv.tar.gz
|
18
|
+
|
19
|
+
To add rbenv, ruby-build and additional ruby versions to the application vendor directory
|
20
|
+
For ruby 3.2.6:
|
21
|
+
$ mkdir clone_rbenv
|
22
|
+
$ git clone https://github.com/rbenv/rbenv.git clone_rbenv/.rbenv
|
23
|
+
$ mkdir -p vendor/rbenv; rm -f vendor/rbenv/rbenv.tar.gz
|
24
|
+
$ tar czf vendor/rbenv/rbenv.tar.gz -C clone_rbenv .rbenv
|
25
|
+
$ rm -rf clone_rbenv
|
26
|
+
$ mkdir clone_ruby-build
|
27
|
+
$ git clone https://github.com/rbenv/ruby-build.git clone_ruby-build/ruby-build
|
28
|
+
$ mkdir -p vendor/rbenv/cache; rm -f vendor/rbenv/ruby-build.tar.gz
|
29
|
+
$ tar czf vendor/rbenv/ruby-build.tar.gz -C clone_ruby-build ruby-build
|
30
|
+
$ rm -rf clone_ruby-build
|
31
|
+
$ (cd vendor/rbenv/cache; curl -O https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.6.tar.gz)
|
32
|
+
$ git add vendor/rbenv/{rbenv,ruby-build}.tar.gz vendor/rbenv/cache/*
|
33
|
+
DESC
|
34
|
+
task :install_ruby do
|
35
|
+
version = fetch(:ruby)
|
36
|
+
# Note that ruby 3.1.x on CentOS 7 generally installs successfully but then reports an error:
|
37
|
+
# ERROR: While executing gem ... (URI::InvalidURIError)
|
38
|
+
# bad URI(is not URI?): "bundler\r"
|
39
|
+
# For this reason, we ignore the exit status, and run our own test.
|
40
|
+
#
|
41
|
+
# For some reason, SSH keepalive options have no effect with capistrano 2 and net-ssh 7.
|
42
|
+
# So we run a poor-man's keepalive, because this installation can take over 10 minutes
|
43
|
+
# and some of our SSH servers disconnect inactive sessions after 5 minutes.
|
44
|
+
# We have a keepalive time limit of 40 minutes in case the installation fails unexpectedly.
|
45
|
+
#
|
46
|
+
# We remove ~/.rbenv paths from capistrano-defined PATH when running `rbenv init`
|
47
|
+
# so that it knows the path is needed in ~/.bash_profile
|
48
|
+
#
|
49
|
+
# We use latest_release: this is broadly well-defined, and will point to the in-progress
|
50
|
+
# release if we're part way through a deployment, or the most recent release if run
|
51
|
+
# after a deployment has happened, or be blank if attempted after cap deploy:setup
|
52
|
+
run <<~SHELL
|
53
|
+
set -e;
|
54
|
+
if ! rbenv versions --bare 2> /dev/null | grep -q ^#{Regexp.escape(version)}$; then
|
55
|
+
echo Installing ruby #{version};
|
56
|
+
{ sleep 10; for i in `seq 1 80`; do echo -n '.'; sleep 30; done & } 2> /dev/null;
|
57
|
+
sudo -i -n -u #{fetch(:application_user)} sh -c "
|
58
|
+
if [ ! -e .rbenv ] && [ -e /opt/rbenv.tar.gz ]; then
|
59
|
+
tar xf /opt/rbenv.tar.gz .rbenv;
|
60
|
+
PATH=\\`echo \\"\\$PATH\\"|sed -e \\"s_[^:=]*/[.]rbenv[^:]*:__g\\"\\` .rbenv/bin/rbenv init bash;
|
61
|
+
fi;
|
62
|
+
if [ ! -e .rbenv ] && [ -f #{latest_release}/vendor/rbenv/rbenv.tar.gz ]; then
|
63
|
+
tar xf #{latest_release}/vendor/rbenv/rbenv.tar.gz .rbenv;
|
64
|
+
PATH=\\`echo \\"\\$PATH\\"|sed -e \\"s_[^:=]*/[.]rbenv[^:]*:__g\\"\\` .rbenv/bin/rbenv init bash;
|
65
|
+
fi;
|
66
|
+
if [ ! -e .rbenv ]; then
|
67
|
+
echo rbenv not installed: aborting;
|
68
|
+
else
|
69
|
+
if [ -d #{latest_release}/vendor/rbenv/cache ] && [ -n \\"\\`ls #{latest_release}/vendor/rbenv/cache\\`\\" ]; then
|
70
|
+
mkdir -p .rbenv/cache/;
|
71
|
+
cp -nvp #{latest_release}/vendor/rbenv/cache/* .rbenv/cache/;
|
72
|
+
fi;
|
73
|
+
if [ -f #{latest_release}/vendor/rbenv/ruby-build.tar.gz ]; then
|
74
|
+
mkdir -p .rbenv/plugins/;
|
75
|
+
tar xf #{latest_release}/vendor/rbenv/ruby-build.tar.gz -C .rbenv/plugins/ ruby-build;
|
76
|
+
fi;
|
77
|
+
eval \\"\\$(.rbenv/bin/rbenv init - --no-rehash bash)\\";
|
78
|
+
export TMPDIR=\\`mktemp -d \\"\\$HOME\\"/rbenv_tmp_XXXX\\`;
|
79
|
+
if rbenv install #{version} --skip-existing 2>&1; then
|
80
|
+
RBENV_VERSION=#{version} ruby --version;
|
81
|
+
rm -rf \\"\\`printenv TMPDIR\\`\\";
|
82
|
+
rbenv global #{version};
|
83
|
+
fi;
|
84
|
+
fi;
|
85
|
+
";
|
86
|
+
{ kill % && wait; } 2> /dev/null;
|
87
|
+
set -e;
|
88
|
+
if [ "`RBENV_VERSION=#{version} gem list --exact --installed bundler`" == "true" ]; then
|
89
|
+
echo 'Please ignore the following error above:';
|
90
|
+
echo '> ERROR: While executing gem ... (URI::InvalidURIError)';
|
91
|
+
echo '> bad URI(is not URI?): "bundler\\r"';
|
92
|
+
echo Successfully installed ruby #{version};
|
93
|
+
else
|
94
|
+
echo ERROR: Failure installing ruby #{version}: aborting;
|
95
|
+
exit 1;
|
96
|
+
fi;
|
97
|
+
fi
|
98
|
+
SHELL
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
before 'bundle:install', 'ndr_dev_support:install_ruby'
|
103
|
+
end
|
@@ -2,6 +2,7 @@ require 'rainbow'
|
|
2
2
|
|
3
3
|
# Discrete bits of functionality we use automatically:
|
4
4
|
require_relative 'assets'
|
5
|
+
require_relative 'install_ruby'
|
5
6
|
require_relative 'restart'
|
6
7
|
require_relative 'revision_logger'
|
7
8
|
require_relative 'ruby_version'
|
@@ -172,7 +173,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
172
173
|
end
|
173
174
|
|
174
175
|
def release_config_for(env)
|
175
|
-
branches = YAML.
|
176
|
+
branches = YAML.safe_load_file('config/deployments.yml', permitted_classes: [Date])
|
176
177
|
branches.fetch(env.to_s) { raise 'Unknown release branch!' }
|
177
178
|
end
|
178
179
|
|
@@ -21,8 +21,6 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
21
21
|
'gem install'
|
22
22
|
end
|
23
23
|
|
24
|
-
# TODO: Add `gem install bundler`, move this to before bundle:install instead of after
|
25
|
-
|
26
24
|
# Extract the current version requirements for each of the gems from the lockfile,
|
27
25
|
# and then check they're installed. If not, install them from the vendored cache.
|
28
26
|
run <<~CMD if gem_list.any?
|
data/ndr_dev_support.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_dependency 'pry'
|
26
26
|
|
27
27
|
# Audit dependencies:
|
28
|
+
spec.add_dependency 'csv'
|
28
29
|
spec.add_dependency 'highline', '>= 1.6.0'
|
29
30
|
|
30
31
|
# Rubocop dependencies:
|
@@ -43,7 +44,7 @@ Gem::Specification.new do |spec|
|
|
43
44
|
spec.add_dependency 'show_me_the_cookies'
|
44
45
|
|
45
46
|
# CI server dependencies:
|
46
|
-
spec.add_dependency 'activesupport', '>= 6.1', '<
|
47
|
+
spec.add_dependency 'activesupport', '>= 6.1', '< 8.1'
|
47
48
|
spec.add_dependency 'brakeman', '>= 4.7.1'
|
48
49
|
spec.add_dependency 'bundler-audit'
|
49
50
|
spec.add_dependency 'github-linguist'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ndr_dev_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NCRS Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: csv
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: highline
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,7 +215,7 @@ dependencies:
|
|
201
215
|
version: '6.1'
|
202
216
|
- - "<"
|
203
217
|
- !ruby/object:Gem::Version
|
204
|
-
version: '
|
218
|
+
version: '8.1'
|
205
219
|
type: :runtime
|
206
220
|
prerelease: false
|
207
221
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -211,7 +225,7 @@ dependencies:
|
|
211
225
|
version: '6.1'
|
212
226
|
- - "<"
|
213
227
|
- !ruby/object:Gem::Version
|
214
|
-
version: '
|
228
|
+
version: '8.1'
|
215
229
|
- !ruby/object:Gem::Dependency
|
216
230
|
name: brakeman
|
217
231
|
requirement: !ruby/object:Gem::Requirement
|
@@ -395,6 +409,7 @@ files:
|
|
395
409
|
- lib/minitest/rake_ci_plugin.rb
|
396
410
|
- lib/ndr_dev_support.rb
|
397
411
|
- lib/ndr_dev_support/capistrano/assets.rb
|
412
|
+
- lib/ndr_dev_support/capistrano/install_ruby.rb
|
398
413
|
- lib/ndr_dev_support/capistrano/ndr_model.rb
|
399
414
|
- lib/ndr_dev_support/capistrano/restart.rb
|
400
415
|
- lib/ndr_dev_support/capistrano/revision_logger.rb
|