cocoapods-core 1.7.1 → 1.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-core/cdn_source.rb +73 -26
- data/lib/cocoapods-core/gem_version.rb +1 -1
- data/lib/cocoapods-core/source/metadata.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec7ec4e495a2cbc2a01cbe258d3d2323da27af6ad5717e77aceee1f1d5463339
|
4
|
+
data.tar.gz: 34a8fe7414bd94664f7258cc5c710e954b85a835cfb549c6902d50f2291ee6ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8c1766e9efc229ef4381d832d0e6633a0cc348fa061ad326c5b8dc86babcb50965c9be560af1c72efce81bb7a4defe02cc2d6eb566029f0ce9144ab0d6f652d
|
7
|
+
data.tar.gz: 5da4ee295ddacd8008a77c6431aabf71e759117f07630aa2a85bd2cec82674c7b7598ed1937c724cb2c145ef9d59d27d43b57968a0d2259c669f42d6608eba0d
|
@@ -20,6 +20,9 @@ module Pod
|
|
20
20
|
:max_threads => 200,
|
21
21
|
:max_queue => 0 # unbounded work queue
|
22
22
|
)
|
23
|
+
|
24
|
+
@version_arrays_by_fragment_by_name = {}
|
25
|
+
|
23
26
|
super(repo)
|
24
27
|
end
|
25
28
|
|
@@ -84,36 +87,34 @@ module Pod
|
|
84
87
|
return nil unless specs_dir
|
85
88
|
raise ArgumentError, 'No name' unless name
|
86
89
|
|
90
|
+
fragment = pod_shard_fragment(name)
|
91
|
+
|
92
|
+
ensure_versions_file_loaded(fragment)
|
93
|
+
|
87
94
|
return @versions_by_name[name] unless @versions_by_name[name].nil?
|
88
95
|
|
89
96
|
pod_path_actual = pod_path(name)
|
90
97
|
pod_path_relative = relative_pod_path(name)
|
91
|
-
versions_file_path_relative = pod_path_relative.join(INDEX_FILE_NAME).to_s
|
92
|
-
download_file(versions_file_path_relative)
|
93
98
|
|
94
|
-
return nil
|
99
|
+
return nil if @version_arrays_by_fragment_by_name[fragment][name].nil?
|
95
100
|
|
96
101
|
loaders = []
|
97
|
-
@versions_by_name[name] ||=
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
unless pod_path_actual.join(podspec_version_path_relative).exist?
|
105
|
-
loaders << Concurrent::Promise.execute(:executor => @executor) do
|
106
|
-
download_file(pod_path_relative.join(podspec_version_path_relative).to_s)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
begin
|
110
|
-
Version.new(version) if version[0, 1] != '.'
|
111
|
-
rescue ArgumentError
|
112
|
-
raise Informative, 'An unexpected version directory ' \
|
113
|
-
"`#{version}` was encountered for the " \
|
114
|
-
"`#{pod_dir}` Pod in the `#{name}` repository."
|
102
|
+
@versions_by_name[name] ||= @version_arrays_by_fragment_by_name[fragment][name].map do |version|
|
103
|
+
# Optimization: ensure all the podspec files at least exist. The correct one will get refreshed
|
104
|
+
# in #specification_path regardless.
|
105
|
+
podspec_version_path_relative = Pathname.new(version).join("#{name}.podspec.json")
|
106
|
+
unless pod_path_actual.join(podspec_version_path_relative).exist?
|
107
|
+
loaders << Concurrent::Promise.execute(:executor => @executor) do
|
108
|
+
download_file(pod_path_relative.join(podspec_version_path_relative).to_s)
|
115
109
|
end
|
116
110
|
end
|
111
|
+
begin
|
112
|
+
Version.new(version) if version[0, 1] != '.'
|
113
|
+
rescue ArgumentError
|
114
|
+
raise Informative, 'An unexpected version directory ' \
|
115
|
+
"`#{version}` was encountered for the " \
|
116
|
+
"`#{pod_dir}` Pod in the `#{name}` repository."
|
117
|
+
end
|
117
118
|
end.compact.sort.reverse
|
118
119
|
Concurrent::Promise.zip(*loaders).wait!
|
119
120
|
@versions_by_name[name]
|
@@ -146,6 +147,12 @@ module Pod
|
|
146
147
|
raise Informative, "Can't retrieve all the specs for a CDN-backed source, it will take forever"
|
147
148
|
end
|
148
149
|
|
150
|
+
# @return [Array<Sets>] the sets of all the Pods.
|
151
|
+
#
|
152
|
+
def pod_sets
|
153
|
+
raise Informative, "Can't retrieve all the pod sets for a CDN-backed source, it will take forever"
|
154
|
+
end
|
155
|
+
|
149
156
|
# @!group Searching the source
|
150
157
|
#-------------------------------------------------------------------------#
|
151
158
|
|
@@ -165,7 +172,13 @@ module Pod
|
|
165
172
|
query = query.root_name
|
166
173
|
end
|
167
174
|
|
168
|
-
|
175
|
+
fragment = pod_shard_fragment(query)
|
176
|
+
|
177
|
+
ensure_versions_file_loaded(fragment)
|
178
|
+
|
179
|
+
version_arrays_by_name = @version_arrays_by_fragment_by_name[fragment] || {}
|
180
|
+
|
181
|
+
found = version_arrays_by_name[query].nil? ? nil : query
|
169
182
|
|
170
183
|
if found
|
171
184
|
set = set(query)
|
@@ -220,12 +233,37 @@ module Pod
|
|
220
233
|
|
221
234
|
private
|
222
235
|
|
223
|
-
|
224
|
-
|
225
|
-
|
236
|
+
def ensure_versions_file_loaded(fragment)
|
237
|
+
return if !@version_arrays_by_fragment_by_name[fragment].nil? && !@check_existing_files_for_update
|
238
|
+
|
239
|
+
# Index file that contains all the versions for all the pods in the shard.
|
240
|
+
# We use those because you can't get a directory listing from a CDN.
|
241
|
+
index_file_name = index_file_name_for_fragment(fragment)
|
242
|
+
download_file(index_file_name)
|
243
|
+
versions_raw = local_file(index_file_name, &:to_a).map(&:chomp)
|
244
|
+
@version_arrays_by_fragment_by_name[fragment] = versions_raw.reduce({}) do |hash, row|
|
245
|
+
row = row.split('/')
|
246
|
+
pod = row.shift
|
247
|
+
versions = row
|
248
|
+
|
249
|
+
hash[pod] = versions
|
250
|
+
hash
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
def index_file_name_for_fragment(fragment)
|
255
|
+
fragment_joined = fragment.join('_')
|
256
|
+
fragment_joined = '_' + fragment_joined unless fragment.empty?
|
257
|
+
"all_pods_versions#{fragment_joined}.txt"
|
258
|
+
end
|
259
|
+
|
260
|
+
def pod_shard_fragment(pod_name)
|
261
|
+
metadata.path_fragment(pod_name)[0..-2]
|
262
|
+
end
|
226
263
|
|
227
264
|
def local_file(partial_url)
|
228
|
-
|
265
|
+
file_path = repo.join(partial_url)
|
266
|
+
File.open(file_path) do |file|
|
229
267
|
yield file if block_given?
|
230
268
|
end
|
231
269
|
end
|
@@ -257,9 +295,18 @@ module Pod
|
|
257
295
|
etag = File.read(etag_path) if File.exist?(etag_path)
|
258
296
|
debug "CDN: #{name} Relative path: #{partial_url}, has ETag? #{etag}" unless etag.nil?
|
259
297
|
|
298
|
+
download_from_url(partial_url, file_remote_url, etag)
|
299
|
+
end
|
300
|
+
|
301
|
+
def download_from_url(partial_url, file_remote_url, etag)
|
302
|
+
path = repo + partial_url
|
303
|
+
etag_path = path.sub_ext(path.extname + '.etag')
|
304
|
+
|
260
305
|
response = etag.nil? ? REST.get(file_remote_url) : REST.get(file_remote_url, 'If-None-Match' => etag)
|
261
306
|
|
262
307
|
case response.status_code
|
308
|
+
when 301
|
309
|
+
download_from_url(partial_url, response.headers['location'].first, etag)
|
263
310
|
when 304
|
264
311
|
debug "CDN: #{name} Relative path not modified: #{partial_url}"
|
265
312
|
# We need to update the file modification date, as it is later used for freshness
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eloy Duran
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-06-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
|
-
rubygems_version: 3.0.
|
149
|
+
rubygems_version: 3.0.3
|
150
150
|
signing_key:
|
151
151
|
specification_version: 3
|
152
152
|
summary: The models of CocoaPods
|