Skip to content

Commit

Permalink
Updated Vagrantfile to install more recent versions of software.
Browse files Browse the repository at this point in the history
Quieted the apt-get installs to reduce terminal output chaos.

Changed the rvm GPG key server to remove the expired key warning
when the rvm public key is used to verify the rvm download. Command
used conforms to that specified by rvm.io.

Ruby and bundler versions are read from Vagrant's gemspec and used
with rvm to download the latest Ruby version that complies with
the version constraint. Exact bundler version is installed according
to gemspec.

Rubygems is upgraded to latest version through rvm.
  • Loading branch information
monotonee committed Jul 27, 2016
1 parent aba25fb commit abc50e3
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions Vagrantfile
Expand Up @@ -25,43 +25,49 @@ Vagrant.configure("2") do |config|
end
end

$shell = <<-CONTENTS
$shell = <<-'CONTENTS'
export DEBIAN_FRONTEND=noninteractive
MARKER_FILE="/usr/local/etc/vagrant_provision_marker"
RUBY_VER_REQ=$(awk '$1 == "s.required_ruby_version" { print $4 }' /vagrant/vagrant.gemspec | tr -d '"')
BUNDLER_VER_REQ=$(awk '/s.add_dependency "bundler"/ { print $4 }' /vagrant/vagrant.gemspec | tr -d '"')
# Only provision once
if [ -f "${MARKER_FILE}" ]; then
exit 0
fi
# Update apt
apt-get update
apt-get update --quiet
# Install basic dependencies
apt-get install -y build-essential bsdtar curl
apt-get install -qy build-essential bsdtar curl
# Import the mpapis public key to verify downloaded releases
su -l -c 'curl -sSL https://rvm.io/mpapis.asc | gpg -q --import -' vagrant
su -l -c 'gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3' vagrant
# Install RVM
su -l -c 'curl -sL https://get.rvm.io | bash -s stable' vagrant
# Add the vagrant user to the RVM group
#usermod -a -G rvm vagrant
# Install some Rubies
su -l -c 'rvm install 2.2.3' vagrant
su -l -c 'rvm --default use 2.2.3' vagrant
# Install latest Ruby that complies with Vagrant's version constraint
RUBY_VER_LATEST=$(su -l -c 'rvm list known' vagrant | tr '[]-' ' ' | awk "/^ ruby ${RUBY_VER_REQ:0:1}\./ { print \$2 }" | sort | tail -n1)
su -l -c "rvm install ${RUBY_VER_LATEST}" vagrant
su -l -c "rvm --default use ${RUBY_VER_LATEST}" vagrant
# Output the Ruby version (for sanity)
su -l -c 'ruby --version' vagrant
# Install Git
apt-get install -y git
apt-get install -qy git
# Prepare to run unit tests
su -l vagrant -c 'gem install bundler -v 1.12.5'
su -l vagrant -c 'cd /vagrant; bundle install'
# Upgrade Rubygems
su -l -c "rvm ${RUBY_VER_LATEST} do gem update --system" vagrant
# Install bundler and prepare to run unit tests
su -l -c "gem install bundler -v ${BUNDLER_VER_REQ}" vagrant
su -l -c 'cd /vagrant; bundle install' vagrant
# Automatically move into the shared folder, but only add the command
# if it's not already there.
Expand Down

0 comments on commit abc50e3

Please sign in to comment.