# File bundler/compact_index_client.rb, line 8 def self.debug return unless ENV["DEBUG_COMPACT_INDEX"] DEBUG_MUTEX.synchronize { warn("[#{self}] #{yield}") } end
# File bundler/compact_index_client.rb, line 20 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 = Thread::Mutex.new end
# File bundler/compact_index_client.rb, line 67 def dependencies(names) Bundler::CompactIndexClient.debug { "dependencies(#{names})" } execution_mode.call(names) do |name| update_info(name) @cache.dependencies(name).map {|d| d.unshift(name) } end.flatten(1) end
@return [Lambda] A lambda that takes an array of inputs and a block, and
maps the inputs with the block in parallel.
# File bundler/compact_index_client.rb, line 40 def execution_mode @execution_mode || sequentially end
# File bundler/compact_index_client.rb, line 30 def execution_mode=(block) Bundler::CompactIndexClient.debug { "execution_mode=" } @endpoints = Set.new @execution_mode = block end
# File bundler/compact_index_client.rb, line 54 def names Bundler::CompactIndexClient.debug { "/names" } update(@cache.names_path, "names") @cache.names end
# File bundler/compact_index_client.rb, line 44 def sequential_execution_mode! self.execution_mode = sequentially end
# File bundler/compact_index_client.rb, line 48 def sequentially @sequentially ||= lambda do |inputs, &blk| inputs.map(&blk) end end
# File bundler/compact_index_client.rb, line 75 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