From 20cbbf0d5d86a30b8afef8906bdf7536b0565367 Mon Sep 17 00:00:00 2001 From: Homu Date: Tue, 30 Aug 2016 05:00:36 +0900 Subject: Auto merge of #4928 - bundler:seg-update-compact-index, r=segiddins Update specs to use compact_index 0.11 Also removed the penalty for adding requirements to dependencies! \c @indirect # Conflicts: # spec/support/artifice/compact_index_concurrent_download.rb --- spec/support/artifice/compact_index.rb | 4 ++-- spec/support/artifice/compact_index_extra_api.rb | 4 ++-- spec/support/rubygems_ext.rb | 17 +++++++++++------ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/spec/support/artifice/compact_index.rb b/spec/support/artifice/compact_index.rb index 88706c3590..458c81b4b1 100644 --- a/spec/support/artifice/compact_index.rb +++ b/spec/support/artifice/compact_index.rb @@ -90,8 +90,8 @@ class CompactIndexAPI < Endpoint file = tmp("versions.list") file.delete if file.file? file = CompactIndex::VersionsFile.new(file.to_s) - file.update_with(gems) - CompactIndex.versions(file, nil, {}) + file.create(gems) + file.contents end end diff --git a/spec/support/artifice/compact_index_extra_api.rb b/spec/support/artifice/compact_index_extra_api.rb index 063e5589d4..844a9ca9f2 100644 --- a/spec/support/artifice/compact_index_extra_api.rb +++ b/spec/support/artifice/compact_index_extra_api.rb @@ -15,8 +15,8 @@ class CompactIndexExtraApi < CompactIndexAPI file = tmp("versions.list") file.delete if file.file? file = CompactIndex::VersionsFile.new(file.to_s) - file.update_with(gems(gem_repo4)) - CompactIndex.versions(file, nil, {}) + file.create(gems(gem_repo4)) + file.contents end end diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb index 85ed1bdf0f..dda77ec712 100644 --- a/spec/support/rubygems_ext.rb +++ b/spec/support/rubygems_ext.rb @@ -9,7 +9,8 @@ module Spec # rack 2.x requires Ruby version >= 2.2.2. # artifice doesn't support rack 2.x now. "rack" => "< 2", - "fakeweb artifice compact_index" => nil, + "fakeweb artifice" => nil, + "compact_index" => "~> 0.11.0", "sinatra" => "1.2.7", # Rake version has to be consistent for tests to pass "rake" => "10.0.2", @@ -35,7 +36,7 @@ module Spec FileUtils.rm_rf(Path.base_system_gems) FileUtils.mkdir_p(Path.base_system_gems) puts "installing gems for the tests to use..." - DEPS.sort {|a, _| a[1].nil? ? 1 : -1 }.each {|n, v| install_gem(n, v) } + install_gems(DEPS) File.open(manifest_path, "w") {|f| f << manifest.join } end @@ -44,10 +45,14 @@ module Spec Gem::DefaultUserInteraction.ui = Gem::SilentUI.new end - def self.install_gem(name, version = nil) - cmd = "gem install #{name} --no-rdoc --no-ri" - cmd += " --version '#{version}'" if version - system(cmd) || raise("Installing gem #{name} for the tests to use failed!") + def self.install_gems(gems) + reqs, no_reqs = gems.partition {|_, req| !req.nil? && !req.split(" ").empty? } + no_reqs.map!(&:first) + reqs.map! {|name, req| "'#{name}:#{req}'" } + deps = reqs.concat(no_reqs).join(" ") + cmd = "gem install #{deps} --no-rdoc --no-ri" + puts cmd + system(cmd) || raise("Installing gems #{deps} for the tests to use failed!") end def gem_command(command, args = "", options = {}) -- cgit v1.2.1