cocoapods-core 0.17.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +36 -0
- data/lib/cocoapods-core/core_ui.rb +19 -0
- data/lib/cocoapods-core/dependency.rb +295 -0
- data/lib/cocoapods-core/gem_version.rb +6 -0
- data/lib/cocoapods-core/lockfile.rb +440 -0
- data/lib/cocoapods-core/platform.rb +171 -0
- data/lib/cocoapods-core/podfile/dsl.rb +459 -0
- data/lib/cocoapods-core/podfile/target_definition.rb +503 -0
- data/lib/cocoapods-core/podfile.rb +345 -0
- data/lib/cocoapods-core/requirement.rb +15 -0
- data/lib/cocoapods-core/source/validator.rb +183 -0
- data/lib/cocoapods-core/source.rb +284 -0
- data/lib/cocoapods-core/specification/consumer.rb +356 -0
- data/lib/cocoapods-core/specification/dsl/attribute.rb +245 -0
- data/lib/cocoapods-core/specification/dsl/attribute_support.rb +76 -0
- data/lib/cocoapods-core/specification/dsl/deprecations.rb +47 -0
- data/lib/cocoapods-core/specification/dsl/platform_proxy.rb +67 -0
- data/lib/cocoapods-core/specification/dsl.rb +1110 -0
- data/lib/cocoapods-core/specification/linter.rb +436 -0
- data/lib/cocoapods-core/specification/root_attribute_accessors.rb +152 -0
- data/lib/cocoapods-core/specification/set/presenter.rb +229 -0
- data/lib/cocoapods-core/specification/set/statistics.rb +277 -0
- data/lib/cocoapods-core/specification/set.rb +171 -0
- data/lib/cocoapods-core/specification/yaml.rb +60 -0
- data/lib/cocoapods-core/specification.rb +592 -0
- data/lib/cocoapods-core/standard_error.rb +84 -0
- data/lib/cocoapods-core/vendor/dependency.rb +264 -0
- data/lib/cocoapods-core/vendor/requirement.rb +208 -0
- data/lib/cocoapods-core/vendor/version.rb +333 -0
- data/lib/cocoapods-core/vendor.rb +56 -0
- data/lib/cocoapods-core/version.rb +99 -0
- data/lib/cocoapods-core/yaml_converter.rb +202 -0
- data/lib/cocoapods-core.rb +23 -0
- metadata +154 -0
@@ -0,0 +1,1110 @@
|
|
1
|
+
require 'cocoapods-core/specification/dsl/attribute_support'
|
2
|
+
require 'cocoapods-core/specification/dsl/attribute'
|
3
|
+
require 'cocoapods-core/specification/dsl/platform_proxy'
|
4
|
+
require 'cocoapods-core/specification/dsl/deprecations'
|
5
|
+
|
6
|
+
module Pod
|
7
|
+
class Specification
|
8
|
+
|
9
|
+
#- 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
|
12
|
+
# CocoaPods/cocoapods.github.com repository.
|
13
|
+
#-------------------------------------------------------------------------#
|
14
|
+
|
15
|
+
# A specification describes a version of Pod library. It includes details
|
16
|
+
# about where the source should be fetched from, what files to use, the
|
17
|
+
# build settings to apply, and other general metadata such as its name,
|
18
|
+
# version, and description.
|
19
|
+
#
|
20
|
+
# ---
|
21
|
+
#
|
22
|
+
# A stub specification file can be generated by the [pod spec
|
23
|
+
# create](commands.html#tab_spec-create) command.
|
24
|
+
#
|
25
|
+
# ---
|
26
|
+
#
|
27
|
+
# The specification DSL provides great flexibility and dynamism. Moreover,
|
28
|
+
# the DSL adopts the
|
29
|
+
# [convention over configuration](http://en.wikipedia.org/wiki/Convention_over_configuration)
|
30
|
+
# and thus it can be very simple:
|
31
|
+
#
|
32
|
+
# Pod::Spec.new do |s|
|
33
|
+
# s.name = 'Reachability'
|
34
|
+
# s.version = '3.1.0'
|
35
|
+
# s.license = { :type => 'BSD' }
|
36
|
+
# s.homepage = 'https://github.com/tonymillion/Reachability'
|
37
|
+
# s.authors = { 'Tony Million' => 'tonymillion@gmail.com' }
|
38
|
+
# s.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X. Drop in replacement for Apple Reachability.'
|
39
|
+
# s.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
|
40
|
+
# s.source_files = 'Reachability.{h,m}'
|
41
|
+
# s.framework = 'SystemConfiguration'
|
42
|
+
# s.requires_arc = true
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
module DSL
|
46
|
+
|
47
|
+
extend Pod::Specification::DSL::AttributeSupport
|
48
|
+
|
49
|
+
#-----------------------------------------------------------------------#
|
50
|
+
|
51
|
+
# @!group Root specification
|
52
|
+
#
|
53
|
+
# A ‘root’ specification stores the information about the specific
|
54
|
+
# version of a library.
|
55
|
+
#
|
56
|
+
# The attributes in this group can only be written to on the ‘root’
|
57
|
+
# specification, **not** on the ‘sub-specifications’.
|
58
|
+
#
|
59
|
+
# ---
|
60
|
+
#
|
61
|
+
# The attributes listed in this group are the only one which are
|
62
|
+
# required by a podspec.
|
63
|
+
#
|
64
|
+
# The attributes of the other groups are offered to refine the podspec
|
65
|
+
# and follow a convention over configuration approach. A root
|
66
|
+
# specification can describe these attributes either directly of
|
67
|
+
# through ‘[sub-specifications](#subspec)’.
|
68
|
+
|
69
|
+
#-----------------------------------------------------------------------#
|
70
|
+
|
71
|
+
# @!method name=(name)
|
72
|
+
#
|
73
|
+
# The name of the Pod.
|
74
|
+
#
|
75
|
+
# @example
|
76
|
+
#
|
77
|
+
# spec.name = 'AFNetworking'
|
78
|
+
#
|
79
|
+
# @param [String] name
|
80
|
+
# the name of the pod.
|
81
|
+
#
|
82
|
+
root_attribute :name, {
|
83
|
+
:required => true,
|
84
|
+
}
|
85
|
+
|
86
|
+
#------------------#
|
87
|
+
|
88
|
+
# @!method version=(version)
|
89
|
+
#
|
90
|
+
# The version of the Pod. CocoaPods follows
|
91
|
+
# [semantic versioning](http://semver.org).
|
92
|
+
#
|
93
|
+
# @example
|
94
|
+
#
|
95
|
+
# spec.version = '0.0.1'
|
96
|
+
#
|
97
|
+
# @param [String] version
|
98
|
+
# the version of the Pod.
|
99
|
+
#
|
100
|
+
root_attribute :version, {
|
101
|
+
:required => true,
|
102
|
+
}
|
103
|
+
|
104
|
+
#------------------#
|
105
|
+
|
106
|
+
# @!method authors=(authors)
|
107
|
+
#
|
108
|
+
# The name and email address of each of the library’s the authors.
|
109
|
+
#
|
110
|
+
# @example
|
111
|
+
#
|
112
|
+
# spec.author = 'Darth Vader'
|
113
|
+
#
|
114
|
+
# @example
|
115
|
+
#
|
116
|
+
# spec.authors = 'Darth Vader', 'Wookiee'
|
117
|
+
#
|
118
|
+
# @example
|
119
|
+
#
|
120
|
+
# spec.authors = { 'Darth Vader' => 'darthvader@darkside.com',
|
121
|
+
# 'Wookiee' => 'wookiee@aggrrttaaggrrt.com' }
|
122
|
+
#
|
123
|
+
# @param [String, Hash{String=>String}] authors
|
124
|
+
# the list of the authors of the library and their emails.
|
125
|
+
#
|
126
|
+
root_attribute :authors, {
|
127
|
+
:types => [ String, Array, Hash ],
|
128
|
+
:required => true,
|
129
|
+
:singularize => true,
|
130
|
+
}
|
131
|
+
|
132
|
+
#------------------#
|
133
|
+
|
134
|
+
# The keys accepted by the license attribute.
|
135
|
+
#
|
136
|
+
LICENSE_KEYS = [ :type, :file, :text ].freeze
|
137
|
+
|
138
|
+
# @!method license=(license)
|
139
|
+
#
|
140
|
+
# The license of the Pod.
|
141
|
+
#
|
142
|
+
# ---
|
143
|
+
#
|
144
|
+
# Unless the source contains a file named `LICENSE.*` or `LICENCE.*`,
|
145
|
+
# the path of the license file **or** the integral text of the notice
|
146
|
+
# commonly used for the license type must be specified.
|
147
|
+
#
|
148
|
+
# This information is used by CocoaPods to generate acknowledgement
|
149
|
+
# files (markdown and plist) which can be used in the acknowledgements
|
150
|
+
# section of the final application.
|
151
|
+
#
|
152
|
+
# @example
|
153
|
+
#
|
154
|
+
# spec.license = 'MIT'
|
155
|
+
#
|
156
|
+
# @example
|
157
|
+
#
|
158
|
+
# spec.license = { :type => 'MIT', :file => 'MIT-LICENSE.txt' }
|
159
|
+
#
|
160
|
+
# @example
|
161
|
+
#
|
162
|
+
# spec.license = { :type => 'MIT', :text => <<-LICENSE
|
163
|
+
# Copyright 2012
|
164
|
+
# Permission is granted to...
|
165
|
+
# LICENSE
|
166
|
+
# }
|
167
|
+
#
|
168
|
+
# @param [String, Hash{Symbol=>String}] license
|
169
|
+
# The type of the license and the text of the grant that
|
170
|
+
# allows to use the library (or the relative path to the file
|
171
|
+
# that contains it).
|
172
|
+
#
|
173
|
+
root_attribute :license, {
|
174
|
+
:container => Hash,
|
175
|
+
:keys => LICENSE_KEYS,
|
176
|
+
:required => true,
|
177
|
+
}
|
178
|
+
|
179
|
+
#------------------#
|
180
|
+
|
181
|
+
# @!method homepage=(homepage)
|
182
|
+
#
|
183
|
+
# The URL of the homepage of the Pod.
|
184
|
+
#
|
185
|
+
# @example
|
186
|
+
#
|
187
|
+
# spec.homepage = 'www.example.com'
|
188
|
+
#
|
189
|
+
# @param [String] homepage
|
190
|
+
# the URL of the homepage of the Pod.
|
191
|
+
#
|
192
|
+
root_attribute :homepage, {
|
193
|
+
:required => true,
|
194
|
+
}
|
195
|
+
|
196
|
+
#------------------#
|
197
|
+
|
198
|
+
# The keys accepted by the hash of the source attribute.
|
199
|
+
#
|
200
|
+
SOURCE_KEYS = {
|
201
|
+
:git => [:tag, :branch, :commit, :submodules],
|
202
|
+
:svn => [:folder, :tag, :revision],
|
203
|
+
:hg => [:revision],
|
204
|
+
:http => nil,
|
205
|
+
:local => nil
|
206
|
+
}.freeze
|
207
|
+
|
208
|
+
# @!method source=(source)
|
209
|
+
#
|
210
|
+
# The location from where the library should be retrieved.
|
211
|
+
#
|
212
|
+
# @example Specifying a Git source with a tag.
|
213
|
+
#
|
214
|
+
# spec.source = { :git => "git://github.com/AFNetworking/AFNetworking.git",
|
215
|
+
# :tag => 'v0.0.1' }
|
216
|
+
#
|
217
|
+
# @example Using the version of the Pod to identify the Git tag.
|
218
|
+
#
|
219
|
+
# spec.source = { :git => "git://github.com/AFNetworking/AFNetworking.git",
|
220
|
+
# :tag => "v#{spec.version}" }
|
221
|
+
#
|
222
|
+
# @param [Hash{Symbol=>String}] source
|
223
|
+
# The location from where the library should be retrieved.
|
224
|
+
#
|
225
|
+
root_attribute :source, {
|
226
|
+
:container => Hash,
|
227
|
+
:keys => SOURCE_KEYS,
|
228
|
+
:required => true,
|
229
|
+
}
|
230
|
+
|
231
|
+
#------------------#
|
232
|
+
|
233
|
+
# @!method summary=(summary)
|
234
|
+
#
|
235
|
+
# A short (maximum 140 characters) description of the Pod.
|
236
|
+
#
|
237
|
+
# ---
|
238
|
+
#
|
239
|
+
# The description should be short, yet informative. It represents the
|
240
|
+
# tag line of the Pod and there is no need to specify that a Pod is a
|
241
|
+
# library (they always are).
|
242
|
+
#
|
243
|
+
# The summary is expected to be properly capitalized and containing the
|
244
|
+
# correct punctuation.
|
245
|
+
#
|
246
|
+
# @example
|
247
|
+
#
|
248
|
+
# spec.summary = 'Computes the meaning of life.'
|
249
|
+
#
|
250
|
+
# @param [String] summary
|
251
|
+
# A short description of the Pod.
|
252
|
+
#
|
253
|
+
root_attribute :summary, {
|
254
|
+
:required => true,
|
255
|
+
}
|
256
|
+
|
257
|
+
#------------------#
|
258
|
+
|
259
|
+
# @!method description=(description)
|
260
|
+
#
|
261
|
+
# A description of the Pod more detailed than the summary.
|
262
|
+
#
|
263
|
+
# @example
|
264
|
+
#
|
265
|
+
# spec.description = <<-DESC
|
266
|
+
# Computes the meaning of life.
|
267
|
+
# Features:
|
268
|
+
# 1. Is self aware
|
269
|
+
# ...
|
270
|
+
# 42. Likes candies.
|
271
|
+
# DESC
|
272
|
+
#
|
273
|
+
# @param [String] description
|
274
|
+
# A longer description of the Pod.
|
275
|
+
#
|
276
|
+
root_attribute :description
|
277
|
+
|
278
|
+
#------------------#
|
279
|
+
|
280
|
+
# @!method screenshots=(screenshots)
|
281
|
+
#
|
282
|
+
# A list of URLs to images showcasing the Pod. Intended for UI oriented
|
283
|
+
# libraries.
|
284
|
+
#
|
285
|
+
# @example
|
286
|
+
#
|
287
|
+
# spec.screenshot = "http://dl.dropbox.com/u/378729/MBProgressHUD/1.png"
|
288
|
+
#
|
289
|
+
# @example
|
290
|
+
#
|
291
|
+
# spec.screenshots = [ "http://dl.dropbox.com/u/378729/MBProgressHUD/1.png",
|
292
|
+
# "http://dl.dropbox.com/u/378729/MBProgressHUD/2.png" ]
|
293
|
+
#
|
294
|
+
# @param [String] screenshots
|
295
|
+
# An URL for the screenshot of the Pod.
|
296
|
+
#
|
297
|
+
root_attribute :screenshots, {
|
298
|
+
:singularize => true,
|
299
|
+
:container => Array,
|
300
|
+
}
|
301
|
+
|
302
|
+
#------------------#
|
303
|
+
|
304
|
+
# @!method documentation=(documentation)
|
305
|
+
#
|
306
|
+
# Additional options to pass to the
|
307
|
+
# [appledoc](http://gentlebytes.com/appledoc/) tool.
|
308
|
+
#
|
309
|
+
# @example
|
310
|
+
#
|
311
|
+
# spec.documentation = { :appledoc => ['--no-repeat-first-par',
|
312
|
+
# '--no-warn-invalid-crossref'] }
|
313
|
+
#
|
314
|
+
# @param [Hash{Symbol=>Array<String>}] documentation
|
315
|
+
# Additional options to pass to the appledoc tool.
|
316
|
+
#
|
317
|
+
root_attribute :documentation, {
|
318
|
+
:container => Hash,
|
319
|
+
}
|
320
|
+
|
321
|
+
#-----------------------------------------------------------------------#
|
322
|
+
|
323
|
+
# @!group Platform
|
324
|
+
#
|
325
|
+
# A specification should indicate the platforms and the correspondent
|
326
|
+
# deployment targets on which the library is supported.
|
327
|
+
#
|
328
|
+
# If not defined in a subspec the attributes of this group inherit the
|
329
|
+
# value of the parent.
|
330
|
+
|
331
|
+
#-----------------------------------------------------------------------#
|
332
|
+
|
333
|
+
# The names of the platforms supported by the specification class.
|
334
|
+
#
|
335
|
+
PLATFORMS = [:osx, :ios].freeze
|
336
|
+
|
337
|
+
# @todo This currently is not used in the Ruby DSL.
|
338
|
+
#
|
339
|
+
attribute :platforms, {
|
340
|
+
:container => Hash,
|
341
|
+
:keys => PLATFORMS,
|
342
|
+
:multi_platform => false,
|
343
|
+
:inherited => true,
|
344
|
+
}
|
345
|
+
|
346
|
+
# The platform on which this Pod is supported. Leaving this blank
|
347
|
+
# means the Pod is supported on all platforms.
|
348
|
+
#
|
349
|
+
# @example
|
350
|
+
#
|
351
|
+
# spec.platform = :osx, "10.8"
|
352
|
+
#
|
353
|
+
# @example
|
354
|
+
#
|
355
|
+
# spec.platform = :ios
|
356
|
+
#
|
357
|
+
# @example
|
358
|
+
#
|
359
|
+
# spec.platform = :osx
|
360
|
+
#
|
361
|
+
# @param [Array<Symbol, String>] name_and_deployment_target
|
362
|
+
# A tuple where the first value is the name of the platform,
|
363
|
+
# (either `:ios` or `:osx`) and the second is the deployment
|
364
|
+
# target.
|
365
|
+
#
|
366
|
+
def platform=(args)
|
367
|
+
name, deployment_target = args
|
368
|
+
if name
|
369
|
+
attributes_hash["platforms"] = {
|
370
|
+
name.to_s => deployment_target
|
371
|
+
}
|
372
|
+
else
|
373
|
+
attributes_hash["platforms"] = {}
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
#------------------#
|
378
|
+
|
379
|
+
# The deployment targets of the supported platforms.
|
380
|
+
#
|
381
|
+
# @example
|
382
|
+
#
|
383
|
+
# spec.ios.deployment_target = "6.0"
|
384
|
+
#
|
385
|
+
# @example
|
386
|
+
#
|
387
|
+
# spec.osx.deployment_target = "10.8"
|
388
|
+
#
|
389
|
+
# @param [String] deployment_target
|
390
|
+
# The deployment target of the platform.
|
391
|
+
#
|
392
|
+
def deployment_target=(*args)
|
393
|
+
raise StandardError, "The deployment target can be declared only per platform."
|
394
|
+
end
|
395
|
+
|
396
|
+
#-----------------------------------------------------------------------#
|
397
|
+
|
398
|
+
# @!group Build settings
|
399
|
+
#
|
400
|
+
# In this group are listed the attributes related to the configuration
|
401
|
+
# of the build environment that should be used to build the library.
|
402
|
+
#
|
403
|
+
# If not defined in a subspec the attributes of this group inherit the
|
404
|
+
# value of the parent.
|
405
|
+
|
406
|
+
#-----------------------------------------------------------------------#
|
407
|
+
|
408
|
+
# @todo This currently is not used in the Ruby DSL.
|
409
|
+
#
|
410
|
+
attribute :dependencies, {
|
411
|
+
:container => Hash,
|
412
|
+
:inherited => true,
|
413
|
+
}
|
414
|
+
|
415
|
+
# Any dependency on other Pods or to a ‘sub-specification’.
|
416
|
+
#
|
417
|
+
# ---
|
418
|
+
#
|
419
|
+
# Dependencies can specify versions requirements. The use of the spermy
|
420
|
+
# indicator `~>` is recommended because it provides a good compromise
|
421
|
+
# between control on the version without being too restrictive.
|
422
|
+
#
|
423
|
+
# Pods with too restrictive dependencies, limit their compatibility with
|
424
|
+
# other Pods.
|
425
|
+
#
|
426
|
+
# @example
|
427
|
+
# spec.dependency = 'AFNetworking', '~> 1.0'
|
428
|
+
#
|
429
|
+
# @example
|
430
|
+
# spec.dependency = 'RestKit/CoreData', '~> 0.20.0'
|
431
|
+
#
|
432
|
+
# @example
|
433
|
+
# spec.ios.dependency = 'MBProgressHUD', '~> 0.5'
|
434
|
+
#
|
435
|
+
def dependency(*args)
|
436
|
+
name, *version_requirements = args
|
437
|
+
raise StandardError, "A specification can't require self as a subspec" if name == self.name
|
438
|
+
raise StandardError, "A subspec can't require one of its parents specifications" if @parent && @parent.name.include?(name)
|
439
|
+
attributes_hash["dependencies"] ||= {}
|
440
|
+
attributes_hash["dependencies"][name] = version_requirements
|
441
|
+
end
|
442
|
+
|
443
|
+
#------------------#
|
444
|
+
|
445
|
+
# @!method requires_arc=(flag)
|
446
|
+
#
|
447
|
+
# Wether the library requires ARC to be compiled. If true the
|
448
|
+
# `-fobjc-arc` flag will be added to the compiler flags.
|
449
|
+
#
|
450
|
+
# ---
|
451
|
+
#
|
452
|
+
# The default value of this attribute is __transitioning__ from `false`
|
453
|
+
# to `true`, and in the meanwhile this attribute is always required.
|
454
|
+
#
|
455
|
+
# @example
|
456
|
+
#
|
457
|
+
# spec.requires_arc = true
|
458
|
+
#
|
459
|
+
# @param [Bool] flag
|
460
|
+
# whether the source files require ARC.
|
461
|
+
#
|
462
|
+
attribute :requires_arc, {
|
463
|
+
:types => [TrueClass, FalseClass],
|
464
|
+
:default_value => false,
|
465
|
+
:inherited => true,
|
466
|
+
}
|
467
|
+
|
468
|
+
#------------------#
|
469
|
+
|
470
|
+
# @!method frameworks=(*frameworks)
|
471
|
+
#
|
472
|
+
# A list of frameworks that the user’s target needs to link against.
|
473
|
+
#
|
474
|
+
# @example
|
475
|
+
#
|
476
|
+
# spec.ios.framework = 'CFNetwork'
|
477
|
+
#
|
478
|
+
# @example
|
479
|
+
#
|
480
|
+
# spec.frameworks = 'QuartzCore', 'CoreData'
|
481
|
+
#
|
482
|
+
# @param [String, Array<String>] frameworks
|
483
|
+
# A list of framework names.
|
484
|
+
#
|
485
|
+
attribute :frameworks, {
|
486
|
+
:container => Array,
|
487
|
+
:singularize => true,
|
488
|
+
:inherited => true,
|
489
|
+
}
|
490
|
+
|
491
|
+
#------------------#
|
492
|
+
|
493
|
+
# @!method weak_frameworks=(*frameworks)
|
494
|
+
#
|
495
|
+
# A list of frameworks that the user’s target needs to **weakly** link
|
496
|
+
# against.
|
497
|
+
#
|
498
|
+
# @example
|
499
|
+
#
|
500
|
+
# spec.framework = 'Twitter'
|
501
|
+
#
|
502
|
+
# @param [String, Array<String>] weak_frameworks
|
503
|
+
# A list of frameworks names.
|
504
|
+
#
|
505
|
+
attribute :weak_frameworks, {
|
506
|
+
:container => Array,
|
507
|
+
:singularize => true,
|
508
|
+
:inherited => true,
|
509
|
+
}
|
510
|
+
|
511
|
+
#------------------#
|
512
|
+
|
513
|
+
# @!method libraries=(*libraries)
|
514
|
+
#
|
515
|
+
# A list of libraries that the user’s target (application) needs to
|
516
|
+
# link against.
|
517
|
+
#
|
518
|
+
# @example
|
519
|
+
#
|
520
|
+
# spec.ios.library = 'xml2'
|
521
|
+
#
|
522
|
+
# @example
|
523
|
+
#
|
524
|
+
# spec.libraries = 'xml2', 'z'
|
525
|
+
#
|
526
|
+
# @param [String, Array<String>] libraries
|
527
|
+
# A list of library names.
|
528
|
+
#
|
529
|
+
attribute :libraries, {
|
530
|
+
:container => Array,
|
531
|
+
:singularize => true,
|
532
|
+
:inherited => true,
|
533
|
+
}
|
534
|
+
|
535
|
+
#------------------#
|
536
|
+
|
537
|
+
# @!method compiler_flags=(flags)
|
538
|
+
#
|
539
|
+
# A list of flags which should be passed to the compiler.
|
540
|
+
#
|
541
|
+
# @example
|
542
|
+
#
|
543
|
+
# spec.compiler_flags = '-DOS_OBJECT_USE_OBJC=0', '-Wno-format'
|
544
|
+
#
|
545
|
+
# @param [String, Array<String>] flags
|
546
|
+
# A list of flags.
|
547
|
+
#
|
548
|
+
attribute :compiler_flags, {
|
549
|
+
:container => Array,
|
550
|
+
:singularize => true,
|
551
|
+
:inherited => true,
|
552
|
+
}
|
553
|
+
|
554
|
+
#------------------#
|
555
|
+
|
556
|
+
# @!method xcconfig=(value)
|
557
|
+
#
|
558
|
+
# Any flag to add to the final xcconfig file.
|
559
|
+
#
|
560
|
+
# @example
|
561
|
+
#
|
562
|
+
# spec.xcconfig = { 'OTHER_LDFLAGS' => '-lObjC' }
|
563
|
+
#
|
564
|
+
# @param [Hash{String => String}] value
|
565
|
+
# A representing an xcconfig.
|
566
|
+
#
|
567
|
+
attribute :xcconfig, {
|
568
|
+
:container => Hash,
|
569
|
+
:inherited => true,
|
570
|
+
}
|
571
|
+
|
572
|
+
#------------------#
|
573
|
+
|
574
|
+
# @!method prefix_header_contents=(content)
|
575
|
+
#
|
576
|
+
# Any content to inject in the prefix header of the pod project.
|
577
|
+
#
|
578
|
+
# ---
|
579
|
+
#
|
580
|
+
# This attribute is __not recommended__ as Pods should not pollute the
|
581
|
+
# prefix header of other libraries or of the user project.
|
582
|
+
#
|
583
|
+
# @example
|
584
|
+
#
|
585
|
+
# spec.prefix_header_contents = '#import <UIKit/UIKit.h>'
|
586
|
+
#
|
587
|
+
# @example
|
588
|
+
#
|
589
|
+
# spec.prefix_header_contents = '#import <UIKit/UIKit.h>', '#import <Foundation/Foundation.h>'
|
590
|
+
#
|
591
|
+
# @param [String] content
|
592
|
+
# The contents of the prefix header.
|
593
|
+
#
|
594
|
+
attribute :prefix_header_contents, {
|
595
|
+
:types => [Array, String],
|
596
|
+
:inherited => true,
|
597
|
+
}
|
598
|
+
|
599
|
+
#------------------#
|
600
|
+
|
601
|
+
# @!method prefix_header_file=(path)
|
602
|
+
#
|
603
|
+
# A path to a prefix header file to inject in the prefix header of the
|
604
|
+
# pod project.
|
605
|
+
#
|
606
|
+
# ---
|
607
|
+
#
|
608
|
+
# This attribute is __not recommended__ as Pods should not pollute the
|
609
|
+
# prefix header of other libraries or of the user project.
|
610
|
+
#
|
611
|
+
# @example
|
612
|
+
#
|
613
|
+
# spec.prefix_header_file = 'iphone/include/prefix.pch'
|
614
|
+
#
|
615
|
+
# @param [String] path
|
616
|
+
# The path to the prefix header file.
|
617
|
+
#
|
618
|
+
attribute :prefix_header_file, {
|
619
|
+
:inherited => true
|
620
|
+
}
|
621
|
+
|
622
|
+
|
623
|
+
#------------------#
|
624
|
+
|
625
|
+
# @!method header_dir=(dir)
|
626
|
+
#
|
627
|
+
# The directory where to store the headers files so they don't break
|
628
|
+
# includes.
|
629
|
+
#
|
630
|
+
# @example
|
631
|
+
#
|
632
|
+
# spec.header_dir = 'Three20Core'
|
633
|
+
#
|
634
|
+
# @param [String] dir
|
635
|
+
# the headers directory.
|
636
|
+
#
|
637
|
+
attribute :header_dir, {
|
638
|
+
:inherited => true
|
639
|
+
}
|
640
|
+
|
641
|
+
#------------------#
|
642
|
+
|
643
|
+
# @!method header_mappings_dir=(dir)
|
644
|
+
#
|
645
|
+
# A directory from where to preserve the folder structure for the
|
646
|
+
# headers files. If not provided the headers files are flattened.
|
647
|
+
#
|
648
|
+
# @example
|
649
|
+
#
|
650
|
+
# spec.header_mappings_dir = 'src/include'
|
651
|
+
#
|
652
|
+
# @param [String] dir
|
653
|
+
# the directory from where to preserve the headers namespacing.
|
654
|
+
#
|
655
|
+
attribute :header_mappings_dir, {
|
656
|
+
:inherited => true
|
657
|
+
}
|
658
|
+
|
659
|
+
#-----------------------------------------------------------------------#
|
660
|
+
|
661
|
+
# @!group File patterns
|
662
|
+
#
|
663
|
+
# These paths should be specified **relative** to the **root** of the
|
664
|
+
# source and may contain the following wildcard patterns:
|
665
|
+
#
|
666
|
+
# ---
|
667
|
+
#
|
668
|
+
# ### Pattern: *
|
669
|
+
#
|
670
|
+
# Matches any file. Can be restricted by other values in the glob.
|
671
|
+
#
|
672
|
+
# * `*` will match all files
|
673
|
+
# * `c*` will match all files beginning with `c`
|
674
|
+
# * `*c` will match all files ending with `c`
|
675
|
+
# * `*c*` will match all files that have `c` in them (including at the
|
676
|
+
# beginning or end)
|
677
|
+
#
|
678
|
+
# Equivalent to `/.*/x` in regexp.
|
679
|
+
#
|
680
|
+
# **Note** this will not match Unix-like hidden files (dotfiles). In
|
681
|
+
# order to include those in the match results, you must use something
|
682
|
+
# like `{*,.*}`.
|
683
|
+
#
|
684
|
+
# ---
|
685
|
+
#
|
686
|
+
# ### Pattern: **
|
687
|
+
#
|
688
|
+
# Matches directories recursively.
|
689
|
+
#
|
690
|
+
# ---
|
691
|
+
#
|
692
|
+
# ### Pattern: ?
|
693
|
+
#
|
694
|
+
# Matches any one character. Equivalent to `/.{1}/` in regexp.
|
695
|
+
#
|
696
|
+
# ---
|
697
|
+
#
|
698
|
+
# ### Pattern: [set]
|
699
|
+
#
|
700
|
+
# Matches any one character in set.
|
701
|
+
#
|
702
|
+
# Behaves exactly like character sets in Regexp, including set negation
|
703
|
+
# (`[^a-z]`).
|
704
|
+
#
|
705
|
+
# ---
|
706
|
+
#
|
707
|
+
# ### Pattern: {p,q}
|
708
|
+
#
|
709
|
+
# Matches either literal `p` or literal `q`.
|
710
|
+
#
|
711
|
+
# Matching literals may be more than one character in length. More than
|
712
|
+
# two literals may be specified.
|
713
|
+
#
|
714
|
+
# Equivalent to pattern alternation in regexp.
|
715
|
+
#
|
716
|
+
# ---
|
717
|
+
#
|
718
|
+
# ### Pattern: \
|
719
|
+
#
|
720
|
+
# Escapes the next meta-character.
|
721
|
+
#
|
722
|
+
# ---
|
723
|
+
#
|
724
|
+
# ### Examples
|
725
|
+
#
|
726
|
+
# Consider these to be evaluated in the source root of
|
727
|
+
# [JSONKit](https://github.com/johnezang/JSONKit).
|
728
|
+
#
|
729
|
+
# "JSONKit.?" #=> ["JSONKit.h", "JSONKit.m"]
|
730
|
+
# "*.[a-z][a-z]" #=> ["CHANGELOG.md", "README.md"]
|
731
|
+
# "*.[^m]*" #=> ["JSONKit.h"]
|
732
|
+
# "*.{h,m}" #=> ["JSONKit.h", "JSONKit.m"]
|
733
|
+
# "*" #=> ["CHANGELOG.md", "JSONKit.h", "JSONKit.m", "README.md"]
|
734
|
+
|
735
|
+
#-----------------------------------------------------------------------#
|
736
|
+
|
737
|
+
# @!method source_files=(source_files)
|
738
|
+
#
|
739
|
+
# The source files of the Pod.
|
740
|
+
#
|
741
|
+
# @example
|
742
|
+
#
|
743
|
+
# spec.source_files = "Classes/**/*.{h,m}"
|
744
|
+
#
|
745
|
+
# @example
|
746
|
+
#
|
747
|
+
# spec.source_files = "Classes/**/*.{h,m}", "More_Classes/**/*.{h,m}"
|
748
|
+
#
|
749
|
+
# @param [String, Array<String>] source_files
|
750
|
+
# the source files of the Pod.
|
751
|
+
#
|
752
|
+
attribute :source_files, {
|
753
|
+
:container => Array,
|
754
|
+
:file_patterns => true,
|
755
|
+
}
|
756
|
+
|
757
|
+
#------------------#
|
758
|
+
|
759
|
+
# @!method public_header_files=(public_header_files)
|
760
|
+
#
|
761
|
+
# A list of file patterns that should be used as public headers.
|
762
|
+
#
|
763
|
+
# ---
|
764
|
+
#
|
765
|
+
# These are the headers that will be exposed to the user’s project and
|
766
|
+
# from which documentation will be generated. If no public headers are
|
767
|
+
# specified then **all** the headers are considered public.
|
768
|
+
#
|
769
|
+
# @example
|
770
|
+
#
|
771
|
+
# spec.public_header_files = "Headers/Public/*.h"
|
772
|
+
#
|
773
|
+
# @param [String, Array<String>] public_header_files
|
774
|
+
# the public headers of the Pod.
|
775
|
+
#
|
776
|
+
attribute :public_header_files, {
|
777
|
+
:container => Array,
|
778
|
+
:file_patterns => true,
|
779
|
+
}
|
780
|
+
|
781
|
+
#------------------#
|
782
|
+
|
783
|
+
# @!method resources=(resources)
|
784
|
+
#
|
785
|
+
# A list of resources that should be copied into the target bundle.
|
786
|
+
#
|
787
|
+
# @example
|
788
|
+
#
|
789
|
+
# spec.resource = "Resources/HockeySDK.bundle"
|
790
|
+
#
|
791
|
+
# @example
|
792
|
+
#
|
793
|
+
# spec.resources = ["Images/*.png", "Sounds/*"]
|
794
|
+
#
|
795
|
+
# @param [String, Array<String>] resources the resources of the Pod.
|
796
|
+
#
|
797
|
+
attribute :resources, {
|
798
|
+
:container => Array,
|
799
|
+
:file_patterns => true,
|
800
|
+
:singularize => true,
|
801
|
+
}
|
802
|
+
|
803
|
+
#------------------#
|
804
|
+
|
805
|
+
# The possible destinations for the `resources` attribute. Extracted form
|
806
|
+
# `Xcodeproj::Constants.COPY_FILES_BUILD_PHASE_DESTINATIONS`.
|
807
|
+
#
|
808
|
+
RESOURCES_DESTINATIONS = [
|
809
|
+
:products_directory,
|
810
|
+
:wrapper,
|
811
|
+
:resources,
|
812
|
+
:executables,
|
813
|
+
:java_resources,
|
814
|
+
:frameworks,
|
815
|
+
:shared_frameworks,
|
816
|
+
:shared_support,
|
817
|
+
:plug_ins,
|
818
|
+
].freeze
|
819
|
+
|
820
|
+
# @todo Implement in CP 0.18
|
821
|
+
# method resources_bundle=(resources)
|
822
|
+
#
|
823
|
+
# A list of resources that should be copied into the target bundle.
|
824
|
+
#
|
825
|
+
# ---
|
826
|
+
#
|
827
|
+
# It is possible to specify a destination, if not specified the files
|
828
|
+
# are copied to the `resources` folder of the bundle.
|
829
|
+
#
|
830
|
+
# @example
|
831
|
+
#
|
832
|
+
# spec.resource = "Resources/HockeySDK.bundle"
|
833
|
+
#
|
834
|
+
# @example
|
835
|
+
#
|
836
|
+
# spec.resources = "Resources/*.png"
|
837
|
+
#
|
838
|
+
# @example
|
839
|
+
#
|
840
|
+
# spec.resources = { :frameworks => 'frameworks/CrashReporter.framework' }
|
841
|
+
#
|
842
|
+
# @param [Hash, String, Array<String>] resources
|
843
|
+
# the resources of the Pod.
|
844
|
+
#
|
845
|
+
# attribute :resources_bundle, {
|
846
|
+
# :types => [String, Array],
|
847
|
+
# :file_patterns => true,
|
848
|
+
# :container => Hash,
|
849
|
+
# :keys => RESOURCES_DESTINATIONS,
|
850
|
+
# :singularize => true,
|
851
|
+
# }
|
852
|
+
|
853
|
+
#------------------#
|
854
|
+
|
855
|
+
# @!method exclude_files=(exclude_files)
|
856
|
+
#
|
857
|
+
# A list of file patterns that should be excluded from the other
|
858
|
+
# file patterns.
|
859
|
+
#
|
860
|
+
# @example
|
861
|
+
#
|
862
|
+
# spec.ios.exclude_files = "Classes/osx"
|
863
|
+
#
|
864
|
+
# @example
|
865
|
+
#
|
866
|
+
# spec.exclude_files = "Classes/**/unused.{h,m}"
|
867
|
+
#
|
868
|
+
# @param [String, Array<String>] exclude_files
|
869
|
+
# the file patterns that the Pod should ignore.
|
870
|
+
#
|
871
|
+
attribute :exclude_files, {
|
872
|
+
:container => Array,
|
873
|
+
:file_patterns => true,
|
874
|
+
}
|
875
|
+
|
876
|
+
#------------------#
|
877
|
+
|
878
|
+
# @!method preserve_paths=(preserve_paths)
|
879
|
+
#
|
880
|
+
# Any file that should **not** be removed after being downloaded.
|
881
|
+
#
|
882
|
+
# ---
|
883
|
+
#
|
884
|
+
# By default, CocoaPods removes all files that are not matched by any
|
885
|
+
# of the other file pattern.
|
886
|
+
#
|
887
|
+
# @example
|
888
|
+
#
|
889
|
+
# spec.preserve_path = "IMPORTANT.txt"
|
890
|
+
#
|
891
|
+
# @example
|
892
|
+
#
|
893
|
+
# spec.preserve_paths = "Frameworks/*.framework"
|
894
|
+
#
|
895
|
+
# @param [String, Array<String>] preserve_paths
|
896
|
+
# the paths that should be not cleaned.
|
897
|
+
#
|
898
|
+
attribute :preserve_paths, {
|
899
|
+
:container => Array,
|
900
|
+
:file_patterns => true,
|
901
|
+
:singularize => true
|
902
|
+
}
|
903
|
+
|
904
|
+
#-----------------------------------------------------------------------#
|
905
|
+
|
906
|
+
# @!group Hooks
|
907
|
+
#
|
908
|
+
# The specification class provides hooks which are called by CocoaPods
|
909
|
+
# when a Pod is installed.
|
910
|
+
|
911
|
+
#-----------------------------------------------------------------------#
|
912
|
+
|
913
|
+
# This is a convenience method which gets called after all pods have been
|
914
|
+
# downloaded but before they have been installed, and the Xcode project
|
915
|
+
# and related files have been generated.
|
916
|
+
#
|
917
|
+
# It receives the `Pod::LocalPod` instance generated form the
|
918
|
+
# specification and the `Pod::Podfile::TargetDefinition` instance for the
|
919
|
+
# current target.
|
920
|
+
#
|
921
|
+
# Override this to, for instance, to run any build script.
|
922
|
+
#
|
923
|
+
# @example
|
924
|
+
#
|
925
|
+
# Pod::Spec.new do |spec|
|
926
|
+
# spec.pre_install do |pod, target_definition|
|
927
|
+
# Dir.chdir(pod.root){ `sh make.sh` }
|
928
|
+
# end
|
929
|
+
# end
|
930
|
+
#
|
931
|
+
def pre_install(&block)
|
932
|
+
@pre_install_callback = block
|
933
|
+
end
|
934
|
+
|
935
|
+
# This is a convenience method which gets called after all pods have been
|
936
|
+
# downloaded, installed, and the Xcode project and related files have
|
937
|
+
# been generated.
|
938
|
+
#
|
939
|
+
# It receives the `Pod::Installer::TargetInstaller` instance for the
|
940
|
+
# current target.
|
941
|
+
#
|
942
|
+
# Override this to, for instance, add to the prefix header.
|
943
|
+
#
|
944
|
+
# @example
|
945
|
+
#
|
946
|
+
# Pod::Spec.new do |spec|
|
947
|
+
# spec.post_install do |target_installer|
|
948
|
+
# prefix_header = config.project_pods_root + target_installer.prefix_header_filename
|
949
|
+
# prefix_header.open('a') do |file|
|
950
|
+
# file.puts('#ifdef __OBJC__\n#import "SSToolkitDefines.h"\n#endif')
|
951
|
+
# end
|
952
|
+
# end
|
953
|
+
# end
|
954
|
+
#
|
955
|
+
def post_install(&block)
|
956
|
+
@post_install_callback = block
|
957
|
+
end
|
958
|
+
|
959
|
+
#-----------------------------------------------------------------------#
|
960
|
+
|
961
|
+
# @!group Subspecs
|
962
|
+
#
|
963
|
+
# A library can specify a dependency on either another library, a
|
964
|
+
# subspec of another library, or a subspec of itself.
|
965
|
+
|
966
|
+
#-----------------------------------------------------------------------#
|
967
|
+
|
968
|
+
# Represents specification for a module of the library.
|
969
|
+
#
|
970
|
+
# ---
|
971
|
+
#
|
972
|
+
# Subspecs participate on a dual hierarchy.
|
973
|
+
#
|
974
|
+
# On one side, a specification automatically inherits as a dependency all
|
975
|
+
# it children ‘sub-specifications’ (unless a default subspec is
|
976
|
+
# specified).
|
977
|
+
#
|
978
|
+
# On the other side, a ‘sub-specification’ inherits the value of the
|
979
|
+
# attributes of the parents so common values for attributes can be
|
980
|
+
# specified in the ancestors.
|
981
|
+
#
|
982
|
+
# Although it sounds complicated in practice it means that subspecs in
|
983
|
+
# general do what you would expect:
|
984
|
+
#
|
985
|
+
# pod 'ShareKit', '2.0'
|
986
|
+
#
|
987
|
+
# Installs ShareKit with all the sharers like `ShareKit/Evernote`,
|
988
|
+
# `ShareKit/Facebook`, etc, as they are defined a subspecs.
|
989
|
+
#
|
990
|
+
# pod 'ShareKit/Twitter', '2.0'
|
991
|
+
# pod 'ShareKit/Pinboard', '2.0'
|
992
|
+
#
|
993
|
+
# Installs ShareKit with only the source files for `ShareKit/Twitter`,
|
994
|
+
# `ShareKit/Pinboard`. Note that, in this case, the ‘sub-specifications’
|
995
|
+
# to compile need the source files, the dependencies, and the other
|
996
|
+
# attributes defined by the root specification. CocoaPods is smart enough
|
997
|
+
# to handle any issues arising from duplicate attributes.
|
998
|
+
#
|
999
|
+
# @example Subspecs with different source files.
|
1000
|
+
#
|
1001
|
+
# subspec "Twitter" do |sp|
|
1002
|
+
# sp.source_files = "Classes/Twitter"
|
1003
|
+
# end
|
1004
|
+
#
|
1005
|
+
# subspec "Pinboard" do |sp|
|
1006
|
+
# sp.source_files = "Classes/Pinboard"
|
1007
|
+
# end
|
1008
|
+
#
|
1009
|
+
# @example Subspecs referencing dependencies to other subspecs.
|
1010
|
+
#
|
1011
|
+
# Pod::Spec.new do |s|
|
1012
|
+
# s.name = 'RestKit'
|
1013
|
+
#
|
1014
|
+
# s.subspec 'Core' do |cs|
|
1015
|
+
# cs.dependency 'RestKit/ObjectMapping'
|
1016
|
+
# cs.dependency 'RestKit/Network'
|
1017
|
+
# cs.dependency 'RestKit/CoreData'
|
1018
|
+
# end
|
1019
|
+
#
|
1020
|
+
# s.subspec 'ObjectMapping' do |os|
|
1021
|
+
# end
|
1022
|
+
# end
|
1023
|
+
#
|
1024
|
+
# @example Nested subspecs.
|
1025
|
+
#
|
1026
|
+
# Pod::Spec.new do |s|
|
1027
|
+
# s.name = 'Root'
|
1028
|
+
#
|
1029
|
+
# s.subspec 'Level_1' do |sp|
|
1030
|
+
# sp.subspec 'Level_2' do |ssp|
|
1031
|
+
# end
|
1032
|
+
# end
|
1033
|
+
# end
|
1034
|
+
#
|
1035
|
+
def subspec(name, &block)
|
1036
|
+
subspec = Specification.new(self, name, &block)
|
1037
|
+
@subspecs << subspec
|
1038
|
+
subspec
|
1039
|
+
end
|
1040
|
+
|
1041
|
+
#------------------#
|
1042
|
+
|
1043
|
+
# @!method default_subspec=(subspec_name)
|
1044
|
+
#
|
1045
|
+
# The name of the subspec that should be used as preferred dependency.
|
1046
|
+
# If not specified a specifications requires all its subspecs as
|
1047
|
+
# dependencies.
|
1048
|
+
#
|
1049
|
+
# ---
|
1050
|
+
#
|
1051
|
+
# A Pod should make available the full library by default. Users can
|
1052
|
+
# fine tune their dependencies, and exclude unneeded subspecs, once
|
1053
|
+
# their requirements are known. Therefore, this attribute is rarely
|
1054
|
+
# needed. It is intended to be used to select a default if there are
|
1055
|
+
# ‘sub-specifications’ which provide alternative incompatible
|
1056
|
+
# implementations, or to exclude modules rarely needed (especially if
|
1057
|
+
# they trigger dependencies on other libraries).
|
1058
|
+
#
|
1059
|
+
# @example
|
1060
|
+
# spec.default_subspec = 'Pod/Core'
|
1061
|
+
#
|
1062
|
+
# @param [String] subspec_name
|
1063
|
+
# the name of the subspec that should be inherited as
|
1064
|
+
# dependency.
|
1065
|
+
#
|
1066
|
+
attribute :default_subspec, {
|
1067
|
+
:multi_platform => false,
|
1068
|
+
}
|
1069
|
+
|
1070
|
+
#-----------------------------------------------------------------------#
|
1071
|
+
|
1072
|
+
# @!group Multi-Platform support
|
1073
|
+
#
|
1074
|
+
# A specification can store values which are specific to only one
|
1075
|
+
# platform.
|
1076
|
+
#
|
1077
|
+
# ---
|
1078
|
+
#
|
1079
|
+
# For example one might want to store resources which are specific to
|
1080
|
+
# only iOS projects.
|
1081
|
+
#
|
1082
|
+
# spec.resources = "Resources/**/*.png"
|
1083
|
+
# spec.ios.resources = "Resources_ios/**/*.png"
|
1084
|
+
|
1085
|
+
#-----------------------------------------------------------------------#
|
1086
|
+
|
1087
|
+
# Provides support for specifying iOS attributes.
|
1088
|
+
#
|
1089
|
+
# @example
|
1090
|
+
# spec.ios.source_files = "Classes/ios/**/*.{h,m}"
|
1091
|
+
#
|
1092
|
+
# @return [PlatformProxy] the proxy that will set the attributes.
|
1093
|
+
#
|
1094
|
+
def ios
|
1095
|
+
PlatformProxy.new(self, :ios)
|
1096
|
+
end
|
1097
|
+
|
1098
|
+
# Provides support for specifying OS X attributes.
|
1099
|
+
#
|
1100
|
+
# @example
|
1101
|
+
# spec.osx.source_files = "Classes/osx/**/*.{h,m}"
|
1102
|
+
#
|
1103
|
+
# @return [PlatformProxy] the proxy that will set the attributes.
|
1104
|
+
#
|
1105
|
+
def osx
|
1106
|
+
PlatformProxy.new(self, :osx)
|
1107
|
+
end
|
1108
|
+
end
|
1109
|
+
end
|
1110
|
+
end
|