summaryrefslogtreecommitdiff
path: root/spec/support/rubygems_ext.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2020-03-04 13:38:58 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-03-06 07:43:13 +0900
commita26d34858c55ec701c1933f5c711942a5591d05d (patch)
treeeb0938dddc8f44ab9a587585ad1a65025ec2f763 /spec/support/rubygems_ext.rb
parent08992f15a64a2afa73e237ef7476ae04dbd69377 (diff)
downloadbundler-a26d34858c55ec701c1933f5c711942a5591d05d.tar.gz
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.
Diffstat (limited to 'spec/support/rubygems_ext.rb')
-rw-r--r--spec/support/rubygems_ext.rb12
1 files 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