From a26d34858c55ec701c1933f5c711942a5591d05d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 4 Mar 2020 13:38:58 +0100 Subject: Install dev dependencies programmatically Without shelling out. It should be faster, and it avoids a ruby 2.3 issue where gems installed through a subprocess are not picked up by the currently running rubygems. I'm also removing some unneeded `travis_retry` from the TravisCI configure. These steps shouldn't timeout and if they do, we should figure out why. Also, they could be hiding other issues not related to the network. In this case, `travis_retry bin/rake spec:parallel_deps` was hiding the issue installing dev dependencies being fixed by this commit. --- spec/support/rubygems_ext.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb index 5299a7b447..3c8d97b83c 100644 --- a/spec/support/rubygems_ext.rb +++ b/spec/support/rubygems_ext.rb @@ -105,10 +105,14 @@ module Spec end def install_gems(gems) - deps = gems.map {|name, req| "'#{name}:#{req}'" }.join(" ") - gem = ENV["GEM_COMMAND"] || "#{Gem.ruby} -S gem --backtrace" - cmd = "#{gem} install #{deps} --no-document --conservative" - system(cmd) || raise("Installing gems #{deps} for the tests to use failed!") + require "rubygems/dependency_installer" + + gems.each do |name, req| + dependency = Gem::Dependency.new(name, req) + next unless dependency.matching_specs.empty? + + Gem::DependencyInstaller.new(:document => false).install(dependency) + end end end end -- cgit v1.2.1