Class: Bundler::Fetcher::CompactIndex
- Inherits:
-
Base
- Object
- Base
- Bundler::Fetcher::CompactIndex
show all
- Defined in:
- lib/bundler/fetcher/compact_index.rb
Defined Under Namespace
Classes: ClientFetcher
Instance Attribute Summary
Attributes inherited from Base
#display_uri, #downloader, #remote
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#fetch_uri, #initialize, #remote_uri
Class Method Details
.compact_index_request(method_name) ⇒ Object
Instance Method Details
#api_fetcher? ⇒ Boolean
87
88
89
|
# File 'lib/bundler/fetcher/compact_index.rb', line 87
def api_fetcher?
true
end
|
#available? ⇒ Boolean
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/bundler/fetcher/compact_index.rb', line 70
def available?
unless SharedHelpers.md5_available?
Bundler.ui.debug("FIPS mode is enabled, bundler can't use the CompactIndex API")
return nil
end
if fetch_uri.scheme == "file"
Bundler.ui.debug("Using a local server, bundler won't use the CompactIndex API")
return false
end
compact_index_client.update_and_parse_checksums!
rescue CompactIndexClient::Updater::MisMatchedChecksumError => e
Bundler.ui.debug(e.message)
nil
end
|
#fetch_spec(spec) ⇒ Object
60
61
62
63
64
65
66
67
|
# File 'lib/bundler/fetcher/compact_index.rb', line 60
def fetch_spec(spec)
spec -= [nil, "ruby", ""]
contents = compact_index_client.spec(*spec)
return nil if contents.nil?
contents.unshift(spec.first)
contents[3].map! {|d| Gem::Dependency.new(*d) }
EndpointSpecification.new(*contents)
end
|
#specs(gem_names) ⇒ Object
29
30
31
|
# File 'lib/bundler/fetcher/compact_index.rb', line 29
def specs(gem_names)
specs_for_names(gem_names)
end
|
#specs_for_names(gem_names) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/bundler/fetcher/compact_index.rb', line 34
def specs_for_names(gem_names)
gem_info = []
complete_gems = []
remaining_gems = gem_names.dup
until remaining_gems.empty?
log_specs "Looking up gems #{remaining_gems.inspect}"
deps = begin
parallel_compact_index_client.dependencies(remaining_gems)
rescue TooManyRequestsError
@bundle_worker.stop if @bundle_worker
@bundle_worker = nil serial_compact_index_client.dependencies(remaining_gems)
end
next_gems = deps.map {|d| d[3].map(&:first).flatten(1) }.flatten(1).uniq
deps.each {|dep| gem_info << dep }
complete_gems.concat(deps.map(&:first)).uniq!
remaining_gems = next_gems - complete_gems
end
@bundle_worker.stop if @bundle_worker
@bundle_worker = nil
gem_info
end
|