summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-08-30 05:00:36 +0900
committerHomu <homu@barosl.com>2016-08-30 05:00:36 +0900
commitc38c0a0bcb0518283520f54ff73e4cca726b9a22 (patch)
treed5f783aba3344e756aa56f3f8f1bb203126570fb
parentf29ec8b836b05906402a4d59518544418437e22a (diff)
parent584327075d9662387660053082acf7f603516916 (diff)
downloadbundler-c38c0a0bcb0518283520f54ff73e4cca726b9a22.tar.gz
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
-rw-r--r--spec/support/artifice/compact_index.rb4
-rw-r--r--spec/support/artifice/compact_index_concurrent_download.rb4
-rw-r--r--spec/support/artifice/compact_index_extra_api.rb4
-rw-r--r--spec/support/rubygems_ext.rb17
4 files changed, 17 insertions, 12 deletions
diff --git a/spec/support/artifice/compact_index.rb b/spec/support/artifice/compact_index.rb
index f3ff2db4fa..0afd7fc526 100644
--- a/spec/support/artifice/compact_index.rb
+++ b/spec/support/artifice/compact_index.rb
@@ -103,8 +103,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_concurrent_download.rb b/spec/support/artifice/compact_index_concurrent_download.rb
index 30a2171a30..b788a852cf 100644
--- a/spec/support/artifice/compact_index_concurrent_download.rb
+++ b/spec/support/artifice/compact_index_concurrent_download.rb
@@ -22,8 +22,8 @@ class CompactIndexConcurrentDownload < CompactIndexAPI
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
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 4ddbc3312a..e2b8c6a45e 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",
@@ -36,7 +37,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
@@ -45,10 +46,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
end
end