capistrano / capistrano/rbenv

rbenv:install task?

Open
#83 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
217
Forks
59
PR merge metrics
No merged PRs in 30d

Description

Because of the nth time installing rbenv manually I wrote the following lines, which adds cap #{env} rbenv:install to the list of available tasks. It may relate to this request (never tried the 2.x version): https://github.com/capistrano/rbenv/issues/51

```ruby
namespace :rbenv do
desc 'Install rbenv'
task :install do
on roles(:web) do
begin
execute "git clone https://github.com/rbenv/rbenv.git #{fetch(:rbenv_path)}"
rescue SSHKit::Command::Failed
puts "rbenv already installed, updating..."
execute "cd #{fetch(:rbenv_path)} && git pull"
end
# execute "~/.rbenv/bin/rbenv init"
execute "mkdir -p #{fetch(:rbenv_path)}/plugins"
begin
execute "git clone https://github.com/rbenv/ruby-build.git #{fetch(:rbenv_path)}/plugins/ruby-build"
rescue SSHKit::Command::Failed
puts "rbenv/ruby-build plugin already installed, updating..."
execute "cd #{fetch(:rbenv_path)}/plugins/ruby-build && git pull"
end
rbenv_ruby = File.read('.ruby-version').strip
execute "#{fetch(:rbenv_path)}/bin/rbenv install -s #{fetch(:rbenv_ruby)||rbenv_ruby}"
execute "#{fetch(:rbenv_path)}/bin/rbenv global #{fetch(:rbenv_ruby)||rbenv_ruby}"
execute "#{fetch(:rbenv_path)}/shims/gem install bundler --no-document"
if fetch(:rbenv_ruby).nil?
puts "\nPlease uncomment the line `# set :rbenv_ruby, File.read('.ruby-version').strip` to enable capistrano rbenv"
end
end
end
end
```

I'm happy to prepare a pull request...

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the repository's existing task definitions and the related request in issue #51. Compare the proposed rbenv:install entry point with the project's task conventions, then verify that it installs or updates rbenv and ruby-build and selects the requested Ruby version as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
devops
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.