dlss-capistrano 6.0.0 → 6.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20a3d97e9565f6971a58b42679e428b75a5a655c84319d36adb5fa775313d580
4
- data.tar.gz: 8b41134bca260a5f4dfecee67aedc12065f4138e955e8aa24cc16ca7e5b632ac
3
+ metadata.gz: 3a3fc8f6f6778e843f63175f39f76caee101089c48054ff5bb4248a0e6982d5c
4
+ data.tar.gz: b047fbcf6b0c092acb49b5e33b05793d310e9cb8f60fa0477438bf116c022a61
5
5
  SHA512:
6
- metadata.gz: 25bcb0d23572038531ed01857cfb2eabbeae3c1cb106b40064ba97651d75cbe3ce1db988c246b99dea8545ce16dbefd8705fecaca1e84cb491c96ed458b2e0fb
7
- data.tar.gz: 64c4d15282bcde13eec411c51ffdb0652e24f137ddee94b0412f3ca11ef5fc0d0d2513280162fd5f6d833ec08c5feefb164e5cfdbea3a5856880bafec8373cfd
6
+ metadata.gz: 0dde03d3c7b1e27dfe4e0d05eb8d57328acecdfa3980a4234b6b3b10e7d1aa1c88107055680ddecd70028c3d164b271f2110030a894aa7785e6ad97fc8c4bddb
7
+ data.tar.gz: 8ccd8ff8976a5003d43ce623686dd2f6cf6886318ba5096facf4200509fb6c2f09503b3cf6c9fff9006a6dbde21f06121edb6eb7740b38ba1d2124669a4d2e98
data/README.md CHANGED
@@ -89,6 +89,12 @@ These tasks are intended to replace those provided by `capistrano-sidekiq` gem,
89
89
 
90
90
  `cap ENV racecar_systemd:{stop,start,restart}`: stops, starts, restarts Racecar via systemd.
91
91
 
92
+ ### Ruby install
93
+ This is useful for upgrading to a new version of Ruby and ensuring the bundle is installed, before switching
94
+ the application server to default to the new Ruby version.
95
+
96
+ `cap ENV "dlss:ruby:install:[ruby-4.0.0]`: installs or updates Ruby via rvm.
97
+
92
98
  #### Capistrano role
93
99
 
94
100
  The sidekiq_systemd tasks assume a Capistrano role of `:app`. If your application uses a different Capistrano role for hosts that run Sidekiq workers, you can configure this in `config/deploy.rb`, _e.g._:
@@ -4,7 +4,7 @@ $:.unshift lib unless $:.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "dlss-capistrano"
7
- s.version = '6.0.0'
7
+ s.version = '6.1.1'
8
8
 
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.authors = ["Chris Beer", 'Mike Giarlo']
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :dlss do
4
+ namespace :ruby do
5
+ desc 'Install a specific Ruby version using RVM and run bundle install'
6
+ task :install, :version do |_task, args|
7
+ on roles(:app) do
8
+ ruby_version = args[:version]
9
+
10
+ if ruby_version.nil? || ruby_version.empty?
11
+ error <<~ERROR
12
+ Ruby version is required.
13
+
14
+ Usage examples:
15
+ cap stage dlss:ruby:install[ruby-3.1.0] # Basic usage
16
+ cap stage "dlss:ruby:install[ruby-3.1.0]" # Quoted (recommended for zsh)
17
+ RUBY_VERSION=ruby-3.1.0 cap stage dlss:ruby:install_with_env
18
+ ERROR
19
+ exit 1
20
+ end
21
+
22
+ info "Installing Ruby #{ruby_version} using RVM..."
23
+
24
+ # Check if RVM is installed
25
+ rvm_installed = test('which rvm') || test('[ -s "$HOME/.rvm/scripts/rvm" ]') || test('command -v rvm')
26
+
27
+ unless rvm_installed
28
+ error <<~ERROR
29
+ RVM is not installed on the remote server.
30
+
31
+ To install RVM first, run:
32
+ \\curl -sSL https://get.rvm.io | bash -s stable
33
+
34
+ Then logout and login again, or source the RVM script manually.
35
+ ERROR
36
+ exit 1
37
+ end
38
+
39
+ # Try to source RVM if it exists
40
+ if test('[ -s "$HOME/.rvm/scripts/rvm" ]')
41
+ execute 'source ~/.rvm/scripts/rvm'
42
+ elsif test('[ -s "/etc/profile.d/rvm.sh" ]')
43
+ execute 'source /etc/profile.d/rvm.sh'
44
+ end
45
+
46
+ # Install the Ruby version
47
+ info "Installing Ruby #{ruby_version}..."
48
+ execute "rvm install #{ruby_version}"
49
+
50
+ info "Setting Ruby #{ruby_version} as current..."
51
+ execute "rvm use #{ruby_version}"
52
+
53
+ # We can't use capistraino-bundler task because it starts a new shell where rvm hasn't been used.
54
+ info 'Running bundle install...'
55
+ if test("[ -f #{current_path}/Gemfile ]")
56
+ within current_path do
57
+ execute :bundle, :install
58
+ info "Ruby #{ruby_version} installed successfully and bundle install completed!"
59
+ end
60
+ else
61
+ error "Could not find Gemfile in #{current_path}. Please check your deployment configuration."
62
+ exit 1
63
+ end
64
+ end
65
+ end
66
+
67
+ desc 'Install Ruby version from environment variable RUBY_VERSION'
68
+ task :install_with_env do
69
+ ruby_version = ENV.fetch('RUBY_VERSION', nil)
70
+ if ruby_version.nil? || ruby_version.empty?
71
+ error 'RUBY_VERSION environment variable is required. Usage: RUBY_VERSION=ruby-3.1.0 cap stage ruby:install_with_env'
72
+ exit 1
73
+ end
74
+ invoke 'ruby:install', ruby_version
75
+ end
76
+ end
77
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dlss-capistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
@@ -102,6 +102,7 @@ files:
102
102
  - lib/dlss/capistrano/tasks/check_status.rake
103
103
  - lib/dlss/capistrano/tasks/control_master.rake
104
104
  - lib/dlss/capistrano/tasks/deployed_branch.rake
105
+ - lib/dlss/capistrano/tasks/install_ruby.rake
105
106
  - lib/dlss/capistrano/tasks/racecar_systemd.rake
106
107
  - lib/dlss/capistrano/tasks/remote_execute.rake
107
108
  - lib/dlss/capistrano/tasks/setup/setup.rake