Updated Vagrantfile to install more recent versions of software.

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.
This commit is contained in:
monotonee 2016-07-26 19:51:40 -04:00
parent aba25fb565
commit abc50e3e0b
1 changed files with 17 additions and 11 deletions

28
Vagrantfile vendored
View File

@ -25,9 +25,11 @@ 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
@ -35,13 +37,13 @@ if [ -f "${MARKER_FILE}" ]; then
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
@ -49,19 +51,23 @@ 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.