cocoapods-core 0.17.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +20 -0
  3. data/README.md +36 -0
  4. data/lib/cocoapods-core/core_ui.rb +19 -0
  5. data/lib/cocoapods-core/dependency.rb +295 -0
  6. data/lib/cocoapods-core/gem_version.rb +6 -0
  7. data/lib/cocoapods-core/lockfile.rb +440 -0
  8. data/lib/cocoapods-core/platform.rb +171 -0
  9. data/lib/cocoapods-core/podfile/dsl.rb +459 -0
  10. data/lib/cocoapods-core/podfile/target_definition.rb +503 -0
  11. data/lib/cocoapods-core/podfile.rb +345 -0
  12. data/lib/cocoapods-core/requirement.rb +15 -0
  13. data/lib/cocoapods-core/source/validator.rb +183 -0
  14. data/lib/cocoapods-core/source.rb +284 -0
  15. data/lib/cocoapods-core/specification/consumer.rb +356 -0
  16. data/lib/cocoapods-core/specification/dsl/attribute.rb +245 -0
  17. data/lib/cocoapods-core/specification/dsl/attribute_support.rb +76 -0
  18. data/lib/cocoapods-core/specification/dsl/deprecations.rb +47 -0
  19. data/lib/cocoapods-core/specification/dsl/platform_proxy.rb +67 -0
  20. data/lib/cocoapods-core/specification/dsl.rb +1110 -0
  21. data/lib/cocoapods-core/specification/linter.rb +436 -0
  22. data/lib/cocoapods-core/specification/root_attribute_accessors.rb +152 -0
  23. data/lib/cocoapods-core/specification/set/presenter.rb +229 -0
  24. data/lib/cocoapods-core/specification/set/statistics.rb +277 -0
  25. data/lib/cocoapods-core/specification/set.rb +171 -0
  26. data/lib/cocoapods-core/specification/yaml.rb +60 -0
  27. data/lib/cocoapods-core/specification.rb +592 -0
  28. data/lib/cocoapods-core/standard_error.rb +84 -0
  29. data/lib/cocoapods-core/vendor/dependency.rb +264 -0
  30. data/lib/cocoapods-core/vendor/requirement.rb +208 -0
  31. data/lib/cocoapods-core/vendor/version.rb +333 -0
  32. data/lib/cocoapods-core/vendor.rb +56 -0
  33. data/lib/cocoapods-core/version.rb +99 -0
  34. data/lib/cocoapods-core/yaml_converter.rb +202 -0
  35. data/lib/cocoapods-core.rb +23 -0
  36. metadata +154 -0
@@ -0,0 +1,459 @@
1
+ module Pod
2
+ class Podfile
3
+
4
+ # The of the methods defined in this file and the order of the methods is
5
+ # relevant for the documentation generated on
6
+ # CocoaPods/cocoapods.github.com.
7
+
8
+ # The Podfile is a specification that describes the dependencies of the
9
+ # targets of one or more Xcode projects. The Podfile always creates an
10
+ # implicit target, named `default`, which links to the first target of the
11
+ # user project.
12
+ #
13
+ # A podfile can be very simple:
14
+ #
15
+ # pod 'AFNetworking', '~> 1.0'
16
+ #
17
+ # An example of a more complex podfile can be:
18
+ #
19
+ # platform :ios, '6.0'
20
+ # inhibit_all_warnings!
21
+ #
22
+ # xcodeproj `MyProject`
23
+ #
24
+ # pod 'ObjectiveSugar', '~> 0.5'
25
+ #
26
+ # target :test do
27
+ # pod 'OCMock', '~> 2.0.1'
28
+ # end
29
+ #
30
+ # post_install do |installer|
31
+ # installer.project.targets.each do |target|
32
+ # puts "#{target.name}"
33
+ # end
34
+ # end
35
+ #
36
+ module DSL
37
+
38
+ # @!group Dependencies
39
+ # The Podfile specifies the dependencies of each user target.
40
+
41
+ #-----------------------------------------------------------------------#
42
+
43
+ # Specifies a dependency of the project.
44
+ #
45
+ # A dependency requirement is defined by the name of the Pod and
46
+ # optionally a list of version requirements.
47
+ #
48
+ # ------
49
+ #
50
+ # When starting out with a project it is likely that you will want to use
51
+ # the latest version of a Pod. If this is the case, simply omit the
52
+ # version requirements.
53
+ #
54
+ # pod 'SSZipArchive'
55
+ #
56
+ #
57
+ # Later on in the project you may want to freeze to a specific version of
58
+ # a Pod, in which case you can specify that version number.
59
+ #
60
+ # pod 'Objection', '0.9'
61
+ #
62
+ #
63
+ # Besides no version, or a specific one, it is also possible to use
64
+ # operators:
65
+ #
66
+ # * `> 0.1` Any version higher than 0.1
67
+ # * `>= 0.1` Version 0.1 and any higher version
68
+ # * `< 0.1` Any version lower than 0.1
69
+ # * `<= 0.1` Version 0.1 and any lower version
70
+ # * `~> 0.1.2` Version 0.1.2 and the versions up to 0.2, not including 0.2
71
+ #
72
+ # A list of version requirements can be specified for even more fine
73
+ # grained control.
74
+ #
75
+ # For more information, regarding versioning policy, see:
76
+ #
77
+ # * [Semantic Versioning](http://semver.org)
78
+ # * [RubyGems Versioning Policies](http://docs.rubygems.org/read/chapter/7)
79
+ #
80
+ # Finally, instead of a version, you can specify the `:head` flag. This
81
+ # will use the pod’s latest version spec version, but force the download
82
+ # of the ‘bleeding edge’ version. Use this with caution, as the spec
83
+ # might not be compatible anymore.
84
+ #
85
+ # pod 'Objection', :head
86
+ #
87
+ # ------
88
+ #
89
+ # Dependencies can be obtained also from external sources.
90
+ #
91
+ # ### From a podspec in the root of a library repo.
92
+ #
93
+ # Sometimes you may want to use the bleeding edge version of a Pod. Or a
94
+ # specific revision. If this is the case, you can specify that with your
95
+ # pod declaration.
96
+ #
97
+ # To use the `master` branch of the repo:
98
+ #
99
+ # pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git'
100
+ #
101
+ #
102
+ # Or specify a commit:
103
+ #
104
+ # pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :commit => '082f8319af'
105
+ #
106
+ #
107
+ # Or specify a local folder in the machine:
108
+ #
109
+ # pod 'AFNetworking', :local => '~/Documents/AFNetworking'
110
+ #
111
+ #
112
+ # It is important to note, though, that this means that the version will
113
+ # have to satisfy any other dependencies on the Pod by other Pods.
114
+ #
115
+ #
116
+ # The `podspec` file is expected to be in the root of the repo, if this
117
+ # library does not have a `podspec` file in its repo yet, you will have
118
+ # to use one of the approaches outlined in the sections below.
119
+ #
120
+ #
121
+ # ### From a podspec outside a spec repo, for a library without podspec.
122
+ #
123
+ # If a podspec is available from another source outside of the library’s
124
+ # repo. Consider, for instance, a podspec available via HTTP:
125
+ #
126
+ # pod 'JSONKit', :podspec => 'https://raw.github.com/gist/1346394/1d26570f68ca27377a27430c65841a0880395d72/JSONKit.podspec'
127
+ #
128
+ # @note This method allow a nil name and the raises to be more
129
+ # informative.
130
+ #
131
+ # @note Support for inline podspecs has been deprecated.
132
+ #
133
+ # @return [void]
134
+ #
135
+ def pod(name = nil, *requirements, &block)
136
+ if block
137
+ raise StandardError, "Inline specifications are deprecated. Please store the specification in a `podspec` file."
138
+ end
139
+
140
+ unless name
141
+ raise StandardError, "A dependency requires a name."
142
+ end
143
+
144
+ current_target_definition.store_pod(name, *requirements)
145
+ end
146
+
147
+ # Use the dependencies of a Pod defined in the given podspec file. If no
148
+ # arguments are passed the first podspec in the root of the Podfile is
149
+ # used. It is intended to be used by the project of a library.
150
+ #
151
+ # @example
152
+ # podspec
153
+ #
154
+ # @example
155
+ # podspec :name => 'QuickDialog'
156
+ #
157
+ # @example
158
+ # podspec :path => '/Documents/PrettyKit/PrettyKit.podspec'
159
+ #
160
+ # @param [Hash {Symbol=>String}] options
161
+ # the path where to load the {Specification}. If not provided the
162
+ # first podspec in the directory of the podfile is used.
163
+ #
164
+ # @option options [String] :path
165
+ # the path of the podspec file
166
+ #
167
+ # @option options [String] :name
168
+ # the name of the podspec
169
+ #
170
+ # @note This method uses the dependencies declared by the for the
171
+ # platform of the target definition.
172
+ #
173
+ #
174
+ # @note This method requires that the Podfile has a non nil value for
175
+ # {#defined_in_file} unless the path option is used.
176
+ #
177
+ # @return [void]
178
+ #
179
+ def podspec(options = nil)
180
+ current_target_definition.store_podspec(options)
181
+ end
182
+
183
+ # Defines a new static library target and scopes dependencies defined from
184
+ # the given block. The target will by default include the dependencies
185
+ # defined outside of the block, unless the `:exclusive => true` option is
186
+ # given.
187
+ #
188
+ # ---
189
+ #
190
+ # The Podfile creates a global target named `:default` which produces the
191
+ # `libPods.a` file. This target is linked with the first target of user
192
+ # project if not value is specified for the `link_with` attribute.
193
+ #
194
+ # @param [Symbol, String] name
195
+ # the name of the target definition.
196
+ #
197
+ # @option options [Bool] :exclusive
198
+ # whether the target should inherit the dependencies of its
199
+ # parent. by default targets are inclusive.
200
+ #
201
+ # @example Defining a target
202
+ #
203
+ # target :ZipApp do
204
+ # pod 'SSZipArchive'
205
+ # end
206
+ #
207
+ # @example Defining an exclusive target
208
+ #
209
+ # target :ZipApp do
210
+ # pod 'SSZipArchive'
211
+ # target :test, :exclusive => true do
212
+ # pod 'JSONKit'
213
+ # end
214
+ # end
215
+ #
216
+ # @return [void]
217
+ #
218
+ def target(name, options = {})
219
+ if options && !options.keys.all? { |key| [:exclusive].include?(key) }
220
+ raise StandardError, "Unsupported options `#{options}` for target `#{name}`"
221
+ end
222
+
223
+ parent = current_target_definition
224
+ definition = TargetDefinition.new(name, parent)
225
+ definition.exclusive = true if options[:exclusive]
226
+ self.current_target_definition = definition
227
+ yield
228
+ ensure
229
+ self.current_target_definition = parent
230
+ end
231
+
232
+ #-----------------------------------------------------------------------#
233
+
234
+ # @!group Target configuration
235
+ # This group list the options to configure a target.
236
+
237
+ #-----------------------------------------------------------------------#
238
+
239
+ # Specifies the platform for which a static library should be build.
240
+ #
241
+ # -----
242
+ #
243
+ # CocoaPods provides a default deployment target if one is not specified.
244
+ # The current default values are `4.3` for iOS and `10.6` for OS X.
245
+ #
246
+ # -----
247
+ #
248
+ # If the deployment target requires it (iOS < `4.3`), `armv6`
249
+ # architecture will be added to `ARCHS`.
250
+ #
251
+ # @param [Symbol] name
252
+ # the name of platform, can be either `:osx` for OS X or `:ios`
253
+ # for iOS.
254
+ #
255
+ # @param [String, Version] target
256
+ # The optional deployment. If not provided a default value
257
+ # according to the platform name will be assigned.
258
+ #
259
+ # @example Specifying the platform
260
+ #
261
+ # platform :ios, "4.0"
262
+ # platform :ios
263
+ #
264
+ # @return [void]
265
+ #
266
+ def platform(name, target = nil)
267
+
268
+ # Support for deprecated options parameter
269
+ target = target[:deployment_target] if target.is_a?(Hash)
270
+
271
+ current_target_definition.set_platform(name, target)
272
+ end
273
+
274
+ # Specifies the Xcode project that contains the target that the Pods library
275
+ # should be linked with.
276
+ #
277
+ # -----
278
+ #
279
+ # If no explicit project is specified, it will use the Xcode project of
280
+ # the parent target. If none of the target definitions specify an
281
+ # explicit project and there is only **one** project in the same
282
+ # directory as the Podfile then that project will be used.
283
+ #
284
+ # @param [String] path
285
+ # the path of the project to link with
286
+ #
287
+ # @param [Hash{String => symbol}] build_configurations
288
+ # a hash where the keys are the name of the build configurations
289
+ # in your Xcode project and the values are Symbols that specify
290
+ # if the configuration should be based on the `:debug` or
291
+ # `:release` configuration. If no explicit mapping is specified
292
+ # for a configuration in your project, it will default to
293
+ # `:release`.
294
+ #
295
+ # @example Specifying the user project
296
+ #
297
+ # # Look for target to link with in an Xcode project called
298
+ # # `MyProject.xcodeproj`.
299
+ # xcodeproj `MyProject`
300
+ #
301
+ # target :test do
302
+ # # This Pods library links with a target in another project.
303
+ # xcodeproj `TestProject`
304
+ # end
305
+ #
306
+ # @return [void]
307
+ #
308
+ def xcodeproj(path, build_configurations = {})
309
+ current_target_definition.user_project_path = path
310
+ current_target_definition.build_configurations = build_configurations
311
+ end
312
+
313
+ # Specifies the target(s) in the user’s project that this Pods library
314
+ # should be linked in.
315
+ #
316
+ # -----
317
+ #
318
+ # If no explicit target is specified, then the Pods target will be linked
319
+ # with the first target in your project. So if you only have one target
320
+ # you do not need to specify the target to link with.
321
+ #
322
+ # @param [String, Array<String>] targets
323
+ # the target or the targets to link with.
324
+ #
325
+ # @example Link with an user project target
326
+ #
327
+ # link_with 'MyApp'
328
+ #
329
+ # @example Link with a more user project targets
330
+ #
331
+ # link_with ['MyApp', 'MyOtherApp']
332
+ #
333
+ # @return [void]
334
+ #
335
+ def link_with(targets)
336
+ current_target_definition.link_with = targets
337
+ end
338
+
339
+ # Inhibits **all** the warnings from the CocoaPods libraries.
340
+ #
341
+ # ------
342
+ #
343
+ # This attribute is inherited by child target definitions.
344
+ #
345
+ def inhibit_all_warnings!
346
+ current_target_definition.inhibit_all_warnings = true
347
+ end
348
+
349
+ #-----------------------------------------------------------------------#
350
+
351
+ # @!group Workspace
352
+ #
353
+ # This group list the options to configure workspace and to set global
354
+ # settings.
355
+
356
+ #-----------------------------------------------------------------------#
357
+
358
+ # Specifies the Xcode workspace that should contain all the projects.
359
+ #
360
+ # -----
361
+ #
362
+ # If no explicit Xcode workspace is specified and only **one** project
363
+ # exists in the same directory as the Podfile, then the name of that
364
+ # project is used as the workspace’s name.
365
+ #
366
+ # @param [String] path
367
+ # path of the workspace.
368
+ #
369
+ # @example Specifying a workspace
370
+ #
371
+ # workspace 'MyWorkspace'
372
+ #
373
+ # @return [void]
374
+ #
375
+ def workspace(path)
376
+ set_hash_value('workspace', path.to_s)
377
+ end
378
+
379
+ # Specifies that a BridgeSupport metadata document should be generated
380
+ # from the headers of all installed Pods.
381
+ #
382
+ # -----
383
+ #
384
+ # This is for scripting languages such as [MacRuby](http://macruby.org),
385
+ # [Nu](http://programming.nu/index), and
386
+ # [JSCocoa](http://inexdo.com/JSCocoa), which use it to bridge types,
387
+ # functions, etc.
388
+ #
389
+ # @return [void]
390
+ #
391
+ def generate_bridge_support!
392
+ set_hash_value('generate_bridge_support', true)
393
+ end
394
+
395
+ # Specifies that the -fobjc-arc flag should be added to the
396
+ # `OTHER_LD_FLAGS`.
397
+ #
398
+ # -----
399
+ #
400
+ # This is used as a workaround for a compiler bug with non-ARC projects
401
+ # (see #142). This was originally done automatically but libtool as of
402
+ # Xcode 4.3.2 no longer seems to support the `-fobjc-arc` flag. Therefore
403
+ # it now has to be enabled explicitly using this method.
404
+ #
405
+ # Support for this method might be dropped in CocoaPods `1.0`.
406
+ #
407
+ # @return [void]
408
+ #
409
+ def set_arc_compatibility_flag!
410
+ set_hash_value('set_arc_compatibility_flag', true)
411
+ end
412
+
413
+ #-----------------------------------------------------------------------#
414
+
415
+ # @!group Hooks
416
+ # The Podfile provides hooks that will be called during the
417
+ # installation process.
418
+ #
419
+ # Hooks are __global__ and not stored per target definition.
420
+
421
+ #-----------------------------------------------------------------------#
422
+
423
+ # This hook allows you to make any changes to the Pods after they have
424
+ # been downloaded but before they are installed.
425
+ #
426
+ # @example Defining a pre install hook in a Podfile.
427
+ #
428
+ # pre_install do |installer|
429
+ # # Do something fancy!
430
+ # end
431
+ #
432
+ #
433
+ def pre_install(&block)
434
+ @pre_install_callback = block
435
+ end
436
+
437
+ # This hook allows you to make any last changes to the generated Xcode
438
+ # project before it is written to disk, or any other tasks you might want
439
+ # to perform.
440
+ #
441
+ # @example Customizing the `OTHER_LDFLAGS` of all targets
442
+ #
443
+ # post_install do |installer|
444
+ # installer.project.targets.each do |target|
445
+ # target.build_configurations.each do |config|
446
+ # config.build_settings['GCC_ENABLE_OBJC_GC'] = 'supported'
447
+ # end
448
+ # end
449
+ # end
450
+ #
451
+ # @return [void]
452
+ #
453
+ def post_install(&block)
454
+ @post_install_callback = block
455
+ end
456
+ end
457
+ end
458
+ end
459
+