Created
January 14, 2016 20:12
-
-
Save whatsma/5fc072db64c87c4907a6 to your computer and use it in GitHub Desktop.
Vagrantfle to install chruby, ruby-install, ruby2.3 and the bundler gem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant.configure(2) do |config| | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.provision :shell, inline: <<-SHELL | |
# function to run a command as the vagrant user | |
as_vagrant () { | |
sudo -i -u vagrant bash -c "$1" | |
} | |
sudo apt-get update -y | |
sudo apt-get upgrade -y | |
sudo apt-get install git -y | |
echo 'create src dir...' | |
as_vagrant 'mkdir ~/src' | |
echo 'install chruby...' | |
as_vagrant 'git clone https://github.com/postmodern/chruby.git ~/src/chruby' | |
as_vagrant 'cd ~/src/chruby && sudo make install' | |
# echo to .profile as it is read by sudo -i (unlike .bashrc) | |
as_vagrant "echo 'source /usr/local/share/chruby/chruby.sh' >> ~/.profile" | |
as_vagrant "echo 'source /usr/local/share/chruby/auto.sh' >> ~/.profile" | |
echo 'install ruby-install...' | |
as_vagrant 'git clone https://github.com/postmodern/ruby-install.git ~/src/ruby-install' | |
as_vagrant 'cd ~/src/ruby-install && sudo make install' | |
echo 'install rubyies...' | |
#as_vagrant 'ruby-install ruby 2.0' | |
#as_vagrant 'ruby-install ruby 2.1' | |
#as_vagrant 'ruby-install ruby 2.2' | |
as_vagrant 'ruby-install ruby 2.3' | |
echo 'set default ruby...' | |
as_vagrant "echo '2.3' > .ruby-version" | |
echo 'gem install bundler...' | |
as_vagrant 'gem install bundler' | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment