Skip to content

Instantly share code, notes, and snippets.

@larrybotha
Forked from sdbondi/install_rbenv.sh
Last active August 29, 2015 14:27
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 larrybotha/aff517478a1419a5af5a to your computer and use it in GitHub Desktop.
Save larrybotha/aff517478a1419a5af5a to your computer and use it in GitHub Desktop.
Install our development ruby environment
#!/usr/bin/env bash
set -eo pipefail
# Install rbenv
if [[ ! -d ~/.rbenv ]]; then
echo "Installing rbenv"
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
if [[ ! `grep 'eval "\$(rbenv init -)"' ~/.bashrc` ]]; then
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
fi
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
fi
if [[ -z "$RUBY_VERSION" ]];then
RUBY_VERSION=2.1.0
fi
if [[ -f /app/.ruby-version ]]; then
RUBY_VERSION=$(< /app/.ruby-version)
fi
. ~/.bash_profile
# Install ruby version
if [[ ! `rbenv versions | grep $RUBY_VERSION` ]];then
rbenv install $RUBY_VERSION
fi
rbenv global $RUBY_VERSION
gem install bundler
rbenv rehash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment