Skip to content

Instantly share code, notes, and snippets.

@artifactsauce
Last active August 29, 2015 14:03
Show Gist options
  • Save artifactsauce/601d5bf837b4b651c0aa to your computer and use it in GitHub Desktop.
Save artifactsauce/601d5bf837b4b651c0aa to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -eu
RUBY_VERSION="2.1.2"
if ! which -s brew; then
echo "[ERROR] Homebrew is required."
exit 1
fi
if ! which -s rbenv; then
brew install rbenv ruby-build
echo "[INFO] Write a definition below in the bashrc or the zshrc, for loading rbenv."
echo "eval \"\$(rbenv init -)\""
fi
eval "$(rbenv init -)"
if [ $(rbenv versions | grep -c "^\** ${RUBY_VERSION} ") -eq 0 ]; then
echo "[INFO] Change the version of readline to 6.2.4."
if [[ $(brew versions readline | grep -c "^6.2.4") -eq 0 ]]; then
echo "[INFO] Install the version 6.2.4 of readline."
cd /usr/local/
git checkout 0181c8a Library/Formula/readline.rb
brew install readline
else
brew switch readline 6.2.4
fi
echo "[INFO] Install ruby and set the version in global."
rbenv install ${RUBY_VERSION}
rbenv global ${RUBY_VERSION}
fi
if ! which -s gem; then
echo "[ERROR] gem command is required."
exit 1
fi
echo "[INFO] Install basical gems."
cat <<EOF | xargs gem install
bundler
pry
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment