dlss-capistrano 6.0.0 → 6.1.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: 20a3d97e9565f6971a58b42679e428b75a5a655c84319d36adb5fa775313d580
4
- data.tar.gz: 8b41134bca260a5f4dfecee67aedc12065f4138e955e8aa24cc16ca7e5b632ac
3
+ metadata.gz: 3e1b8d438e47aeccd15dd40990abe17e81629f4d84ce51b1f51f80e977fe0cb1
4
+ data.tar.gz: 4e8cb2dc57d7504eec22095ac9208068f3679b7b38f827eeb607e32cb22f67db
5
5
  SHA512:
6
- metadata.gz: 25bcb0d23572038531ed01857cfb2eabbeae3c1cb106b40064ba97651d75cbe3ce1db988c246b99dea8545ce16dbefd8705fecaca1e84cb491c96ed458b2e0fb
7
- data.tar.gz: 64c4d15282bcde13eec411c51ffdb0652e24f137ddee94b0412f3ca11ef5fc0d0d2513280162fd5f6d833ec08c5feefb164e5cfdbea3a5856880bafec8373cfd
6
+ metadata.gz: f5c5375c551681add97ce74d86647b15db8eaa4d5c57ff5795b427a035a48ae1605a004ef43e97011b713c1d1b2a6ae09211c3e9363b568a094474e16e371e75
7
+ data.tar.gz: 3b00d0ef2a7343a58c8d6f24e06dc0d741418c6cb7f382906c4f4a3a13285cc62298c692defe5cb2b6f3ecca44e7b2de1f14bba290c437d8bfb383bb7c5e6597
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.0'
8
8
 
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.authors = ["Chris Beer", 'Mike Giarlo']
@@ -0,0 +1,84 @@
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
+ # Use Capistrano's bundler task for bundle install with fallback
54
+ info 'Running bundle install using Capistrano bundler task...'
55
+ begin
56
+ invoke! 'bundler:install'
57
+ info "Ruby #{ruby_version} installed successfully and bundle install completed!"
58
+ rescue NameError => e
59
+ warn "Bundler task not available (#{e.message}), trying manual bundle install..."
60
+ # Fallback to manual bundle install in current directory
61
+ if test("[ -f #{current_path}/Gemfile ]")
62
+ within current_path do
63
+ execute 'bundle install'
64
+ info "Ruby #{ruby_version} installed successfully and bundle install completed!"
65
+ end
66
+ else
67
+ error "Could not find Gemfile in #{current_path}. Please check your deployment configuration."
68
+ exit 1
69
+ end
70
+ end
71
+ end
72
+ end
73
+
74
+ desc 'Install Ruby version from environment variable RUBY_VERSION'
75
+ task :install_with_env do
76
+ ruby_version = ENV.fetch('RUBY_VERSION', nil)
77
+ if ruby_version.nil? || ruby_version.empty?
78
+ error 'RUBY_VERSION environment variable is required. Usage: RUBY_VERSION=ruby-3.1.0 cap stage ruby:install_with_env'
79
+ exit 1
80
+ end
81
+ invoke 'ruby:install', ruby_version
82
+ end
83
+ end
84
+ 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.0
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