Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install rbenv automatically if missing #13034

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion script/rbenv-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@
#
# Install our selected Ruby version defined in the .ruby-version file.
#
# Requires:
# Requires and tries to install if missing:
# - [rbenv](https://github.com/rbenv/rbenv#readme)
# - [ruby-build](https://github.com/rbenv/ruby-build#readme)
#
# If our ruby-build version is outdated and it can't build the version we want
# then we try upgrading ruby-build and installing again.

if ! command -v rbenv > /dev/null; then
# Install rbenv:
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
~/.rbenv/bin/rbenv init
eval "$(~/.rbenv/bin/rbenv init -)"

# Install ruby-build:
mkdir -p "$(rbenv root)"/plugins
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
fi

if rbenv install --skip-existing; then
echo "Ruby is installed."
else
Expand Down
Loading