Merge pull request #7650 from monotonee/automate-vagrantfile-install-versions

Updated Vagrantfile to automatically install more recent versions of software.
This commit is contained in:
Seth Vargo 2016-07-26 17:36:12 -07:00 committed by GitHub
commit 6a48d69781
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
end end
$shell = <<-CONTENTS $shell = <<-'CONTENTS'
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
MARKER_FILE="/usr/local/etc/vagrant_provision_marker" 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 # Only provision once
if [ -f "${MARKER_FILE}" ]; then if [ -f "${MARKER_FILE}" ]; then
@ -35,13 +37,13 @@ if [ -f "${MARKER_FILE}" ]; then
fi fi
# Update apt # Update apt
apt-get update apt-get update --quiet
# Install basic dependencies # 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 # 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 # Install RVM
su -l -c 'curl -sL https://get.rvm.io | bash -s stable' vagrant 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 # Add the vagrant user to the RVM group
#usermod -a -G rvm vagrant #usermod -a -G rvm vagrant
# Install some Rubies # Install latest Ruby that complies with Vagrant's version constraint
su -l -c 'rvm install 2.2.3' vagrant 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 --default use 2.2.3' vagrant 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) # Output the Ruby version (for sanity)
su -l -c 'ruby --version' vagrant su -l -c 'ruby --version' vagrant
# Install Git # Install Git
apt-get install -y git apt-get install -qy git
# Prepare to run unit tests # Upgrade Rubygems
su -l vagrant -c 'gem install bundler -v 1.12.5' su -l -c "rvm ${RUBY_VER_LATEST} do gem update --system" vagrant
su -l vagrant -c 'cd /vagrant; bundle install'
# 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 # Automatically move into the shared folder, but only add the command
# if it's not already there. # if it's not already there.