# File bundler/compact_index_client.rb, line 9 def self.debug return unless ENV["DEBUG_COMPACT_INDEX"] DEBUG_MUTEX.synchronize { warn("[#{self}] #{yield}") } end
# File bundler/compact_index_client.rb, line 26 def initialize(directory, fetcher) @directory = Pathname.new(directory) @updater = Updater.new(fetcher) @cache = Cache.new(@directory) @endpoints = Set.new @info_checksums_by_name = {} @parsed_checksums = false @mutex = Mutex.new @in_parallel = lambda do |inputs, &blk| inputs.map(&blk) end end
# File bundler/compact_index_client.rb, line 52 def dependencies(names) Bundler::CompactIndexClient.debug { "dependencies(#{names})" } in_parallel.call(names) do |name| update_info(name) @cache.dependencies(name).map {|d| d.unshift(name) } end.flatten(1) end
# File bundler/compact_index_client.rb, line 39 def names Bundler::CompactIndexClient.debug { "/names" } update(@cache.names_path, "names") @cache.names end
# File bundler/compact_index_client.rb, line 60 def spec(name, version, platform = nil) Bundler::CompactIndexClient.debug { "spec(name = #{name}, version = #{version}, platform = #{platform})" } update_info(name) @cache.specific_dependency(name, version, platform) end
# File bundler/compact_index_client.rb, line 66 def update_and_parse_checksums! Bundler::CompactIndexClient.debug { "update_and_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