cocoapods-core 0.30.0 → 1.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +7 -10
  3. data/lib/cocoapods-core/build_type.rb +121 -0
  4. data/lib/cocoapods-core/cdn_source.rb +501 -0
  5. data/lib/cocoapods-core/core_ui.rb +4 -3
  6. data/lib/cocoapods-core/dependency.rb +100 -73
  7. data/lib/cocoapods-core/gem_version.rb +1 -2
  8. data/lib/cocoapods-core/github.rb +32 -5
  9. data/lib/cocoapods-core/http.rb +86 -0
  10. data/lib/cocoapods-core/lockfile.rb +161 -56
  11. data/lib/cocoapods-core/metrics.rb +47 -0
  12. data/lib/cocoapods-core/platform.rb +99 -11
  13. data/lib/cocoapods-core/podfile/dsl.rb +623 -124
  14. data/lib/cocoapods-core/podfile/target_definition.rb +662 -109
  15. data/lib/cocoapods-core/podfile.rb +138 -65
  16. data/lib/cocoapods-core/requirement.rb +37 -8
  17. data/lib/cocoapods-core/source/acceptor.rb +16 -13
  18. data/lib/cocoapods-core/source/aggregate.rb +79 -103
  19. data/lib/cocoapods-core/source/health_reporter.rb +9 -18
  20. data/lib/cocoapods-core/source/manager.rb +488 -0
  21. data/lib/cocoapods-core/source/metadata.rb +79 -0
  22. data/lib/cocoapods-core/source.rb +241 -70
  23. data/lib/cocoapods-core/specification/consumer.rb +187 -47
  24. data/lib/cocoapods-core/specification/dsl/attribute.rb +49 -85
  25. data/lib/cocoapods-core/specification/dsl/attribute_support.rb +6 -8
  26. data/lib/cocoapods-core/specification/dsl/deprecations.rb +9 -126
  27. data/lib/cocoapods-core/specification/dsl/platform_proxy.rb +30 -20
  28. data/lib/cocoapods-core/specification/dsl.rb +943 -296
  29. data/lib/cocoapods-core/specification/json.rb +64 -23
  30. data/lib/cocoapods-core/specification/linter/analyzer.rb +218 -0
  31. data/lib/cocoapods-core/specification/linter/result.rb +128 -0
  32. data/lib/cocoapods-core/specification/linter.rb +310 -309
  33. data/lib/cocoapods-core/specification/root_attribute_accessors.rb +90 -39
  34. data/lib/cocoapods-core/specification/set/presenter.rb +35 -71
  35. data/lib/cocoapods-core/specification/set.rb +42 -96
  36. data/lib/cocoapods-core/specification.rb +368 -130
  37. data/lib/cocoapods-core/standard_error.rb +45 -24
  38. data/lib/cocoapods-core/trunk_source.rb +14 -0
  39. data/lib/cocoapods-core/vendor/requirement.rb +133 -53
  40. data/lib/cocoapods-core/vendor/version.rb +197 -156
  41. data/lib/cocoapods-core/vendor.rb +1 -5
  42. data/lib/cocoapods-core/version.rb +137 -42
  43. data/lib/cocoapods-core/yaml_helper.rb +334 -0
  44. data/lib/cocoapods-core.rb +10 -4
  45. metadata +100 -27
  46. data/lib/cocoapods-core/source/abstract_data_provider.rb +0 -71
  47. data/lib/cocoapods-core/source/file_system_data_provider.rb +0 -150
  48. data/lib/cocoapods-core/source/github_data_provider.rb +0 -143
  49. data/lib/cocoapods-core/specification/set/statistics.rb +0 -266
  50. data/lib/cocoapods-core/yaml_converter.rb +0 -192
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Pod::Vendor
2
3
 
3
4
  ##
@@ -24,6 +25,11 @@ module Pod::Vendor
24
25
  # 3. 1.0.a.2
25
26
  # 4. 0.9
26
27
  #
28
+ # If you want to specify a version restriction that includes both prereleases
29
+ # and regular releases of the 1.x series this is the best way:
30
+ #
31
+ # s.add_dependency 'example', '>= 1.0.0.a', '< 2.0.0'
32
+ #
27
33
  # == How Software Changes
28
34
  #
29
35
  # Users expect to be able to specify a version constraint that gives them
@@ -83,8 +89,8 @@ module Pod::Vendor
83
89
  #
84
90
  # * Any "public" release of a gem should have a different version. Normally
85
91
  # that means incrementing the build number. This means a developer can
86
- # generate builds all day long for himself, but as soon as he/she makes a
87
- # public release, the version must be updated.
92
+ # generate builds all day long, but as soon as they make a public release,
93
+ # the version must be updated.
88
94
  #
89
95
  # === Examples
90
96
  #
@@ -101,26 +107,25 @@ module Pod::Vendor
101
107
  # Version 1.1.1:: Fixed a bug in the linked list implementation.
102
108
  # Version 1.1.2:: Fixed a bug introduced in the last fix.
103
109
  #
104
- # Client A needs a stack with basic push/pop capability. He writes to the
105
- # original interface (no <tt>top</tt>), so his version constraint looks
106
- # like:
110
+ # Client A needs a stack with basic push/pop capability. They write to the
111
+ # original interface (no <tt>top</tt>), so their version constraint looks like:
107
112
  #
108
- # gem 'stack', '~> 0.0'
113
+ # gem 'stack', '>= 0.0'
109
114
  #
110
115
  # Essentially, any version is OK with Client A. An incompatible change to
111
- # the library will cause him grief, but he is willing to take the chance (we
112
- # call Client A optimistic).
116
+ # the library will cause them grief, but they are willing to take the chance
117
+ # (we call Client A optimistic).
113
118
  #
114
- # Client B is just like Client A except for two things: (1) He uses the
115
- # <tt>depth</tt> method and (2) he is worried about future
116
- # incompatibilities, so he writes his version constraint like this:
119
+ # Client B is just like Client A except for two things: (1) They use the
120
+ # <tt>depth</tt> method and (2) they are worried about future
121
+ # incompatibilities, so they write their version constraint like this:
117
122
  #
118
123
  # gem 'stack', '~> 0.1'
119
124
  #
120
125
  # The <tt>depth</tt> method was introduced in version 0.1.0, so that version
121
126
  # or anything later is fine, as long as the version stays below version 1.0
122
127
  # where incompatibilities are introduced. We call Client B pessimistic
123
- # because he is worried about incompatible future changes (it is OK to be
128
+ # because they are worried about incompatible future changes (it is OK to be
124
129
  # pessimistic!).
125
130
  #
126
131
  # == Preventing Version Catastrophe:
@@ -131,8 +136,8 @@ module Pod::Vendor
131
136
  # specify your dependency as ">= 2.0.0" then, you're good, right? What
132
137
  # happens if fnord 3.0 comes out and it isn't backwards compatible
133
138
  # with 2.y.z? Your stuff will break as a result of using ">=". The
134
- # better route is to specify your dependency with a "spermy" version
135
- # specifier. They're a tad confusing, so here is how the dependency
139
+ # better route is to specify your dependency with an "approximate" version
140
+ # specifier ("~>"). They're a tad confusing, so here is how the dependency
136
141
  # specifiers work:
137
142
  #
138
143
  # Specification From ... To (exclusive)
@@ -141,196 +146,232 @@ module Pod::Vendor
141
146
  # "~> 3.0.0" 3.0.0 ... 3.1
142
147
  # "~> 3.5" 3.5 ... 4.0
143
148
  # "~> 3.5.0" 3.5.0 ... 3.6
149
+ # "~> 3" 3.0 ... 4.0
150
+ #
151
+ # For the last example, single-digit versions are automatically extended with
152
+ # a zero to give a sensible result.
144
153
 
145
- module Gem
146
- class Version
147
- autoload :Requirement, 'rubygems/requirement'
154
+ class Gem::Version
155
+ autoload :Requirement, 'rubygems/requirement'
148
156
 
149
- include Comparable
157
+ include Comparable
150
158
 
151
- VERSION_PATTERN = '[0-9]+(\.[0-9a-zA-Z]+)*' # :nodoc:
152
- ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})*\s*\z/ # :nodoc:
159
+ VERSION_PATTERN = '[0-9]+(?>\.[0-9a-zA-Z]+)*(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?' # :nodoc:
160
+ ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/ # :nodoc:
153
161
 
154
- ##
155
- # A string representation of this Version.
162
+ ##
163
+ # A string representation of this Version.
156
164
 
157
- attr_reader :version
158
- alias_method :to_s, :version
165
+ def version
166
+ @version.dup
167
+ end
159
168
 
160
- ##
161
- # True if the +version+ string matches RubyGems' requirements.
169
+ alias to_s version
162
170
 
163
- def self.correct?(version)
164
- version.to_s =~ ANCHORED_VERSION_PATTERN
165
- end
171
+ ##
172
+ # True if the +version+ string matches RubyGems' requirements.
166
173
 
167
- ##
168
- # Factory method to create a Version object. Input may be a Version
169
- # or a String. Intended to simplify client code.
170
- #
171
- # ver1 = Version.create('1.3.17') # -> (Version object)
172
- # ver2 = Version.create(ver1) # -> (ver1)
173
- # ver3 = Version.create(nil) # -> nil
174
-
175
- def self.create(input)
176
- if input.respond_to? :version then
177
- input
178
- elsif input.nil? then
179
- nil
180
- else
181
- new input
182
- end
183
- end
174
+ def self.correct? version
175
+ version.to_s =~ ANCHORED_VERSION_PATTERN
176
+ end
184
177
 
185
- ##
186
- # Constructs a Version from the +version+ string. A version string is a
187
- # series of digits or ASCII letters separated by dots.
178
+ ##
179
+ # Factory method to create a Version object. Input may be a Version
180
+ # or a String. Intended to simplify client code.
181
+ #
182
+ # ver1 = Version.create('1.3.17') # -> (Version object)
183
+ # ver2 = Version.create(ver1) # -> (ver1)
184
+ # ver3 = Version.create(nil) # -> nil
185
+
186
+ def self.create input
187
+ if self === input then # check yourself before you wreck yourself
188
+ input
189
+ elsif input.nil? then
190
+ nil
191
+ else
192
+ new input
193
+ end
194
+ end
188
195
 
189
- def initialize(version)
190
- unless self.class.correct?(version)
191
- raise ArgumentError, "Malformed version number string #{version}"
192
- end
196
+ @@all = {}
193
197
 
194
- @version = version.to_s
195
- @version.strip!
196
- end
198
+ def self.new version # :nodoc:
199
+ return super unless Gem::Version == self
197
200
 
198
- ##
199
- # Return a new version object where the next to the last revision
200
- # number is one greater (e.g., 5.3.1 => 5.4).
201
- #
202
- # Pre-release (alpha) parts, e.g, 5.3.1.b.2 => 5.4, are ignored.
201
+ @@all[version] ||= super
202
+ end
203
203
 
204
- def bump
205
- segments = self.segments.dup
206
- segments.pop while segments.any? { |s| String === s }
207
- segments.pop if segments.size > 1
204
+ ##
205
+ # Constructs a Version from the +version+ string. A version string is a
206
+ # series of digits or ASCII letters separated by dots.
208
207
 
209
- segments[-1] = segments[-1].succ
210
- self.class.new segments.join(".")
211
- end
208
+ def initialize version
209
+ raise ArgumentError, "Malformed version number string #{version}" unless
210
+ self.class.correct?(version)
212
211
 
213
- ##
214
- # A Version is only eql? to another version if it's specified to the
215
- # same precision. Version "1.0" is not the same as version "1".
212
+ @version = version.to_s.strip.gsub("-",".pre.")
213
+ @segments = nil
214
+ end
216
215
 
217
- def eql?(other)
218
- self.class === other and @version == other.version
219
- end
216
+ ##
217
+ # Return a new version object where the next to the last revision
218
+ # number is one greater (e.g., 5.3.1 => 5.4).
219
+ #
220
+ # Pre-release (alpha) parts, e.g, 5.3.1.b.2 => 5.4, are ignored.
221
+
222
+ def bump
223
+ @bump ||= begin
224
+ segments = self.segments
225
+ segments.pop while segments.any? { |s| String === s }
226
+ segments.pop if segments.size > 1
227
+
228
+ segments[-1] = segments[-1].succ
229
+ self.class.new segments.join(".")
230
+ end
231
+ end
220
232
 
221
- def hash # :nodoc:
222
- @hash ||= segments.hash
223
- end
233
+ ##
234
+ # A Version is only eql? to another version if it's specified to the
235
+ # same precision. Version "1.0" is not the same as version "1".
224
236
 
225
- def init_with(coder) # :nodoc:
226
- yaml_initialize coder.tag, coder.map
227
- end
237
+ def eql? other
238
+ self.class === other and @version == other._version
239
+ end
228
240
 
229
- def inspect # :nodoc:
230
- "#<#{self.class} #{version.inspect}>"
231
- end
241
+ def hash # :nodoc:
242
+ @version.hash
243
+ end
232
244
 
233
- ##
234
- # Dump only the raw version string, not the complete object. It's a
235
- # string for backwards (RubyGems 1.3.5 and earlier) compatibility.
245
+ def init_with coder # :nodoc:
246
+ yaml_initialize coder.tag, coder.map
247
+ end
236
248
 
237
- def marshal_dump
238
- [version]
239
- end
249
+ def inspect # :nodoc:
250
+ "#<#{self.class} #{version.inspect}>"
251
+ end
240
252
 
241
- ##
242
- # Load custom marshal format. It's a string for backwards (RubyGems
243
- # 1.3.5 and earlier) compatibility.
253
+ ##
254
+ # Dump only the raw version string, not the complete object. It's a
255
+ # string for backwards (RubyGems 1.3.5 and earlier) compatibility.
244
256
 
245
- def marshal_load(array)
246
- initialize array[0]
247
- end
257
+ def marshal_dump
258
+ [version]
259
+ end
248
260
 
249
- def yaml_initialize(tag, map)
250
- @version = map['version']
251
- @segments = nil
252
- @hash = nil
253
- end
261
+ ##
262
+ # Load custom marshal format. It's a string for backwards (RubyGems
263
+ # 1.3.5 and earlier) compatibility.
254
264
 
255
- ##
256
- # A version is considered a prerelease if it contains a letter.
265
+ def marshal_load array
266
+ initialize array[0]
267
+ end
257
268
 
258
- def prerelease?
259
- @prerelease ||= @version =~ /[a-zA-Z]/
260
- end
269
+ def yaml_initialize(tag, map) # :nodoc:
270
+ @version = map['version']
271
+ @segments = nil
272
+ @hash = nil
273
+ end
261
274
 
262
- def pretty_print(q) # :nodoc:
263
- q.text "Gem::Version.new(#{version.inspect})"
264
- end
275
+ def to_yaml_properties # :nodoc:
276
+ ["@version"]
277
+ end
265
278
 
266
- ##
267
- # The release for this version (e.g. 1.2.0.a -> 1.2.0).
268
- # Non-prerelease versions return themselves.
279
+ def encode_with coder # :nodoc:
280
+ coder.add 'version', @version
281
+ end
269
282
 
270
- def release
271
- return self unless prerelease?
283
+ ##
284
+ # A version is considered a prerelease if it contains a letter.
272
285
 
273
- segments = self.segments.dup
274
- segments.pop while segments.any? { |s| String === s }
275
- self.class.new segments.join('.')
286
+ def prerelease?
287
+ unless instance_variable_defined? :@prerelease
288
+ @prerelease = !!(@version =~ /[a-zA-Z]/)
276
289
  end
290
+ @prerelease
291
+ end
277
292
 
278
- def segments # :nodoc:
279
-
280
- # segments is lazy so it can pick up version values that come from
281
- # old marshaled versions, which don't go through marshal_load.
293
+ def pretty_print q # :nodoc:
294
+ q.text "Gem::Version.new(#{version.inspect})"
295
+ end
282
296
 
283
- @segments ||= @version.scan(/[0-9]+|[a-z]+/i).map do |s|
284
- /^\d+$/ =~ s ? s.to_i : s
285
- end
286
- end
297
+ ##
298
+ # The release for this version (e.g. 1.2.0.a -> 1.2.0).
299
+ # Non-prerelease versions return themselves.
300
+
301
+ def release
302
+ @release ||= if prerelease?
303
+ segments = self.segments
304
+ segments.pop while segments.any? { |s| String === s }
305
+ self.class.new segments.join('.')
306
+ else
307
+ self
308
+ end
309
+ end
287
310
 
288
- ##
289
- # A recommended version for use with a ~> Requirement.
311
+ def segments # :nodoc:
312
+ _segments.dup
313
+ end
290
314
 
291
- def spermy_recommendation
292
- segments = self.segments.dup
315
+ ##
316
+ # A recommended version for use with a ~> Requirement.
293
317
 
294
- segments.pop while segments.any? { |s| String === s }
295
- segments.pop while segments.size > 2
296
- segments.push 0 while segments.size < 2
318
+ def approximate_recommendation
319
+ segments = self.segments
297
320
 
298
- "~> #{segments.join(".")}"
299
- end
321
+ segments.pop while segments.any? { |s| String === s }
322
+ segments.pop while segments.size > 2
323
+ segments.push 0 while segments.size < 2
300
324
 
301
- ##
302
- # Compares this version with +other+ returning -1, 0, or 1 if the
303
- # other version is larger, the same, or smaller than this
304
- # one. Attempts to compare to something that's not a
305
- # <tt>Gem::Version</tt> return +nil+.
325
+ "~> #{segments.join(".")}"
326
+ end
306
327
 
307
- def <=>(other)
308
- return unless Gem::Version === other
309
- return 0 if @version == other.version
328
+ ##
329
+ # Compares this version with +other+ returning -1, 0, or 1 if the
330
+ # other version is larger, the same, or smaller than this
331
+ # one. Attempts to compare to something that's not a
332
+ # <tt>Gem::Version</tt> return +nil+.
310
333
 
311
- lhsegments = segments
312
- rhsegments = other.segments
334
+ def <=> other
335
+ return unless Gem::Version === other
336
+ return 0 if @version == other._version
313
337
 
314
- lhsize = lhsegments.size
315
- rhsize = rhsegments.size
316
- limit = (lhsize > rhsize ? lhsize : rhsize) - 1
338
+ lhsegments = _segments
339
+ rhsegments = other._segments
317
340
 
318
- i = 0
341
+ lhsize = lhsegments.size
342
+ rhsize = rhsegments.size
343
+ limit = (lhsize > rhsize ? lhsize : rhsize) - 1
319
344
 
320
- while i <= limit
321
- lhs, rhs = lhsegments[i] || 0, rhsegments[i] || 0
322
- i += 1
345
+ i = 0
323
346
 
324
- next if lhs == rhs
325
- return -1 if String === lhs && Numeric === rhs
326
- return 1 if Numeric === lhs && String === rhs
347
+ while i <= limit
348
+ lhs, rhs = lhsegments[i] || 0, rhsegments[i] || 0
349
+ i += 1
327
350
 
328
- return lhs <=> rhs
329
- end
351
+ next if lhs == rhs
352
+ return -1 if String === lhs && Numeric === rhs
353
+ return 1 if Numeric === lhs && String === rhs
330
354
 
331
- 0
355
+ return lhs <=> rhs
332
356
  end
357
+
358
+ return 0
333
359
  end
334
360
 
361
+ protected
362
+
363
+ def _version
364
+ @version
365
+ end
366
+
367
+ def _segments
368
+ # segments is lazy so it can pick up version values that come from
369
+ # old marshaled versions, which don't go through marshal_load.
370
+ # since this version object is cached in @@all, its @segments should be frozen
371
+
372
+ @segments ||= @version.scan(/[0-9]+|[a-z]+/i).map do |s|
373
+ /^\d+$/ =~ s ? s.to_i : s
374
+ end.freeze
375
+ end
335
376
  end
336
377
  end
@@ -1,9 +1,7 @@
1
1
  module Pod
2
-
3
2
  # Namespaces the vendored modules.
4
3
  #
5
4
  module Vendor
6
-
7
5
  # Namespaces the classes of RubyGems used by CocoaPods.
8
6
  #
9
7
  # CocoaPods needs to vendor RubyGems because OS X ships with `v1.3.6` which
@@ -11,7 +9,7 @@ module Pod
11
9
  #
12
10
  # E.g. https://github.com/CocoaPods/CocoaPods/issues/398
13
11
  #
14
- # The following classes are copied from RubyGems `v1.8.24`. The changes
12
+ # The following classes are copied from RubyGems `v2.6.3`. The changes
15
13
  # performed to the source files are the following:
16
14
  #
17
15
  # - Namespaced in `Pod::Vendor`
@@ -19,7 +17,6 @@ module Pod
19
17
  # - replaced `::Gem` with `Pod::Vendor::Gem`
20
18
  #
21
19
  module Gem
22
-
23
20
  require 'cocoapods-core/vendor/version'
24
21
  require 'cocoapods-core/vendor/requirement'
25
22
 
@@ -48,7 +45,6 @@ module Pod
48
45
  # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
49
46
  # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
50
47
  # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
51
-
52
48
  end
53
49
  end
54
50
  end