Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #4928 - bundler:seg-update-compact-index, r=segiddins
Browse files Browse the repository at this point in the history
Update specs to use compact_index 0.11

Also removed the penalty for adding requirements to dependencies!

\c @indirect
  • Loading branch information
homu committed Aug 29, 2016
2 parents f29ec8b + 5843270 commit c38c0a0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions spec/support/artifice/compact_index.rb
Expand Up @@ -103,8 +103,8 @@ def gems(gem_repo = GEM_REPO)
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

Expand Down
4 changes: 2 additions & 2 deletions spec/support/artifice/compact_index_concurrent_download.rb
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/support/artifice/compact_index_extra_api.rb
Expand Up @@ -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

Expand Down
17 changes: 11 additions & 6 deletions spec/support/rubygems_ext.rb
Expand Up @@ -9,7 +9,8 @@ module Rubygems
# 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",
Expand All @@ -36,7 +37,7 @@ def self.setup
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

Expand All @@ -45,10 +46,14 @@ def self.setup
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

0 comments on commit c38c0a0

Please sign in to comment.