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

Update specs to use compact_index 0.11 #4928

Merged
merged 2 commits into from
Aug 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spec/support/artifice/compact_index.rb
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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