Skip to content

Instantly share code, notes, and snippets.

@Partyschaum
Created March 19, 2014 16:40
Show Gist options
  • Save Partyschaum/9645757 to your computer and use it in GitHub Desktop.
Save Partyschaum/9645757 to your computer and use it in GitHub Desktop.
#!/bin/bash¬
set -e¬
¬
RUBY_VERSION="2.1.1"¬
RBENV_USER="/home/vagrant"¬
RBENV_DIR=${RBENV_USER}/.rbenv¬
¬
echo "Setting up rbenv..."¬
if [ ! -d "${RBENV_DIR}" ]; then¬
git clone https://github.com/sstephenson/rbenv.git ${RBENV_USER}/.rbenv¬
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> "${RBENV_USER}/.bashrc"¬
echo 'eval "$(rbenv init -)"' >> "${RBENV_USER}/.bashrc"¬
fi¬
if [ ! -d "${RBENV_DIR}/plugins/ruby-build" ]; then¬
git clone https://github.com/sstephenson/ruby-build.git ${RBENV_USER}/.rbenv/plugins/ruby-build¬
fi¬
¬
source ${RBENV_USER}/.bashrc¬
¬
echo "Installing Ruby ${RUBY_VERSION}..."¬
rbenv install ${RUBY_VERSION}¬
rbenv global ${RUBY_VERSION}¬
¬
if [ ! -e "$RBENV_USER}/.gemrc" ]; then¬
echo -e "install: --no-ri --no-rdoc\nupdate: --no-ri --no-rdoc" > "${RBENV_USER}/.gemrc"¬
fi¬
¬
echo "Installing bundler..."¬
gem install bundler¬
¬
echo "Installing rails..."¬
gem install rails¬
¬
rbenv rehash¬
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment