Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 78 lines (65 sloc) 1.77 KB
#!/usr/bin/env bash
# Verify Git is installed:
if [ ! $(which git) ]; then
echo "Git is not installed, can't continue."
exit 1
fi
if [ -z "${RBENV_ROOT}" ]; then
RBENV_ROOT="$HOME/.rbenv"
fi
rbenv_git_init(){
cd $RBENV_ROOT
if [ ! -d '.git' ]; then
git init
git remote add -t $RBENV_BRANCH origin https://github.com/sstephenson/rbenv.git
git remote update origin
git checkout $RBENV_BRANCH
fi
}
# If the user hasn't specified which rbenv branch
# to install, we default to the master branch
if [ "x$RBENV_BRANCH" = "x" ]; then
RBENV_BRANCH=master
fi
# Install rbenv:
if [ ! -d "$RBENV_ROOT" ] ; then
mkdir -p $RBENV_ROOT
rbenv_git_init
else
rbenv_git_init
git pull origin $RBENV_BRANCH
fi
# If the user hasn't specified which rbenv-install branch
# to install, we default to the development branch
if [ "x$INSTALLER_BRANCH" = "x" ]; then
INSTALLER_BRANCH=develop
fi
# Install rbenv-installer
KEY=fesplugas
VALUE=rbenv-installer
RBENV_PLUGIN_ROOT="${RBENV_ROOT}/plugins/$VALUE"
if [ ! -d "$RBENV_PLUGIN_ROOT" ] ; then
# Keep downloads lean and installs fast - grab ONLY the branch we need.
mkdir -p $RBENV_PLUGIN_ROOT
cd $RBENV_PLUGIN_ROOT
git init
git remote add -t $INSTALLER_BRANCH origin https://github.com/$KEY/$VALUE.git
git remote update origin
git checkout $INSTALLER_BRANCH
else
cd $RBENV_PLUGIN_ROOT
git pull
fi
# Install plugins:
$RBENV_ROOT/plugins/$VALUE/bin/rbenv-plugins sstephenson:rbenv-vars sstephenson:ruby-build
# Show help if `.rbenv` is not in the path:
if [ ! $(which rbenv) ]; then
echo "
Seems you still have not added 'rbenv' to the load path:
export RBENV_ROOT=\"\${HOME}/.rbenv\"
if [ -d \"\${RBENV_ROOT}\" ]; then
export PATH=\"\${RBENV_ROOT}/bin:\${PATH}\"
eval \"\$(rbenv init -)\"
fi
"
fi
Something went wrong with that request. Please try again.