Class: Bundler::CompactIndexClient
- Inherits:
-
Object
- Object
- Bundler::CompactIndexClient
show all
- Defined in:
- lib/bundler/compact_index_client.rb,
lib/bundler/compact_index_client/cache.rb,
lib/bundler/compact_index_client/updater.rb
Defined Under Namespace
Classes: Cache, Error, Updater
Constant Summary
collapse
- DEBUG_MUTEX =
Mutex.new
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of CompactIndexClient.
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/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
|
Instance Attribute Details
#directory ⇒ Object
Returns the value of attribute directory.
19
20
21
|
# File 'lib/bundler/compact_index_client.rb', line 19
def directory
@directory
end
|
#in_parallel ⇒ Lambda
Returns A lambda that takes an array of inputs and a block, and maps the inputs with the block in parallel.
24
25
26
|
# File 'lib/bundler/compact_index_client.rb', line 24
def in_parallel
@in_parallel
end
|
Class Method Details
.debug ⇒ Object
9
10
11
12
|
# File 'lib/bundler/compact_index_client.rb', line 9
def self.debug
return unless ENV["DEBUG_COMPACT_INDEX"]
DEBUG_MUTEX.synchronize { warn("[#{self}] #{yield}") }
end
|
Instance Method Details
#dependencies(names) ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/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
|
#names ⇒ Object
39
40
41
42
43
|
# File 'lib/bundler/compact_index_client.rb', line 39
def names
Bundler::CompactIndexClient.debug { "/names" }
update(@cache.names_path, "names")
@cache.names
end
|
#spec(name, version, platform = nil) ⇒ Object
60
61
62
63
64
|
# File 'lib/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
|
#update_and_parse_checksums! ⇒ Object
66
67
68
69
70
71
72
|
# File 'lib/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
|
#versions ⇒ Object
45
46
47
48
49
50
|
# File 'lib/bundler/compact_index_client.rb', line 45
def versions
Bundler::CompactIndexClient.debug { "/versions" }
update(@cache.versions_path, "versions")
versions, @info_checksums_by_name = @cache.versions
versions
end
|