From 63f34432ad60dad76a88e218c39b19980c521a77 Mon Sep 17 00:00:00 2001 From: Darragh Bailey Date: Thu, 23 Apr 2020 09:12:04 +0100 Subject: [PATCH] Allow dev with latest vagrant to use newer vagrant-spec (#1098) Latest vagrant depends on a vagrant-spec release containing a more recent dependency on childprocess than is supported for earlier releases of vagrant. Adjust dependencies to pin to the specific release of vagrant-spec if the request version of vagrant is 2.2.7 or older. Does not attempt to handle the situation where a version is specified that cannot be parsed. While it would be useful to test against newer versions of 2.2.x, it appears this encounters a bug in upstream vagrant when installing in dev mode see https://github.com/hashicorp/vagrant#11293 Therefore limit latest 2.2.x released version tested against to 2.2.4. --- .travis.yml | 23 ++++++++++++++++------- Gemfile | 20 +++++++++++++++++--- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0cd7f0e..d78897e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,18 +18,27 @@ env: matrix: - VAGRANT_VERSION=v2.0.4 - VAGRANT_VERSION=v2.1.5 - - VAGRANT_VERSION=v2.2.3 + - VAGRANT_VERSION=v2.2.4 + - VAGRANT_VERSION=master rvm: - - 2.2.7 - - 2.3.4 - - 2.4.1 - - 2.6.1 + - 2.2.10 + - 2.3.5 + - 2.4.10 + - 2.6.6 matrix: allow_failures: - env: VAGRANT_VERSION=master exclude: - env: VAGRANT_VERSION=v2.0.4 - rvm: 2.6.1 + rvm: 2.6.6 - env: VAGRANT_VERSION=v2.1.5 - rvm: 2.6.1 + rvm: 2.6.6 + - env: VAGRANT_VERSION=v2.2.4 + rvm: 2.2.10 + - env: VAGRANT_VERSION=v2.2.4 + rvm: 2.3.5 + - env: VAGRANT_VERSION=master + rvm: 2.2.10 + - env: VAGRANT_VERSION=master + rvm: 2.3.5 diff --git a/Gemfile b/Gemfile index c06217a..35df4b5 100644 --- a/Gemfile +++ b/Gemfile @@ -7,14 +7,28 @@ group :development do # We depend on Vagrant for development, but we don't add it as a # gem dependency because we expect to be installed within the # Vagrant environment itself using `vagrant plugin`. - if ENV['VAGRANT_VERSION'] + vagrant_version = ENV['VAGRANT_VERSION'] + if vagrant_version gem 'vagrant', :git => 'https://github.com/hashicorp/vagrant.git', - tag: ENV['VAGRANT_VERSION'] + tag: vagrant_version else gem 'vagrant', :git => 'https://github.com/hashicorp/vagrant.git' end - gem 'vagrant-spec', :github => 'hashicorp/vagrant-spec', :ref => '161128f2216cee8edb7bcd30da18bd4dea86f98a' + begin + raise if vagrant_version.empty? + vagrant_version = vagrant_version[1..-1] if vagrant_version && vagrant_version.start_with?('v') + vagrant_gem_version = Gem::Version.new(vagrant_version) + rescue + # default to newer if unable to parse + vagrant_gem_version = Gem::Version.new('2.2.8') + end + + if vagrant_gem_version <= Gem::Version.new('2.2.7') + gem 'vagrant-spec', :github => 'hashicorp/vagrant-spec', :ref => '161128f2216cee8edb7bcd30da18bd4dea86f98a' + else + gem 'vagrant-spec', :github => 'hashicorp/vagrant-spec' + end gem 'pry' end