Skip to content

Instantly share code, notes, and snippets.

@thbar
Created November 14, 2018 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thbar/b9d463277411ec9468c10d6dc252a24f to your computer and use it in GitHub Desktop.
Save thbar/b9d463277411ec9468c10d6dc252a24f to your computer and use it in GitHub Desktop.
variable_based_ruby_version_override_in_capistrano.rb
set :rvm_ruby_version do
fetch(:override_rvm_ruby_version, IO.read('.ruby-version').strip)
end
after 'deploy:updating', 'custom:tweak_ruby_version' do
ruby_version = fetch(:override_rvm_ruby_version, nil)
next unless ruby_version
on roles :all do
info "Overwriting .ruby-version with #{ruby_version.inspect}"
content = StringIO.new(ruby_version)
upload! content, File.join(fetch(:release_path), '.ruby-version')
end
end
set :override_rvm_ruby_version, 'jruby-9.2.4.0'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment