summaryrefslogtreecommitdiff
path: root/lib/bundler/vendor
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-08-23 16:21:26 -0700
committerSamuel Giddins <segiddins@segiddins.me>2016-01-25 10:45:41 -0600
commiteb28a3a3a6b4740c7e4b2c0269489943fcea229c (patch)
tree32f16db878455004ca2d394fab91b1bcfc57a9ed /lib/bundler/vendor
parent26f5117e55a89256d53ae9f49c14f8eda91ec1b3 (diff)
downloadbundler-eb28a3a3a6b4740c7e4b2c0269489943fcea229c.tar.gz
add standalone-checksum parsing for the fetcher
Diffstat (limited to 'lib/bundler/vendor')
-rw-r--r--lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb7
-rw-r--r--lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb15
2 files changed, 20 insertions, 2 deletions
diff --git a/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb b/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb
index 004c2dfa13..0c35dcc579 100644
--- a/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb
+++ b/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb
@@ -39,6 +39,13 @@ class Bundler::CompactIndexClient
@cache.specific_dependency(name, version, platform)
end
+ def parse_checksums!
+ return @info_checksums_by_name if @parsed_checksums
+ update(@cache.versions_path, "versions")
+ @info_checksums_by_name = @cache.checksums
+ @parsed_checksums = true
+ end
+
private
def update(local_path, remote_path)
diff --git a/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb b/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb
index 20bf9d842f..118ee09435 100644
--- a/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb
+++ b/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb
@@ -18,16 +18,16 @@ class Bundler::CompactIndexClient
def versions
versions_by_name = Hash.new {|hash, key| hash[key] = [] }
info_checksums_by_name = {}
+
lines(versions_path).each do |line|
name, versions_string, info_checksum = line.split(" ", 3)
-
info_checksums_by_name[name] = info_checksum || ""
-
versions = versions_string.split(",").map! do |version|
version.split("-", 2).unshift(name)
end
versions_by_name[name].concat(versions)
end
+
[versions_by_name, info_checksums_by_name]
end
@@ -35,6 +35,17 @@ class Bundler::CompactIndexClient
directory.join("versions")
end
+ def checksums
+ checksums = {}
+
+ lines(versions_path).each do |line|
+ name, _, checksum = line.split(" ", 3)
+ checksums[name] = checksum
+ end
+
+ checksums
+ end
+
def dependencies(name)
lines(info_path(name)).map do |line|
parse_gem(line)