cocoapods-core 0.30.0 → 1.15.2

Sign up to get free protection for your applications and to get access to all the features.
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,14 +1,12 @@
1
1
  require 'cocoapods-core/specification/dsl/attribute_support'
2
2
  require 'cocoapods-core/specification/dsl/attribute'
3
3
  require 'cocoapods-core/specification/dsl/platform_proxy'
4
- require 'cocoapods-core/specification/dsl/deprecations'
5
4
 
6
5
  module Pod
7
6
  class Specification
8
-
9
7
  #- NOTE ------------------------------------------------------------------#
10
- # The of the methods defined in this file and the order of the methods is
11
- # relevant for the documentation generated on the
8
+ # The order of the methods defined in this file and the order of the
9
+ # methods is relevant for the documentation generated on the
12
10
  # CocoaPods/cocoapods.github.com repository.
13
11
  #-------------------------------------------------------------------------#
14
12
 
@@ -35,17 +33,45 @@ module Pod
35
33
  # spec.license = { :type => 'BSD' }
36
34
  # spec.homepage = 'https://github.com/tonymillion/Reachability'
37
35
  # spec.authors = { 'Tony Million' => 'tonymillion@gmail.com' }
38
- # spec.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X. Drop in replacement for Apple Reachability.'
36
+ # spec.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X.'
39
37
  # spec.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
40
38
  # spec.source_files = 'Reachability.{h,m}'
41
39
  # spec.framework = 'SystemConfiguration'
42
- # spec.requires_arc = true
40
+ # end
41
+ #
42
+ # Or it can be quite detailed:
43
+ #
44
+ # Pod::Spec.new do |spec|
45
+ # spec.name = 'Reachability'
46
+ # spec.version = '3.1.0'
47
+ # spec.license = { :type => 'BSD' }
48
+ # spec.homepage = 'https://github.com/tonymillion/Reachability'
49
+ # spec.authors = { 'Tony Million' => 'tonymillion@gmail.com' }
50
+ # spec.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X.'
51
+ # spec.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
52
+ # spec.module_name = 'Rich'
53
+ # spec.swift_version = '4.0'
54
+ #
55
+ # spec.ios.deployment_target = '9.0'
56
+ # spec.osx.deployment_target = '10.10'
57
+ #
58
+ # spec.source_files = 'Reachability/common/*.swift'
59
+ # spec.ios.source_files = 'Reachability/ios/*.swift', 'Reachability/extensions/*.swift'
60
+ # spec.osx.source_files = 'Reachability/osx/*.swift'
61
+ #
62
+ # spec.framework = 'SystemConfiguration'
63
+ # spec.ios.framework = 'UIKit'
64
+ # spec.osx.framework = 'AppKit'
65
+ #
66
+ # spec.dependency 'SomeOtherPod'
43
67
  # end
44
68
  #
45
69
  module DSL
46
-
47
70
  extend Pod::Specification::DSL::AttributeSupport
48
71
 
72
+ # Deprecations must be required after include AttributeSupport
73
+ require 'cocoapods-core/specification/dsl/deprecations'
74
+
49
75
  #-----------------------------------------------------------------------#
50
76
 
51
77
  # @!group Root specification
@@ -79,9 +105,10 @@ module Pod
79
105
  # @param [String] name
80
106
  # the name of the pod.
81
107
  #
82
- root_attribute :name, {
83
- :required => true,
84
- }
108
+ attribute :name,
109
+ :required => true,
110
+ :inherited => false,
111
+ :multi_platform => false
85
112
 
86
113
  #------------------#
87
114
 
@@ -97,9 +124,56 @@ module Pod
97
124
  # @param [String] version
98
125
  # the version of the Pod.
99
126
  #
100
- root_attribute :version, {
101
- :required => true,
102
- }
127
+ root_attribute :version,
128
+ :required => true
129
+
130
+ #------------------#
131
+
132
+ # @!method swift_versions=(version)
133
+ #
134
+ # The versions of Swift that the specification supports. A version of '4' will be treated as
135
+ # '4.0' by CocoaPods and not '4.1' or '4.2'.
136
+ #
137
+ # **Note** The Swift compiler mostly accepts major versions and sometimes will honor minor versions.
138
+ # While CocoaPods allows specifying a minor or patch version it might not be honored fully by the Swift compiler.
139
+ #
140
+ # @example
141
+ #
142
+ # spec.swift_versions = ['3.0']
143
+ #
144
+ # @example
145
+ #
146
+ # spec.swift_versions = ['3.0', '4.0', '4.2']
147
+ #
148
+ # @example
149
+ #
150
+ # spec.swift_version = '3.0'
151
+ #
152
+ # @example
153
+ #
154
+ # spec.swift_version = '3.0', '4.0'
155
+ #
156
+ # @param [String, Array<String>] swift_versions
157
+ #
158
+ root_attribute :swift_versions,
159
+ :container => Array,
160
+ :singularize => true
161
+
162
+ #-----------------------------------------------------------------------#
163
+
164
+ # @!method cocoapods_version=(cocoapods_version)
165
+ #
166
+ # The version of CocoaPods that the specification supports.
167
+ #
168
+ # @example
169
+ #
170
+ # spec.cocoapods_version = '>= 0.36'
171
+ #
172
+ # @param [String] cocoapods_version
173
+ # the CocoaPods version that the specification supports.
174
+ # CocoaPods follows [semantic versioning](http://semver.org).
175
+ #
176
+ root_attribute :cocoapods_version
103
177
 
104
178
  #------------------#
105
179
 
@@ -124,12 +198,11 @@ module Pod
124
198
  # @param [String, Hash{String=>String}] authors
125
199
  # the list of the authors of the library and their emails.
126
200
  #
127
- root_attribute :authors, {
128
- :types => [String, Array, Hash],
129
- :container => Hash,
130
- :required => true,
131
- :singularize => true,
132
- }
201
+ root_attribute :authors,
202
+ :types => [String, Array, Hash],
203
+ :container => Hash,
204
+ :required => true,
205
+ :singularize => true
133
206
 
134
207
  #------------------#
135
208
 
@@ -156,19 +229,6 @@ module Pod
156
229
  #
157
230
  root_attribute :social_media_url
158
231
 
159
- # @!method docset_url=(docset_url)
160
- #
161
- # The URL for the docset for the Pod
162
- #
163
- # @example
164
- #
165
- # spec.docset_url = 'http://example.org/KFData/1.0.0/xcode-docset.atom'
166
- #
167
- # @param [String] docset_url
168
- # the docset URL.
169
- #
170
- root_attribute :docset_url
171
-
172
232
  #------------------#
173
233
 
174
234
  # The keys accepted by the license attribute.
@@ -184,6 +244,8 @@ module Pod
184
244
  # Unless the source contains a file named `LICENSE.*` or `LICENCE.*`,
185
245
  # the path of the license file **or** the integral text of the notice
186
246
  # commonly used for the license type must be specified.
247
+ # If a license file is specified, it either must be without a file
248
+ # extensions or be one of `txt`, `md`, or `markdown`.
187
249
  #
188
250
  # This information is used by CocoaPods to generate acknowledgement
189
251
  # files (markdown and plist) which can be used in the acknowledgements
@@ -205,16 +267,19 @@ module Pod
205
267
  # LICENSE
206
268
  # }
207
269
  #
208
- # @param [String, Hash{Symbol=>String}] license
209
- # The type of the license and the text of the grant that
210
- # allows to use the library (or the relative path to the file
211
- # that contains it).
270
+ # @param [String] license
271
+ # The type of the license
272
+ #
273
+ # @overload license=(license)
274
+ # @param [String, Hash{Symbol=>String}] license
275
+ # @option license [String] :type license type
276
+ # @option license [String] :file file containing full license text. Supports txt, md, and markdown
277
+ # @option license [String] :text full license text
212
278
  #
213
- root_attribute :license, {
214
- :container => Hash,
215
- :keys => LICENSE_KEYS,
216
- :required => true,
217
- }
279
+ root_attribute :license,
280
+ :container => Hash,
281
+ :keys => LICENSE_KEYS,
282
+ :required => true
218
283
 
219
284
  #------------------#
220
285
 
@@ -224,25 +289,53 @@ module Pod
224
289
  #
225
290
  # @example
226
291
  #
227
- # spec.homepage = 'www.example.com'
292
+ # spec.homepage = 'http://www.example.com'
228
293
  #
229
294
  # @param [String] homepage
230
295
  # the URL of the homepage of the Pod.
231
296
  #
232
- root_attribute :homepage, {
233
- :required => true,
234
- }
297
+ root_attribute :homepage,
298
+ :required => true
299
+
300
+ #------------------#
301
+
302
+ # @!method readme=(readme)
303
+ #
304
+ # The URL for the README markdown file for this pod version.
305
+ #
306
+ # @example
307
+ #
308
+ # spec.readme = 'https://www.example.com/Pod-1.5-README.md'
309
+ #
310
+ # @param [String] readme
311
+ # the readme markdown URL.
312
+ #
313
+ root_attribute :readme
314
+
315
+ #------------------#
316
+
317
+ # @!method changelog=(changelog)
318
+ #
319
+ # The URL for the CHANGELOG markdown file for this pod version.
320
+ #
321
+ # @example
322
+ #
323
+ # spec.changelog = 'https://www.example.com/Pod-1.5-CHANGELOG.md'
324
+ #
325
+ # @param [String] changelog
326
+ # the changelog markdown URL.
327
+ #
328
+ root_attribute :changelog
235
329
 
236
330
  #------------------#
237
331
 
238
332
  # The keys accepted by the hash of the source attribute.
239
333
  #
240
334
  SOURCE_KEYS = {
241
- :git => [:tag, :branch, :commit, :submodules],
242
- :svn => [:folder, :tag, :revision],
243
- :hg => [:revision],
244
- :http => nil,
245
- :path => nil,
335
+ :git => [:tag, :branch, :commit, :submodules].freeze,
336
+ :svn => [:folder, :tag, :revision].freeze,
337
+ :hg => [:revision].freeze,
338
+ :http => [:flatten, :type, :sha256, :sha1, :headers].freeze,
246
339
  }.freeze
247
340
 
248
341
  # @!method source=(source)
@@ -252,38 +345,61 @@ module Pod
252
345
  # @example Specifying a Git source with a tag. This is how most OSS Podspecs work.
253
346
  #
254
347
  # spec.source = { :git => 'https://github.com/AFNetworking/AFNetworking.git',
255
- # :tag => 'v0.0.1' }
348
+ # :tag => spec.version.to_s }
256
349
  #
257
- # @example Using the version of the Pod to identify the Git commit and using submodules.
350
+ # @example Using a tag prefixed with 'v' and submodules.
258
351
  #
259
- # spec.source = { :git => 'https://github.com/AFNetworking/AFNetworking.git',
260
- # :commit => "v#{spec.version}", :submodules => true }
261
- #
262
- # @example Using the version of the Pod to identify the Git branch.
263
- #
264
- # spec.source = { :git => 'https://github.com/AFNetworking/AFNetworking.git',
265
- # :branch => "orta_fixes"}
352
+ # spec.source = { :git => 'https://github.com/typhoon-framework/Typhoon.git',
353
+ # :tag => "v#{spec.version}", :submodules => true }
266
354
  #
267
355
  # @example Using Subversion with a tag.
268
356
  #
269
- # spec.source = { :svn => "http://svn.code.sf.net/p/polyclipping/code", :tag => '4.8.8' }
357
+ # spec.source = { :svn => 'http://svn.code.sf.net/p/polyclipping/code', :tag => '4.8.8' }
270
358
  #
271
359
  # @example Using Mercurial with the same revision as the spec's semantic version string.
272
360
  #
273
- # spec.source = { :hg => "https://bitbucket.org/dcutting/hyperbek", :revision => "#{s.version}" }
361
+ # spec.source = { :hg => 'https://bitbucket.org/dcutting/hyperbek', :revision => "#{s.version}" }
274
362
  #
275
363
  # @example Using HTTP to download a compressed file of the code. It supports zip, tgz, bz2, txz and tar.
276
364
  #
277
- # spec.source = { :http => "http://dev.wechatapp.com/download/sdk/WeChat_SDK_iOS_en.zip" }
365
+ # spec.source = { :http => 'http://dev.wechatapp.com/download/sdk/WeChat_SDK_iOS_en.zip' }
366
+ #
367
+ # @example Using HTTP to download a file using a hash to verify the download. It supports sha1 and sha256.
278
368
  #
279
- # @param [Hash{Symbol=>String}] source
280
- # The location from where the library should be retrieved.
369
+ # spec.source = { :http => 'http://dev.wechatapp.com/download/sdk/WeChat_SDK_iOS_en.zip',
370
+ # :sha1 => '7e21857fe11a511f472cfd7cfa2d979bd7ab7d96' }
281
371
  #
282
- root_attribute :source, {
283
- :container => Hash,
284
- :keys => SOURCE_KEYS,
285
- :required => true,
286
- }
372
+ #
373
+ # @overload source=(git)
374
+ # @param [Hash] git
375
+ # @option git [String] :git git source URI
376
+ # @option git [String] :tag version tag
377
+ # @option git [Boolean] :submodules Whether to checkout submodules
378
+ # @option git [String] :branch branch name
379
+ # @option git [String] :commit commit hash
380
+ #
381
+ # @overload source=(svn)
382
+ # @param [Hash] svn
383
+ # @option svn [String] :svn svn source URI
384
+ # @option svn [String] :tag version tag
385
+ # @option svn [String] :folder folder
386
+ # @option svn [String] :revision revision
387
+ #
388
+ # @overload source=(hg)
389
+ # @param [Hash] hg
390
+ # @option hg [String] :hg mercurial source URI
391
+ # @option hg [String] :revision revision
392
+ #
393
+ # @overload source=(http)
394
+ # @param [Hash] http
395
+ # @option http [String] :http compressed source URL
396
+ # @option http [String] :type file type. Supports zip, tgz, bz2, txz and tar
397
+ # @option http [String] :sha1 SHA hash. Supports SHA1 and SHA256
398
+ #
399
+ root_attribute :source,
400
+ :container => Hash,
401
+ :keys => SOURCE_KEYS,
402
+ :required => true
287
403
 
288
404
  #------------------#
289
405
 
@@ -297,7 +413,7 @@ module Pod
297
413
  # tag line of the Pod and there is no need to specify that a Pod is a
298
414
  # library (they always are).
299
415
  #
300
- # The summary is expected to be properly capitalized and containing the
416
+ # The summary is expected to be properly capitalised and containing the
301
417
  # correct punctuation.
302
418
  #
303
419
  # @example
@@ -307,9 +423,8 @@ module Pod
307
423
  # @param [String] summary
308
424
  # A short description of the Pod.
309
425
  #
310
- root_attribute :summary, {
311
- :required => true,
312
- }
426
+ root_attribute :summary,
427
+ :required => true
313
428
 
314
429
  #------------------#
315
430
 
@@ -337,36 +452,35 @@ module Pod
337
452
  # @!method screenshots=(screenshots)
338
453
  #
339
454
  # A list of URLs to images showcasing the Pod. Intended for UI oriented
340
- # libraries.
455
+ # libraries. CocoaPods recommends the usage of the `gif` format.
341
456
  #
342
457
  # @example
343
458
  #
344
- # spec.screenshot = "http://dl.dropbox.com/u/378729/MBProgressHUD/1.png"
459
+ # spec.screenshot = 'http://dl.dropbox.com/u/378729/MBProgressHUD/1.png'
345
460
  #
346
461
  # @example
347
462
  #
348
- # spec.screenshots = [ "http://dl.dropbox.com/u/378729/MBProgressHUD/1.png",
349
- # "http://dl.dropbox.com/u/378729/MBProgressHUD/2.png" ]
463
+ # spec.screenshots = [ 'http://dl.dropbox.com/u/378729/MBProgressHUD/1.png',
464
+ # 'http://dl.dropbox.com/u/378729/MBProgressHUD/2.png' ]
350
465
  #
351
466
  # @param [String] screenshots
352
467
  # An URL for the screenshot of the Pod.
353
468
  #
354
- root_attribute :screenshots, {
355
- :singularize => true,
356
- :container => Array,
357
- }
469
+ root_attribute :screenshots,
470
+ :singularize => true,
471
+ :container => Array
358
472
 
359
473
  #------------------#
360
474
 
361
475
  # @!method documentation_url=(documentation_url)
362
476
  #
363
- # An optional URL for the documentation of the Pod which will be honored by
477
+ # An optional URL for the documentation of the Pod which will be honoured by
364
478
  # CocoaPods web properties. Leaving it blank will default to a CocoaDocs
365
479
  # generated URL for your library.
366
480
  #
367
481
  # @example
368
482
  #
369
- # spec.documentation_url = 'www.example.com/docs.html'
483
+ # spec.documentation_url = 'http://www.example.com/docs.html'
370
484
  #
371
485
  # @param [String] documentation_url
372
486
  # The link of the web documentation of the Pod.
@@ -405,11 +519,61 @@ module Pod
405
519
  #
406
520
  root_attribute :prepare_command
407
521
 
522
+ #------------------#
523
+
524
+ # @!method static_framework=(flag)
525
+ #
526
+ # Indicates, that if use_frameworks! is specified, the
527
+ # pod should include a static library framework.
528
+ #
529
+ # @example
530
+ #
531
+ # spec.static_framework = true
532
+ #
533
+ # @param [Boolean] flag
534
+ # Indicates, that if use_frameworks! is specified, the
535
+ # pod should include a static library framework.
536
+ #
537
+ root_attribute :static_framework,
538
+ :types => [TrueClass, FalseClass],
539
+ :default_value => false
540
+
541
+ #------------------#
542
+
543
+ # @!method deprecated=(flag)
544
+ #
545
+ # Whether the library has been deprecated.
546
+ #
547
+ # @example
548
+ #
549
+ # spec.deprecated = true
550
+ #
551
+ # @param [Boolean] flag
552
+ # whether the library has been deprecated.
553
+ #
554
+ root_attribute :deprecated,
555
+ :types => [TrueClass, FalseClass],
556
+ :default_value => false
557
+
558
+ # @!method deprecated_in_favor_of=(deprecated_in_favor_of)
559
+ #
560
+ # The name of the Pod that this one has been deprecated in favor of.
561
+ #
562
+ # @example
563
+ #
564
+ # spec.deprecated_in_favor_of = 'NewMoreAwesomePod'
565
+ #
566
+ # @param [String] deprecated_in_favor_of
567
+ # the name of the Pod that this one has been deprecated in
568
+ # favor of.
569
+ #
570
+ root_attribute :deprecated_in_favor_of
571
+
408
572
  #-----------------------------------------------------------------------#
409
573
 
410
574
  # @!group Platform
411
575
  #
412
- # A specification should indicate the platforms and the correspondent
576
+ # A specification should indicate the platform and the correspondent
413
577
  # deployment targets on which the library is supported.
414
578
  #
415
579
  # If not defined in a subspec the attributes of this group inherit the
@@ -419,23 +583,23 @@ module Pod
419
583
 
420
584
  # The names of the platforms supported by the specification class.
421
585
  #
422
- PLATFORMS = [:osx, :ios].freeze
586
+ PLATFORMS = [:osx, :ios, :tvos, :visionos, :watchos].freeze
423
587
 
424
588
  # @todo This currently is not used in the Ruby DSL.
425
589
  #
426
- attribute :platforms, {
427
- :container => Hash,
428
- :keys => PLATFORMS,
429
- :multi_platform => false,
430
- :inherited => true,
431
- }
590
+ attribute :platforms,
591
+ :container => Hash,
592
+ :keys => PLATFORMS,
593
+ :multi_platform => false,
594
+ :inherited => true
432
595
 
433
596
  # The platform on which this Pod is supported. Leaving this blank
434
- # means the Pod is supported on all platforms.
597
+ # means the Pod is supported on all platforms. When supporting multiple
598
+ # platforms you should use deployment_target below instead.
435
599
  #
436
600
  # @example
437
601
  #
438
- # spec.platform = :osx, "10.8"
602
+ # spec.platform = :osx, '10.8'
439
603
  #
440
604
  # @example
441
605
  #
@@ -452,62 +616,36 @@ module Pod
452
616
  #
453
617
  def platform=(args)
454
618
  name, deployment_target = args
455
- if name
456
- attributes_hash["platforms"] = { name.to_s => deployment_target }
457
- else
458
- attributes_hash["platforms"] = {}
459
- end
619
+ name = :osx if name.to_s == 'macos'
620
+ attributes_hash['platforms'] = if name
621
+ { name.to_s => deployment_target }
622
+ else
623
+ {}
624
+ end
460
625
  end
461
626
 
462
627
  #------------------#
463
628
 
464
629
  # The minimum deployment targets of the supported platforms.
465
630
  #
466
- # ---
467
- #
468
- # The following behavior is regarding the use of GCD and the
469
- # `OS_OBJECT_USE_OBJC` flag. When set to `0`, it will allow code to use
470
- # `dispatch_release()` on >= iOS 6.0 and OS X >= 10.8.
471
- #
472
- # * New libraries that do *not* require ARC don’t need to care about this
473
- # issue at all.
474
- #
475
- # * New libraries that *do* require ARC _and_ have a deployment target of
476
- # >= iOS 6.0 or OS X >= 10.8:
477
- #
478
- # These *no longer* use `dispatch_release()` and should have the
479
- # `OS_OBJECT_USE_OBJC` flag set to `1`.
480
- #
481
- # **Note:** this means that these libraries *have* to specify the
482
- # deployment target in their specifications in order to have
483
- # CocoaPods set the flag to `1` and ensure proper behavior.
484
- #
485
- # * New libraries that *do* require ARC, but have a deployment target of
486
- # < iOS 6.0 or OS X < 10.8:
487
- #
488
- # These contain `dispatch_release()` calls and as such need the
489
- # `OS_OBJECT_USE_OBJC` flag set to `0`.
490
- #
491
- # **Note:** libraries that do *not* specify a platform version are
492
- # assumed to have a deployment target of < iOS 6.0 or OS X < 10.8.
493
- #
494
- # For more information, see: http://opensource.apple.com/source/libdispatch/libdispatch-228.18/os/object.h
495
- #
631
+ # As opposed to the `platform` attribute, the `deployment_target`
632
+ # attribute allows to specify multiple platforms on which this pod
633
+ # is supported specifying a different deployment target for each.
496
634
  #
497
635
  # @example
498
636
  #
499
- # spec.ios.deployment_target = "6.0"
637
+ # spec.ios.deployment_target = '6.0'
500
638
  #
501
639
  # @example
502
640
  #
503
- # spec.osx.deployment_target = "10.8"
641
+ # spec.osx.deployment_target = '10.8'
504
642
  #
505
- # @param [String] args
643
+ # @param [String] _args
506
644
  # The deployment target of the platform.
507
645
  #
508
- def deployment_target=(*args)
509
- raise Informative, "The deployment target can be declared only per " \
510
- "platform."
646
+ def deployment_target=(*_args)
647
+ raise Informative, 'The deployment target can be declared only per ' \
648
+ 'platform.'
511
649
  end
512
650
 
513
651
  #-----------------------------------------------------------------------#
@@ -524,16 +662,15 @@ module Pod
524
662
 
525
663
  # @todo This currently is not used in the Ruby DSL.
526
664
  #
527
- attribute :dependencies, {
528
- :container => Hash,
529
- :inherited => true,
530
- }
665
+ attribute :dependencies,
666
+ :container => Hash,
667
+ :inherited => true
531
668
 
532
669
  # Any dependency on other Pods or to a ‘sub-specification’.
533
670
  #
534
671
  # ---
535
672
  #
536
- # Dependencies can specify versions requirements. The use of the approximate
673
+ # Dependencies can specify versions requirements. The use of the optimistic
537
674
  # version indicator `~>` is recommended because it provides good
538
675
  # control over the version without being too restrictive. For example,
539
676
  # `~> 1.0.1` is equivalent to `>= 1.0.1` combined with `< 1.1`. Similarly,
@@ -546,6 +683,12 @@ module Pod
546
683
  # spec.dependency 'AFNetworking', '~> 1.0'
547
684
  #
548
685
  # @example
686
+ # spec.dependency 'AFNetworking', '~> 1.0', :configurations => ['Debug']
687
+ #
688
+ # @example
689
+ # spec.dependency 'AFNetworking', '~> 1.0', :configurations => :debug
690
+ #
691
+ # @example
549
692
  # spec.dependency 'RestKit/CoreData', '~> 0.20.0'
550
693
  #
551
694
  # @example
@@ -555,51 +698,127 @@ module Pod
555
698
  name, *version_requirements = args
556
699
  if name == self.name
557
700
  raise Informative, "A specification can't require itself as a " \
558
- "subspec"
701
+ 'subspec'
559
702
  end
560
703
  if @parent
561
- composed_name = ""
562
- @parent.name.split("/").each do |component|
704
+ composed_name = ''
705
+ @parent.name.split('/').each do |component|
563
706
  composed_name << component
564
707
  if name == composed_name
565
708
  raise Informative, "A subspec can't require one of its " \
566
- "parents specifications"
709
+ 'parents specifications'
567
710
  else
568
- composed_name << "/"
711
+ composed_name << '/'
569
712
  end
570
713
  end
571
714
  end
572
- unless version_requirements.all? { |req| req.is_a?(String) }
573
- raise Informative, "Unsupported version requirements"
715
+
716
+ configurations_option = version_requirements.find { |option| option.is_a?(Hash) && option.key?(:configurations) }
717
+ whitelisted_configurations = if configurations_option
718
+ version_requirements.delete(configurations_option)
719
+ Array(configurations_option.delete(:configurations)).map { |c| c.to_s.downcase }
720
+ end
721
+
722
+ dependency_options = version_requirements.reject { |req| req.is_a?(String) }
723
+ dependency_options.each do |dependency_option|
724
+ if dependency_option.is_a?(Hash)
725
+ if !dependency_option[:path].nil?
726
+ raise Informative, 'Podspecs cannot specify the source of dependencies. The `:path` option is not supported.'\
727
+ ' `:path` can be used in the Podfile instead to override global dependencies.'
728
+ elsif !dependency_option[:git].nil?
729
+ raise Informative, 'Podspecs cannot specify the source of dependencies. The `:git` option is not supported.'\
730
+ ' `:git` can be used in the Podfile instead to override global dependencies.'
731
+ end
732
+ end
733
+
734
+ raise Informative, "Unsupported version requirements. #{version_requirements.inspect} is not valid."
735
+ end
736
+
737
+ attributes_hash['dependencies'] ||= {}
738
+ attributes_hash['dependencies'][name] = version_requirements
739
+
740
+ unless whitelisted_configurations.nil?
741
+ if (extras = whitelisted_configurations - %w(debug release)) && !extras.empty?
742
+ raise Informative, "Only `Debug` & `Release` are allowed under configurations for dependency on `#{name}`. " \
743
+ "Found #{extras.map { |configuration| "`#{configuration}`" }.to_sentence}."
744
+ end
745
+ attributes_hash['configuration_pod_whitelist'] ||= {}
746
+ attributes_hash['configuration_pod_whitelist'][name] = whitelisted_configurations
574
747
  end
575
- attributes_hash["dependencies"] ||= {}
576
- attributes_hash["dependencies"][name] = version_requirements
577
748
  end
578
749
 
750
+ def dependency=(args)
751
+ joined = args.join('\', \'')
752
+ arguments = "\'#{joined}\'"
753
+ raise Informative, "Cannot assign value to `dependency`. Did you mean: `dependency #{arguments}`?"
754
+ end
755
+
756
+ #------------------#
757
+
758
+ # @!method info_plist=(info_plist)
759
+ #
760
+ # Key-Value pairs to add to the generated `Info.plist`.
761
+ #
762
+ # The values will be merged with the default values that
763
+ # CocoaPods generates, overriding any duplicates.
764
+ #
765
+ # For library specs, the values will be merged into the generated Info.plist
766
+ # for libraries that are integrated using frameworks. It will have no effect
767
+ # for static libraries.
768
+ #
769
+ # Subspecs (other than app and test specs) are not supported.
770
+ #
771
+ # For app specs, the values will be merged into the application host's `Info.plist`.
772
+ #
773
+ # For test specs, the values will be merged into the test bundle's `Info.plist`.
774
+ #
775
+ # @example
776
+ #
777
+ # spec.info_plist = {
778
+ # 'CFBundleIdentifier' => 'com.myorg.MyLib',
779
+ # 'MY_VAR' => 'SOME_VALUE'
780
+ # }
781
+ #
782
+ # @param [Hash] info_plist
783
+ # The Info.plist values for the Pod.
784
+ #
785
+ attribute :info_plist,
786
+ :container => Hash,
787
+ :inherited => false
788
+
579
789
  #------------------#
580
790
 
581
791
  # @!method requires_arc=(flag)
582
792
  #
583
- # Wether the library requires ARC to be compiled. If true the
584
- # `-fobjc-arc` flag will be added to the compiler flags.
793
+ # `requires_arc` allows you to specify which source_files use ARC.
794
+ # This can either be the files which support ARC, or true to indicate
795
+ # all of the source_files use ARC.
585
796
  #
586
- # ---
797
+ # Files which do not use ARC will have the `-fno-objc-arc` compiler
798
+ # flag.
799
+ #
800
+ # The default value of this attribute is `true`.
801
+ #
802
+ # @example
803
+ #
804
+ # spec.requires_arc = false
587
805
  #
588
- # The default value of this attribute is __transitioning__ from `false`
589
- # to `true`, and in the meanwhile this attribute is always required.
806
+ # @example
807
+ #
808
+ # spec.requires_arc = 'Classes/Arc'
590
809
  #
591
810
  # @example
592
811
  #
593
- # spec.requires_arc = true
812
+ # spec.requires_arc = ['Classes/*ARC.m', 'Classes/ARC.mm']
594
813
  #
595
- # @param [Bool] flag
596
- # whether the source files require ARC.
814
+ # @param [Bool, String, Array<String>] flag
815
+ # whether the source files require ARC.
597
816
  #
598
- attribute :requires_arc, {
599
- :types => [TrueClass, FalseClass],
600
- :default_value => false,
601
- :inherited => true,
602
- }
817
+ attribute :requires_arc,
818
+ :types => [TrueClass, FalseClass, String, Array],
819
+ :file_patterns => true,
820
+ :default_value => true,
821
+ :inherited => true
603
822
 
604
823
  #------------------#
605
824
 
@@ -619,11 +838,10 @@ module Pod
619
838
  # @param [String, Array<String>] frameworks
620
839
  # A list of framework names.
621
840
  #
622
- attribute :frameworks, {
623
- :container => Array,
624
- :singularize => true,
625
- :inherited => true,
626
- }
841
+ attribute :frameworks,
842
+ :container => Array,
843
+ :singularize => true,
844
+ :inherited => true
627
845
 
628
846
  #------------------#
629
847
 
@@ -636,20 +854,23 @@ module Pod
636
854
  #
637
855
  # spec.weak_framework = 'Twitter'
638
856
  #
857
+ # @example
858
+ #
859
+ # spec.weak_frameworks = 'Twitter', 'SafariServices'
860
+ #
639
861
  # @param [String, Array<String>] weak_frameworks
640
862
  # A list of frameworks names.
641
863
  #
642
- attribute :weak_frameworks, {
643
- :container => Array,
644
- :singularize => true,
645
- :inherited => true,
646
- }
864
+ attribute :weak_frameworks,
865
+ :container => Array,
866
+ :singularize => true,
867
+ :inherited => true
647
868
 
648
869
  #------------------#
649
870
 
650
871
  # @!method libraries=(*libraries)
651
872
  #
652
- # A list of libraries that the user’s target (application) needs to
873
+ # A list of system libraries that the user’s target (application) needs to
653
874
  # link against.
654
875
  #
655
876
  # @example
@@ -663,11 +884,10 @@ module Pod
663
884
  # @param [String, Array<String>] libraries
664
885
  # A list of library names.
665
886
  #
666
- attribute :libraries, {
667
- :container => Array,
668
- :singularize => true,
669
- :inherited => true,
670
- }
887
+ attribute :libraries,
888
+ :container => Array,
889
+ :singularize => true,
890
+ :inherited => true
671
891
 
672
892
  #------------------#
673
893
 
@@ -682,29 +902,62 @@ module Pod
682
902
  # @param [String, Array<String>] flags
683
903
  # A list of flags.
684
904
  #
685
- attribute :compiler_flags, {
686
- :container => Array,
687
- :singularize => true,
688
- :inherited => true,
689
- }
905
+ attribute :compiler_flags,
906
+ :container => Array,
907
+ :singularize => true,
908
+ :inherited => true
690
909
 
691
910
  #------------------#
692
911
 
693
- # @!method xcconfig=(value)
912
+ # @!method pod_target_xcconfig=(value)
913
+ #
914
+ # Any flag to add to the final __private__ pod target xcconfig file.
915
+ #
916
+ # @example
917
+ #
918
+ # spec.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-lObjC' }
919
+ #
920
+ # @param [Hash{String => String}] value
921
+ # Key-value pairs representing build settings.
922
+ #
923
+ attribute :pod_target_xcconfig,
924
+ :container => Hash,
925
+ :inherited => true
926
+
927
+ # @!method user_target_xcconfig=(value)
928
+ #
929
+ # Specifies flags to add to the final aggregate target xcconfig file,
930
+ # which propagates to non-overridden and inheriting build settings to
931
+ # the integrated user targets.
932
+ #
933
+ # ---
934
+ #
935
+ # This attribute is __not recommended__ as Pods should not pollute the
936
+ # build settings of the user project and this can cause conflicts.
937
+ #
938
+ # Multiple definitions for build settings that take multiple values
939
+ # will be merged. The user is warned on conflicting definitions for
940
+ # custom build settings and build settings that take only one value.
694
941
  #
695
- # Any flag to add to the final xcconfig file.
942
+ # Typically clang compiler flags or precompiler macro definitions go
943
+ # in here if they are required when importing the pod in the user
944
+ # target. Note that, this influences not only the compiler view of the
945
+ # public interface of your pod, but also all other integrated pods
946
+ # alongside to yours. You should always prefer [`pod_target_xcconfig`](
947
+ # http://guides.cocoapods.org/syntax/podspec.html#pod_target_xcconfig),
948
+ # which can contain the same settings, but only influence the
949
+ # toolchain when compiling your pod target.
696
950
  #
697
951
  # @example
698
952
  #
699
- # spec.xcconfig = { 'OTHER_LDFLAGS' => '-lObjC' }
953
+ # spec.user_target_xcconfig = { 'MY_SUBSPEC' => 'YES' }
700
954
  #
701
955
  # @param [Hash{String => String}] value
702
- # A representing an xcconfig.
956
+ # Key-value pairs representing build settings.
703
957
  #
704
- attribute :xcconfig, {
705
- :container => Hash,
706
- :inherited => true,
707
- }
958
+ attribute :user_target_xcconfig,
959
+ :container => Hash,
960
+ :inherited => true
708
961
 
709
962
  #------------------#
710
963
 
@@ -728,10 +981,9 @@ module Pod
728
981
  # @param [String] content
729
982
  # The contents of the prefix header.
730
983
  #
731
- attribute :prefix_header_contents, {
732
- :types => [Array, String],
733
- :inherited => true,
734
- }
984
+ attribute :prefix_header_contents,
985
+ :types => [Array, String],
986
+ :inherited => true
735
987
 
736
988
  #------------------#
737
989
 
@@ -739,22 +991,50 @@ module Pod
739
991
  #
740
992
  # A path to a prefix header file to inject in the prefix header of the
741
993
  # pod project.
994
+ # `false` indicates that the default CocoaPods prefix header should not
995
+ # be generated.
996
+ # `true` is the default and indicates that the default CocoaPods prefix
997
+ # header should be generated.
742
998
  #
743
999
  # ---
744
1000
  #
745
- # This attribute is __not recommended__ as Pods should not pollute the
746
- # prefix header of other libraries or of the user project.
1001
+ # The file path options is __not recommended__ as Pods should not
1002
+ # pollute the prefix header of other libraries or of the user project.
1003
+ #
747
1004
  #
748
1005
  # @example
749
1006
  #
750
1007
  # spec.prefix_header_file = 'iphone/include/prefix.pch'
751
1008
  #
752
- # @param [String] path
753
- # The path to the prefix header file.
1009
+ # @example
1010
+ #
1011
+ # spec.prefix_header_file = false
1012
+ #
1013
+ # @param [Bool, String] path
1014
+ # The path to the prefix header file or whether to disable
1015
+ # prefix_header generation.
754
1016
  #
755
- attribute :prefix_header_file, {
756
- :inherited => true,
757
- }
1017
+ attribute :prefix_header_file,
1018
+ :types => [TrueClass, FalseClass, String],
1019
+ :inherited => true
1020
+
1021
+ #------------------#
1022
+
1023
+ # @!method module_name=(name)
1024
+ #
1025
+ # The name to use for the framework / clang module which
1026
+ # will be generated for this specification instead of the
1027
+ # default (header_dir if set, otherwise the specification
1028
+ # name).
1029
+ #
1030
+ # @example
1031
+ #
1032
+ # spec.module_name = 'Three20'
1033
+ #
1034
+ # @param [String] name
1035
+ # the module name.
1036
+ #
1037
+ root_attribute :module_name
758
1038
 
759
1039
  #------------------#
760
1040
 
@@ -770,9 +1050,8 @@ module Pod
770
1050
  # @param [String] dir
771
1051
  # the headers directory.
772
1052
  #
773
- attribute :header_dir, {
774
- :inherited => true,
775
- }
1053
+ attribute :header_dir,
1054
+ :inherited => true
776
1055
 
777
1056
  #------------------#
778
1057
 
@@ -788,9 +1067,70 @@ module Pod
788
1067
  # @param [String] dir
789
1068
  # the directory from where to preserve the headers namespacing.
790
1069
  #
791
- attribute :header_mappings_dir, {
792
- :inherited => true,
793
- }
1070
+ attribute :header_mappings_dir,
1071
+ :inherited => true
1072
+
1073
+ #------------------#
1074
+
1075
+ SCRIPT_PHASE_REQUIRED_KEYS = [:name, :script].freeze
1076
+
1077
+ SCRIPT_PHASE_OPTIONAL_KEYS = [:shell_path, :input_files, :output_files, :input_file_lists, :output_file_lists,
1078
+ :show_env_vars_in_log, :execution_position, :dependency_file, :always_out_of_date].freeze
1079
+
1080
+ EXECUTION_POSITION_KEYS = [:before_compile, :after_compile, :before_headers, :after_headers, :any].freeze
1081
+
1082
+ ALL_SCRIPT_PHASE_KEYS = (SCRIPT_PHASE_REQUIRED_KEYS + SCRIPT_PHASE_OPTIONAL_KEYS).freeze
1083
+
1084
+ # @!method script_phases=(*script_phases)
1085
+ #
1086
+ # This attribute allows to define a script phase to execute as part of compilation of the Pod.
1087
+ # Unlike a prepare command, script phases execute as part of `xcodebuild` they can also utilize all environment
1088
+ # variables that are set during compilation.
1089
+ #
1090
+ # A Pod can provide multiple script phases to execute and they will be added in the order they were
1091
+ # declared and after taking into consideration their execution position setting.
1092
+ #
1093
+ # **Note** In order to provide visibility and awareness of the contents of all script phases,
1094
+ # a warning will be presented to the user upon installing your pod if it includes any script phases.
1095
+ #
1096
+ # @example
1097
+ #
1098
+ # spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"' }
1099
+ #
1100
+ # @example
1101
+ #
1102
+ # spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"', :execution_position => :before_compile }
1103
+ #
1104
+ # @example
1105
+ #
1106
+ # spec.script_phase = { :name => 'Hello World', :script => 'puts "Hello World"', :shell_path => '/usr/bin/ruby' }
1107
+ #
1108
+ # @example
1109
+ #
1110
+ # spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"',
1111
+ # :input_files => ['/path/to/input_file.txt'], :output_files => ['/path/to/output_file.txt']
1112
+ # }
1113
+ #
1114
+ # @example
1115
+ #
1116
+ # spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"',
1117
+ # :input_file_lists => ['/path/to/input_files.xcfilelist'], :output_file_lists => ['/path/to/output_files.xcfilelist']
1118
+ # }
1119
+ #
1120
+ # @example
1121
+ #
1122
+ # spec.script_phases = [
1123
+ # { :name => 'Hello World', :script => 'echo "Hello World"' },
1124
+ # { :name => 'Hello Ruby World', :script => 'puts "Hello World"', :shell_path => '/usr/bin/ruby' },
1125
+ # ]
1126
+ #
1127
+ # @param [Array<Hash{Symbol=>String}>] script_phases
1128
+ # An array of hashes where each hash represents a single script phase.
1129
+ #
1130
+ attribute :script_phases,
1131
+ :types => [Hash],
1132
+ :container => Array,
1133
+ :singularize => true
794
1134
 
795
1135
  #-----------------------------------------------------------------------#
796
1136
 
@@ -878,19 +1218,18 @@ module Pod
878
1218
  #
879
1219
  # @example
880
1220
  #
881
- # spec.source_files = "Classes/**/*.{h,m}"
1221
+ # spec.source_files = 'Classes/**/*.{h,m}'
882
1222
  #
883
1223
  # @example
884
1224
  #
885
- # spec.source_files = "Classes/**/*.{h,m}", "More_Classes/**/*.{h,m}"
1225
+ # spec.source_files = 'Classes/**/*.{h,m}', 'More_Classes/**/*.{h,m}'
886
1226
  #
887
1227
  # @param [String, Array<String>] source_files
888
1228
  # the source files of the Pod.
889
1229
  #
890
- attribute :source_files, {
891
- :container => Array,
892
- :file_patterns => true,
893
- }
1230
+ attribute :source_files,
1231
+ :container => Array,
1232
+ :file_patterns => true
894
1233
 
895
1234
  #------------------#
896
1235
 
@@ -900,21 +1239,49 @@ module Pod
900
1239
  #
901
1240
  # ---
902
1241
  #
903
- # These are the headers that will be exposed to the user’s project and
904
- # from which documentation will be generated. If no public headers are
905
- # specified then **all** the headers are considered public.
1242
+ # These patterns are matched against the source files to include headers
1243
+ # that will be exposed to the user’s project and
1244
+ # from which documentation will be generated. When the library is built,
1245
+ # these headers will appear in the build directory. If no public headers
1246
+ # are specified then **all** the headers in source_files are considered
1247
+ # public.
906
1248
  #
907
1249
  # @example
908
1250
  #
909
- # spec.public_header_files = "Headers/Public/*.h"
1251
+ # spec.public_header_files = 'Headers/Public/*.h'
910
1252
  #
911
1253
  # @param [String, Array<String>] public_header_files
912
1254
  # the public headers of the Pod.
913
1255
  #
914
- attribute :public_header_files, {
915
- :container => Array,
916
- :file_patterns => true,
917
- }
1256
+ attribute :public_header_files,
1257
+ :container => Array,
1258
+ :file_patterns => true
1259
+
1260
+ #------------------#
1261
+
1262
+ # @!method project_header_files=(project_header_files)
1263
+ #
1264
+ # A list of file patterns that should be used to mark project headers.
1265
+ #
1266
+ # ---
1267
+ #
1268
+ # These patterns are matched against the public headers (or all the
1269
+ # headers if no public headers have been specified) to exclude those
1270
+ # headers which should not be exposed to the user project and which
1271
+ # should not be used to generate the documentation. When the library
1272
+ # is built, these headers will _not_ appear in the build directory.
1273
+ #
1274
+ #
1275
+ # @example
1276
+ #
1277
+ # spec.project_header_files = 'Headers/Project/*.h'
1278
+ #
1279
+ # @param [String, Array<String>] project_header_files
1280
+ # the project headers of the Pod.
1281
+ #
1282
+ attribute :project_header_files,
1283
+ :container => Array,
1284
+ :file_patterns => true
918
1285
 
919
1286
  #------------------#
920
1287
 
@@ -927,25 +1294,31 @@ module Pod
927
1294
  # These patterns are matched against the public headers (or all the
928
1295
  # headers if no public headers have been specified) to exclude those
929
1296
  # headers which should not be exposed to the user project and which
930
- # should not be used to generate the documentation.
1297
+ # should not be used to generate the documentation. When the library
1298
+ # is built, these headers will appear in the build directory.
1299
+ #
1300
+ # Header files that are not listed as neither public nor project or private will
1301
+ # be treated as private, but in addition will not appear in the build
1302
+ # directory at all.
1303
+ #
931
1304
  #
932
1305
  # @example
933
1306
  #
934
- # spec.private_header_files = "Headers/Private/*.h"
1307
+ # spec.private_header_files = 'Headers/Private/*.h'
935
1308
  #
936
1309
  # @param [String, Array<String>] private_header_files
937
1310
  # the private headers of the Pod.
938
1311
  #
939
- attribute :private_header_files, {
940
- :container => Array,
941
- :file_patterns => true,
942
- }
1312
+ attribute :private_header_files,
1313
+ :container => Array,
1314
+ :file_patterns => true
943
1315
 
944
1316
  #------------------#
945
1317
 
946
1318
  # @!method vendored_frameworks=(*frameworks)
947
1319
  #
948
- # The paths of the framework bundles that come shipped with the Pod.
1320
+ # The paths of the framework bundles that come shipped with the Pod. Supports both `.framework` and `.xcframework` bundles.
1321
+ # The frameworks will be made available to the Pod and to the consumers of the pod.
949
1322
  #
950
1323
  # @example
951
1324
  #
@@ -953,22 +1326,22 @@ module Pod
953
1326
  #
954
1327
  # @example
955
1328
  #
956
- # spec.vendored_frameworks = 'MyFramework.framework', 'TheirFramework.framework'
1329
+ # spec.vendored_frameworks = 'MyFramework.framework', 'TheirFramework.xcframework'
957
1330
  #
958
1331
  # @param [String, Array<String>] vendored_frameworks
959
1332
  # A list of framework bundles paths.
960
1333
  #
961
- attribute :vendored_frameworks, {
962
- :container => Array,
963
- :file_patterns => true,
964
- :singularize => true,
965
- }
1334
+ attribute :vendored_frameworks,
1335
+ :container => Array,
1336
+ :file_patterns => true,
1337
+ :singularize => true
966
1338
 
967
1339
  #------------------#
968
1340
 
969
1341
  # @!method vendored_libraries=(*frameworks)
970
1342
  #
971
- # The paths of the libraries that come shipped with the Pod.
1343
+ # The paths of the libraries that come shipped with the Pod. The libraries will be available to the Pod and the
1344
+ # consumers of the Pod.
972
1345
  #
973
1346
  # @example
974
1347
  #
@@ -981,27 +1354,78 @@ module Pod
981
1354
  # @param [String, Array<String>] vendored_libraries
982
1355
  # A list of library paths.
983
1356
  #
984
- attribute :vendored_libraries, {
985
- :container => Array,
986
- :file_patterns => true,
987
- :singularize => true,
988
- }
1357
+ attribute :vendored_libraries,
1358
+ :container => Array,
1359
+ :file_patterns => true,
1360
+ :singularize => true
1361
+
1362
+ #------------------#
1363
+
1364
+ # The keys accepted by the category attribute for each on demand resource entry.
1365
+ #
1366
+ ON_DEMAND_RESOURCES_CATEGORY_KEYS = [:download_on_demand, :prefetched, :initial_install].freeze
1367
+
1368
+ # @!method on_demand_resources=(on_demand_resources)
1369
+ #
1370
+ # A hash of on demand resources that should be copied into the target bundle. Resources specified here
1371
+ # will automatically become part of the resources build phase of the target this pod is integrated into.
1372
+ #
1373
+ # If no category is specified then `:download_on_demand` is used as the default.
1374
+ #
1375
+ # @note
1376
+ #
1377
+ # Tags specified by pods are _always_ managed by CocoaPods. If a tag is renamed, changed or deleted then
1378
+ # CocoaPods will update the tag within the targets the pod was integrated into. It is highly recommended not to
1379
+ # share the same tags for your project as the ones used by the pods your project consumes.
1380
+ #
1381
+ # @example
1382
+ #
1383
+ # s.on_demand_resources = {
1384
+ # 'Tag1' => 'file1.png'
1385
+ # }
1386
+ #
1387
+ # @example
1388
+ #
1389
+ # s.on_demand_resources = {
1390
+ # 'Tag1' => ['file1.png', 'file2.png']
1391
+ # }
1392
+ #
1393
+ # @example
1394
+ #
1395
+ # s.on_demand_resources = {
1396
+ # 'Tag1' => { :paths => ['file1.png', 'file2.png'], :category => :download_on_demand }
1397
+ # }
1398
+ #
1399
+ # @example
1400
+ #
1401
+ # s.on_demand_resources = {
1402
+ # 'Tag1' => { :paths => ['file1.png', 'file2.png'], :category => :initial_install }
1403
+ # }
1404
+ #
1405
+ # @param [Hash{String=>String}, Hash{String=>Array<String>}, Hash{String=>Hash}] on_demand_resources
1406
+ # The on demand resources shipped with the Pod.
1407
+ #
1408
+ attribute :on_demand_resources,
1409
+ :types => [String, Array, Hash],
1410
+ :container => Hash,
1411
+ :file_patterns => true,
1412
+ :singularize => true
989
1413
 
990
1414
  #------------------#
991
1415
 
992
- # @!method resource_bundles=(*frameworks)
1416
+ # @!method resource_bundles=(*resource_bundles)
993
1417
  #
994
1418
  # This attribute allows to define the name and the file of the resource
995
1419
  # bundles which should be built for the Pod. They are specified as a
996
1420
  # hash where the keys represent the name of the bundles and the values
997
1421
  # the file patterns that they should include.
998
1422
  #
999
- # We strongly **recommend** library developers to adopt resource
1000
- # bundles as there can be name collisions using the resources
1001
- # attribute.
1423
+ # For building the Pod as a static library, we strongly **recommend**
1424
+ # library developers to adopt resource bundles as there can be name
1425
+ # collisions using the resources attribute.
1002
1426
  #
1003
1427
  # The names of the bundles should at least include the name of the Pod
1004
- # to minimize the chance of name collisions.
1428
+ # to minimise the chance of name collisions.
1005
1429
  #
1006
1430
  # To provide different resources per platform namespaced bundles *must*
1007
1431
  # be used.
@@ -1012,18 +1436,20 @@ module Pod
1012
1436
  #
1013
1437
  # @example
1014
1438
  #
1015
- # spec.resource_bundles = { 'MapBox' => ['MapView/Map/Resources/*.png'], 'OtherResources' => ['MapView/Map/OtherResources/*.png'] }
1439
+ # spec.resource_bundles = {
1440
+ # 'MapBox' => ['MapView/Map/Resources/*.png'],
1441
+ # 'MapBoxOtherResources' => ['MapView/Map/OtherResources/*.png']
1442
+ # }
1016
1443
  #
1017
- # @param [Hash{String=>String}] resource_bundles
1444
+ # @param [Hash{String=>String}, Hash{String=>Array<String>}] resource_bundles
1018
1445
  # A hash where the keys are the names of the resource bundles
1019
1446
  # and the values are their relative file patterns.
1020
1447
  #
1021
- attribute :resource_bundles, {
1022
- :types => [String, Array],
1023
- :container => Hash,
1024
- :file_patterns => true,
1025
- :singularize => true,
1026
- }
1448
+ attribute :resource_bundles,
1449
+ :types => [String, Array],
1450
+ :container => Hash,
1451
+ :file_patterns => true,
1452
+ :singularize => true
1027
1453
 
1028
1454
  #------------------#
1029
1455
 
@@ -1031,28 +1457,28 @@ module Pod
1031
1457
  #
1032
1458
  # A list of resources that should be copied into the target bundle.
1033
1459
  #
1034
- # We strongly **recommend** library developers to adopt [resource
1035
- # bundles](http://docs.cocoapods.org/specification.html#resources) as
1036
- # there can be name collisions using the resources attribute. Moreover
1037
- # resources specified with this attribute are copied directly to the
1038
- # client target and therefore they are not optimized by Xcode.
1460
+ # For building the Pod as a static library, we strongly **recommend**
1461
+ # library developers to adopt [resource bundles](http://guides.cocoapods.org/syntax/podspec.html#resource_bundles)
1462
+ # as there can be name collisions using the resources attribute.
1463
+ # Moreover, resources specified with this attribute are copied
1464
+ # directly to the client target and therefore they are not
1465
+ # optimised by Xcode.
1039
1466
  #
1040
1467
  # @example
1041
1468
  #
1042
- # spec.resource = "Resources/HockeySDK.bundle"
1469
+ # spec.resource = 'Resources/HockeySDK.bundle'
1043
1470
  #
1044
1471
  # @example
1045
1472
  #
1046
- # spec.resources = ["Images/*.png", "Sounds/*"]
1473
+ # spec.resources = ['Images/*.png', 'Sounds/*']
1047
1474
  #
1048
1475
  # @param [String, Array<String>] resources
1049
1476
  # The resources shipped with the Pod.
1050
1477
  #
1051
- attribute :resources, {
1052
- :container => Array,
1053
- :file_patterns => true,
1054
- :singularize => true,
1055
- }
1478
+ attribute :resources,
1479
+ :container => Array,
1480
+ :file_patterns => true,
1481
+ :singularize => true
1056
1482
 
1057
1483
  #------------------#
1058
1484
 
@@ -1063,19 +1489,18 @@ module Pod
1063
1489
  #
1064
1490
  # @example
1065
1491
  #
1066
- # spec.ios.exclude_files = "Classes/osx"
1492
+ # spec.ios.exclude_files = 'Classes/osx'
1067
1493
  #
1068
1494
  # @example
1069
1495
  #
1070
- # spec.exclude_files = "Classes/**/unused.{h,m}"
1496
+ # spec.exclude_files = 'Classes/**/unused.{h,m}'
1071
1497
  #
1072
1498
  # @param [String, Array<String>] exclude_files
1073
1499
  # the file patterns that the Pod should ignore.
1074
1500
  #
1075
- attribute :exclude_files, {
1076
- :container => Array,
1077
- :file_patterns => true,
1078
- }
1501
+ attribute :exclude_files,
1502
+ :container => Array,
1503
+ :file_patterns => true
1079
1504
 
1080
1505
  #------------------#
1081
1506
 
@@ -1090,20 +1515,53 @@ module Pod
1090
1515
  #
1091
1516
  # @example
1092
1517
  #
1093
- # spec.preserve_path = "IMPORTANT.txt"
1518
+ # spec.preserve_path = 'IMPORTANT.txt'
1094
1519
  #
1095
1520
  # @example
1096
1521
  #
1097
- # spec.preserve_paths = "Frameworks/*.framework"
1522
+ # spec.preserve_paths = 'Frameworks/*.framework'
1098
1523
  #
1099
1524
  # @param [String, Array<String>] preserve_paths
1100
1525
  # the paths that should be not cleaned.
1101
1526
  #
1102
- attribute :preserve_paths, {
1103
- :container => Array,
1104
- :file_patterns => true,
1105
- :singularize => true,
1106
- }
1527
+ attribute :preserve_paths,
1528
+ :container => Array,
1529
+ :file_patterns => true,
1530
+ :singularize => true
1531
+
1532
+ #------------------#
1533
+
1534
+ # @!method module_map=(module_map)
1535
+ #
1536
+ # The module map file that should be used when this pod is integrated as
1537
+ # a framework.
1538
+ #
1539
+ # `false` indicates that the default CocoaPods `modulemap` file should not
1540
+ # be generated.
1541
+ #
1542
+ # `true` is the default and indicates that the default CocoaPods
1543
+ # `modulemap` file should be generated.
1544
+ #
1545
+ # ---
1546
+ #
1547
+ # By default, CocoaPods creates a module map file based upon the public
1548
+ # headers in a specification.
1549
+ #
1550
+ # @example
1551
+ #
1552
+ # spec.module_map = 'source/module.modulemap'
1553
+ #
1554
+ # @example
1555
+ #
1556
+ # spec.module_map = false
1557
+ #
1558
+ # @param [String, Bool] module_map
1559
+ # the path to the module map file that should be used
1560
+ # or whether to disable module_map generation.
1561
+ #
1562
+ attribute :module_map,
1563
+ :types => [TrueClass, FalseClass, String],
1564
+ :root_only => true
1107
1565
 
1108
1566
  #-----------------------------------------------------------------------#
1109
1567
 
@@ -1134,7 +1592,7 @@ module Pod
1134
1592
  # pod 'ShareKit', '2.0'
1135
1593
  #
1136
1594
  # Installs ShareKit with all the sharers like `ShareKit/Evernote`,
1137
- # `ShareKit/Facebook`, etc, as they are defined a subspecs.
1595
+ # `ShareKit/Facebook`, etc, as they are defined as subspecs.
1138
1596
  #
1139
1597
  # pod 'ShareKit/Twitter', '2.0'
1140
1598
  # pod 'ShareKit/Pinboard', '2.0'
@@ -1147,12 +1605,12 @@ module Pod
1147
1605
  #
1148
1606
  # @example Subspecs with different source files.
1149
1607
  #
1150
- # subspec "Twitter" do |sp|
1151
- # sp.source_files = "Classes/Twitter"
1608
+ # subspec 'Twitter' do |sp|
1609
+ # sp.source_files = 'Classes/Twitter'
1152
1610
  # end
1153
1611
  #
1154
- # subspec "Pinboard" do |sp|
1155
- # sp.source_files = "Classes/Pinboard"
1612
+ # subspec 'Pinboard' do |sp|
1613
+ # sp.source_files = 'Classes/Pinboard'
1156
1614
  # end
1157
1615
  #
1158
1616
  # @example Subspecs referencing dependencies to other subspecs.
@@ -1187,14 +1645,158 @@ module Pod
1187
1645
  subspec
1188
1646
  end
1189
1647
 
1648
+ # The list of the test types currently supported.
1649
+ #
1650
+ SUPPORTED_TEST_TYPES = [:unit, :ui].freeze
1651
+
1652
+ # The test type this specification supports. This only applies to test specifications.
1653
+ #
1654
+ # ---
1655
+ #
1656
+ # @example
1657
+ #
1658
+ # test_spec.test_type = :unit
1659
+ #
1660
+ # @example
1661
+ #
1662
+ # test_spec.test_type = 'unit'
1663
+ #
1664
+ # @param [Symbol, String] type
1665
+ # The test type to use.
1666
+ #
1667
+ attribute :test_type,
1668
+ :types => [Symbol, String],
1669
+ :multi_platform => false,
1670
+ :spec_types => [:test]
1671
+
1672
+ # @!method requires_app_host=(flag)
1673
+ #
1674
+ # Whether a test specification requires an app host to run tests. This only applies to test specifications.
1675
+ #
1676
+ # @example
1677
+ #
1678
+ # test_spec.requires_app_host = true
1679
+ #
1680
+ # @param [Boolean] flag
1681
+ # whether a test specification requires an app host to run tests.
1682
+ #
1683
+ attribute :requires_app_host,
1684
+ :types => [TrueClass, FalseClass],
1685
+ :default_value => false,
1686
+ :spec_types => [:test]
1687
+
1688
+ # @!method app_host_name=(name)
1689
+ #
1690
+ # The app specification to use as an app host, if necessary.
1691
+ #
1692
+ # @note
1693
+ #
1694
+ # You must depend on that app spec using `test_spec.dependency 'PodName'`.
1695
+ #
1696
+ # @example
1697
+ #
1698
+ # Pod::Spec.new do |spec|
1699
+ # spec.name = 'NSAttributedString+CCLFormat'
1700
+ #
1701
+ # spec.test_spec do |test_spec|
1702
+ # test_spec.source_files = 'NSAttributedString+CCLFormatTests.m'
1703
+ # test_spec.requires_app_host = true
1704
+ # test_spec.app_host_name = 'NSAttributedString+CCLFormat/App'
1705
+ # test_spec.dependency 'NSAttributedString+CCLFormat/App'
1706
+ # end
1707
+ #
1708
+ # spec.app_spec 'App' do |app_spec|
1709
+ # app_spec.source_files = 'NSAttributedString+CCLFormat.m'
1710
+ # app_spec.dependency 'AFNetworking'
1711
+ # end
1712
+ # end
1713
+ #
1714
+ # @param [String] name
1715
+ # The app specification to use as an app host, if necessary.
1716
+ #
1717
+ attribute :app_host_name,
1718
+ :types => [String],
1719
+ :spec_types => [:test]
1720
+
1721
+ SCHEME_KEYS = [:launch_arguments, :environment_variables, :code_coverage, :parallelizable, :build_configurations].freeze
1722
+
1723
+ # @!method scheme=(flag)
1724
+ #
1725
+ # Specifies the scheme configuration to be used for this specification.
1726
+ #
1727
+ # ---
1728
+ #
1729
+ # @example
1730
+ #
1731
+ # spec.scheme = { :launch_arguments => ['Arg1'] }
1732
+ #
1733
+ # @example
1734
+ #
1735
+ # spec.scheme = { :launch_arguments => ['Arg1', 'Arg2'], :environment_variables => { 'Key1' => 'Val1'} }
1736
+ #
1737
+ # @param [Hash] scheme
1738
+ # the scheme configuration to be used for this specification.
1739
+ #
1740
+ attribute :scheme,
1741
+ :types => [Hash],
1742
+ :container => Hash,
1743
+ :keys => SCHEME_KEYS
1744
+
1745
+ # Represents a test specification for the library. Here you can place all
1746
+ # your tests for your podspec along with the test dependencies.
1747
+ #
1748
+ # ---
1749
+ #
1750
+ # @example
1751
+ #
1752
+ # Pod::Spec.new do |spec|
1753
+ # spec.name = 'NSAttributedString+CCLFormat'
1754
+ #
1755
+ # spec.test_spec do |test_spec|
1756
+ # test_spec.source_files = 'NSAttributedString+CCLFormatTests.m'
1757
+ # test_spec.dependency 'Expecta'
1758
+ # end
1759
+ # end
1760
+ #
1761
+ def test_spec(name = 'Tests', &block)
1762
+ subspec = Specification.new(self, name, true, &block)
1763
+ @subspecs << subspec
1764
+ subspec
1765
+ end
1766
+
1767
+ # Represents an app specification for the library. Here you can place all
1768
+ # your app source files for your podspec along with the app dependencies.
1769
+ #
1770
+ # ---
1771
+ #
1772
+ # @example
1773
+ #
1774
+ # Pod::Spec.new do |spec|
1775
+ # spec.name = 'NSAttributedString+CCLFormat'
1776
+ #
1777
+ # spec.app_spec do |app_spec|
1778
+ # app_spec.source_files = 'NSAttributedString+CCLFormat.m'
1779
+ # app_spec.dependency 'AFNetworking'
1780
+ # end
1781
+ # end
1782
+ #
1783
+ def app_spec(name = 'App', &block)
1784
+ appspec = Specification.new(self, name, :app_specification => true, &block)
1785
+ @subspecs << appspec
1786
+ appspec
1787
+ end
1788
+
1190
1789
  #------------------#
1191
1790
 
1192
- # @!method default_subspec=(subspec_name)
1791
+ # @!method default_subspecs=(subspec_array)
1193
1792
  #
1194
- # The name of the subspec that should be used as preferred dependency.
1195
- # If not specified a specifications requires all its subspecs as
1793
+ # An array of subspecs names that should be used as preferred dependency.
1794
+ # If not specified, a specification requires all of its subspecs as
1196
1795
  # dependencies.
1197
1796
  #
1797
+ # You may use the value `:none` to specify that none of the subspecs are
1798
+ # required to compile this pod and that all subspecs are optional.
1799
+ #
1198
1800
  # ---
1199
1801
  #
1200
1802
  # A Pod should make available the full library by default. Users can
@@ -1206,15 +1808,25 @@ module Pod
1206
1808
  # they trigger dependencies on other libraries).
1207
1809
  #
1208
1810
  # @example
1209
- # spec.default_subspec = 'Pod/Core'
1210
1811
  #
1211
- # @param [String] subspec_name
1212
- # the name of the subspec that should be inherited as
1812
+ # spec.default_subspec = 'Core'
1813
+ #
1814
+ # @example
1815
+ #
1816
+ # spec.default_subspecs = 'Core', 'UI'
1817
+ #
1818
+ # @example
1819
+ #
1820
+ # spec.default_subspecs = :none
1821
+ #
1822
+ # @param [Array<String>, String, Symbol] subspec_names
1823
+ # An array of subspec names that should be inherited as
1213
1824
  # dependency.
1214
1825
  #
1215
- attribute :default_subspec, {
1216
- :multi_platform => false,
1217
- }
1826
+ root_attribute :default_subspecs,
1827
+ :container => Array,
1828
+ :types => [Array, String, Symbol],
1829
+ :singularize => true
1218
1830
 
1219
1831
  #-----------------------------------------------------------------------#
1220
1832
 
@@ -1228,15 +1840,15 @@ module Pod
1228
1840
  # For example one might want to store resources which are specific to
1229
1841
  # only iOS projects.
1230
1842
  #
1231
- # spec.resources = "Resources/**/*.png"
1232
- # spec.ios.resources = "Resources_ios/**/*.png"
1843
+ # spec.resources = 'Resources/**/*.png'
1844
+ # spec.ios.resources = 'Resources_ios/**/*.png'
1233
1845
 
1234
1846
  #-----------------------------------------------------------------------#
1235
1847
 
1236
1848
  # Provides support for specifying iOS attributes.
1237
1849
  #
1238
1850
  # @example
1239
- # spec.ios.source_files = "Classes/ios/**/*.{h,m}"
1851
+ # spec.ios.source_files = 'Classes/ios/**/*.{h,m}'
1240
1852
  #
1241
1853
  # @return [PlatformProxy] the proxy that will set the attributes.
1242
1854
  #
@@ -1247,13 +1859,48 @@ module Pod
1247
1859
  # Provides support for specifying OS X attributes.
1248
1860
  #
1249
1861
  # @example
1250
- # spec.osx.source_files = "Classes/osx/**/*.{h,m}"
1862
+ # spec.osx.source_files = 'Classes/osx/**/*.{h,m}'
1251
1863
  #
1252
1864
  # @return [PlatformProxy] the proxy that will set the attributes.
1253
1865
  #
1254
1866
  def osx
1255
1867
  PlatformProxy.new(self, :osx)
1256
1868
  end
1869
+
1870
+ alias macos osx
1871
+
1872
+ # Provides support for specifying tvOS attributes.
1873
+ #
1874
+ # @example
1875
+ # spec.tvos.source_files = 'Classes/tvos/**/*.{h,m}'
1876
+ #
1877
+ # @return [PlatformProxy] the proxy that will set the attributes.
1878
+ #
1879
+ def tvos
1880
+ PlatformProxy.new(self, :tvos)
1881
+ end
1882
+
1883
+ # Provides support for specifying visionOS attributes.
1884
+ #
1885
+ # @example
1886
+ # spec.visionos.source_files = 'Classes/visionos/**/*.{h,m}'
1887
+ #
1888
+ # @return [PlatformProxy] the proxy that will set the attributes.
1889
+ #
1890
+ def visionos
1891
+ PlatformProxy.new(self, :visionos)
1892
+ end
1893
+
1894
+ # Provides support for specifying watchOS attributes.
1895
+ #
1896
+ # @example
1897
+ # spec.watchos.source_files = 'Classes/watchos/**/*.{h,m}'
1898
+ #
1899
+ # @return [PlatformProxy] the proxy that will set the attributes.
1900
+ #
1901
+ def watchos
1902
+ PlatformProxy.new(self, :watchos)
1903
+ end
1257
1904
  end
1258
1905
  end
1259
1906
  end