Skip to content

Instantly share code, notes, and snippets.

@diogok
Created April 3, 2014 01:20
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 diogok/9946650 to your computer and use it in GitHub Desktop.
Save diogok/9946650 to your computer and use it in GitHub Desktop.
Ruby and rbenv setup, for vagrant.
#!/usr/bin/env bash
# basic ruby
apt-get update
apt-get install aptitude libxslt-dev libxml2-dev ruby ruby1.9.1-dev libssl-dev build-essential -y
# config ruby gems to https
gem sources -r http://rubygems.org
gem sources -r http://rubygems.org/
gem sources -a https://rubygems.org
# add rbenv
su vagrant -c 'git clone https://github.com/sstephenson/rbenv.git /home/vagrant/.rbenv'
su vagrant -c 'echo export PATH="/home/vagrant/.rbenv/bin:\$PATH" >> /home/vagrant/.profile'
su vagrant -c 'echo eval \"\$\(rbenv init -\)\" >> /home/vagrant/.profile'
su vagrant -c 'git clone https://github.com/sstephenson/ruby-build.git /home/vagrant/.rbenv/plugins/ruby-build'
# initial config of app
su vagrant -lc 'cd /vagrant && rbenv install $(cat .ruby-version) && rbenv rehash'
su vagrant -lc 'cd /vagrant && gem install bundler && rbenv rehash'
su vagrant -lc 'cd /vagrant && [[ -e Gemfile ]] && bundle install && rbenv rehash'
echo "Done configuring ruby"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment