Skip to content

Instantly share code, notes, and snippets.

@Koronen
Last active December 14, 2015 03:49
Show Gist options
  • Save Koronen/5023573 to your computer and use it in GitHub Desktop.
Save Koronen/5023573 to your computer and use it in GitHub Desktop.
Install and configure rbenv
#!/usr/bin/env sh
set -e
RBENV="$HOME/.rbenv"
# Clone/Update rbenv
[ -d "$RBENV" ] && ( cd "$RBENV"; git pull -q ) || \
git clone -q https://github.com/sstephenson/rbenv.git "$RBENV"
# Add the plugins directory
[ -d "$RBENV/plugins" ] || mkdir -p "$RBENV/plugins"
# Clone/Update the ruby-build plugin
[ -d "$RBENV/plugins/ruby-build" ] && ( cd "$RBENV/plugins/ruby-build"; git pull -q ) || \
git clone -q https://github.com/sstephenson/ruby-build.git "$RBENV/plugins/ruby-build"
# Clone/Update the rbenv-default-gems plugin
[ -d "$RBENV/plugins/rbenv-default-gems" ] && ( cd "$RBENV/plugins/rbenv-default-gems"; git pull -q ) || \
git clone -q https://github.com/sstephenson/rbenv-default-gems.git "$RBENV/plugins/rbenv-default-gems"
# Configure the rbenv-default-gems plugin
[ -f "$RBENV/default-gems" ] || cat > "$RBENV/default-gems" <<EOF
bundler
EOF
# Clone/Update the rbenv-gem-rehash plugin
[ -d "$RBENV/plugins/rbenv-gem-rehash" ] && ( cd "$RBENV/plugins/rbenv-gem-rehash"; git pull -q ) || \
git clone -q https://github.com/sstephenson/rbenv-gem-rehash.git "$RBENV/plugins/rbenv-gem-rehash"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment