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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 620d24f4ab350ba81f7e7e853b32b197f453698e626cc855181fc8df65d3c802
4
- data.tar.gz: cd9abf729b77f76489158efa29c02b7b0050d127203ab245dbd6967a9cdc6ef9
3
+ metadata.gz: ec7ec4e495a2cbc2a01cbe258d3d2323da27af6ad5717e77aceee1f1d5463339
4
+ data.tar.gz: 34a8fe7414bd94664f7258cc5c710e954b85a835cfb549c6902d50f2291ee6ae
5
5
  SHA512:
6
- metadata.gz: 4fc9e428f78cfa72f573d16217eddcfe3dc604c76c954af577f4321bbfd8450218b443de66d0adaac95bd383e14027bb9e359cb00453410cceac116aa18b30df
7
- data.tar.gz: 3b3d0d45cd08f9de662b89ad96fd639a320587280ef2019c74b9e26aa193d3c6ec8cb1d71f59d37f3b024b854f4e34e2f544378109d44817ec37b6072d57863e
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 unless pod_path_actual.join(INDEX_FILE_NAME).exist?
99
+ return nil if @version_arrays_by_fragment_by_name[fragment][name].nil?
95
100
 
96
101
  loaders = []
97
- @versions_by_name[name] ||= local_file(versions_file_path_relative) do |file|
98
- file.map do |v|
99
- version = v.chomp
100
-
101
- # Optimization: ensure all the podspec files at least exist. The correct one will get refreshed
102
- # in #specification_path regardless.
103
- podspec_version_path_relative = Pathname.new(version).join("#{name}.podspec.json")
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
- found = download_file(relative_pod_path(query).join(INDEX_FILE_NAME).to_s)
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
- # Index files contain all the sub directories in the directory, separated by
224
- # a newline. We use those because you can't get a directory listing from a CDN.
225
- INDEX_FILE_NAME = 'index.txt'.freeze
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
- File.open(repo.join(partial_url)) do |file|
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
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  # The version of the cocoapods-core.
3
3
  #
4
- CORE_VERSION = '1.7.1'.freeze unless defined? Pod::CORE_VERSION
4
+ CORE_VERSION = '1.7.2'.freeze unless defined? Pod::CORE_VERSION
5
5
  end
@@ -47,7 +47,7 @@ module Pod
47
47
  hashed.slice!(0, length)
48
48
  end
49
49
  end
50
- prefixes.concat([pod_name, version]).compact.join(File::SEPARATOR)
50
+ prefixes.concat([pod_name, version]).compact
51
51
  end
52
52
 
53
53
  def last_compatible_version(target_version)
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.1
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-05-30 00:00:00.000000000 Z
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.1
149
+ rubygems_version: 3.0.3
150
150
  signing_key:
151
151
  specification_version: 3
152
152
  summary: The models of CocoaPods