Update to handle when things are already installed
This commit is contained in:
parent
149cfb250d
commit
747721bf11
|
@ -12,21 +12,29 @@ if ! command -v curl &> /dev/null; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
|
if [ ! -d "$HOME/.rbenv" ]; then
|
||||||
cd ~/.rbenv && src/configure && make -C src
|
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
|
||||||
echo "export PATH=\"\$HOME/.rbenv/bin:\$PATH\"" >> ~/.bashrc
|
cd ~/.rbenv && src/configure && make -C src
|
||||||
echo "eval \"\$(rbenv init -)\"" >> ~/.bashrc
|
echo "export PATH=\"\$HOME/.rbenv/bin:\$PATH\"" >> ~/.bashrc
|
||||||
# shellcheck source=/dev/null
|
echo "eval \"\$(rbenv init -)\"" >> ~/.bashrc
|
||||||
source ~/.bashrc
|
# shellcheck source=/dev/null
|
||||||
|
source ~/.bashrc
|
||||||
|
else
|
||||||
|
echo "rbenv is already installed."
|
||||||
|
fi
|
||||||
|
|
||||||
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
|
if [ ! -d "$HOME/.rbenv/plugins/ruby-build" ]; then
|
||||||
echo "export PATH=\"\$HOME/.rbenv/plugins/ruby-build/bin:\$PATH\"" >> ~/.bashrc
|
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
|
||||||
# shellcheck source=/dev/null
|
echo "export PATH=\"\$HOME/.rbenv/plugins/ruby-build/bin:\$PATH\"" >> ~/.bashrc
|
||||||
source ~/.bashrc
|
# shellcheck source=/dev/null
|
||||||
|
source ~/.bashrc
|
||||||
|
else
|
||||||
|
echo "ruby-build is already installed."
|
||||||
|
fi
|
||||||
|
|
||||||
# Get the latest 5 Ruby versions
|
# Get the latest 5 Ruby versions
|
||||||
echo "Fetching latest Ruby versions..."
|
echo "Fetching latest Ruby versions..."
|
||||||
VERSIONS=$(rbenv install -l | grep -E "^\s*\d+\.\d+\.\d+$" | tail -n 5)
|
VERSIONS=$(rbenv install -l 2>/dev/null | grep -E "^\s*\d+\.\d+\.\d+$" | tail -n 5)
|
||||||
|
|
||||||
# Present the user with options
|
# Present the user with options
|
||||||
echo "Please select a Ruby version to install:"
|
echo "Please select a Ruby version to install:"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user