cocoapods-core 0.39.0 → 1.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8f9473c0dbe12681c534fac5fa372d3b8997df7
4
- data.tar.gz: 2b53fe1b21668fc6528b9458a6b0ed0be4ea21af
3
+ metadata.gz: e18c7dc1ff175a43cf2b37bc3bebf90248145ec5
4
+ data.tar.gz: 0bef178f77551fbf32d34d06a0de11f7cc3776d4
5
5
  SHA512:
6
- metadata.gz: 1d239f82e3c5ff14fbbf88b7d77131163581da7048ea0cdacd1063ea0799db8f6afaee8e9ecaca38c7d2a4c8979eba483338cb9f650ff257f806b3de9c2d1337
7
- data.tar.gz: 78109de42ccbd79638687ffa50550a8f064bfc59d3a6880a59acc0db5d48b5db90f190edaf5be118b583d4d050718f0030286fdbf9265249ae6dee08d1265b51
6
+ metadata.gz: 4339a0143abdc6bc7ecea329512f2933c5a52d33b2cfb378f9171c650857ab0f1146b84106c1974153f491111e78a8a8bfb9fe8a448f4cdafc29dde1ee4e6dbb
7
+ data.tar.gz: 93e5dc9d9c650e0b0e540ee3aaab823ecdc327423841df5a435c926e90d803b2c23048f7fc100711a92cfeba7cc5c89f97ab044abf74930404350bd6e802b41e
@@ -19,12 +19,10 @@ module Pod
19
19
  #
20
20
  attr_accessor :external_source
21
21
 
22
- # @return [Bool] whether the dependency should use the podspec with the
23
- # highest know version but force the downloader to checkout the
24
- # `head` of the source repository.
25
- #
26
- attr_accessor :head
27
- alias_method :head?, :head
22
+ # @return [String] The source URL of the podspec repo to use to resolve
23
+ # this dependency. If not set then the standard source list
24
+ # should be used to resolve the dependency.
25
+ attr_accessor :podspec_repo
28
26
 
29
27
  # @overload initialize(name, requirements)
30
28
  #
@@ -55,6 +53,22 @@ module Pod
55
53
  # Dependency.new('libPusher', {:path => 'path/to/folder'})
56
54
  # Dependency.new('libPusher', {:podspec => 'example.com/libPusher.podspec'})
57
55
  #
56
+ # @overload initialize(name, requirements, podspec_repo)
57
+ #
58
+ # @param [String] name
59
+ # the name of the Pod.
60
+ #
61
+ # @param [Array, Version, String, Requirement] requirements
62
+ # an array specifying the version requirements of the
63
+ # dependency.
64
+ #
65
+ # @param [Hash] podspec_repo
66
+ # The URL of the specific podspec repo to resolve this dependency from.
67
+ #
68
+ # @example Initialization with a specific podspec repo
69
+ #
70
+ # Dependency.new('Artsy+UILabels', '~> 1.0', :source => 'https://github.com/Artsy/Specs.git')
71
+ #
58
72
  # @overload initialize(name, is_head)
59
73
  #
60
74
  # @param [String] name
@@ -63,26 +77,36 @@ module Pod
63
77
  # @param [Symbol] is_head
64
78
  # a symbol that can be `:head` or nil.
65
79
  #
80
+ # @todo Remove `:head` code once everyone has migrated past CocoaPods 1.0.
81
+ #
66
82
  # @example Initialization with the head option
67
83
  #
68
84
  # Dependency.new('RestKit', :head)
69
85
  #
70
86
  def initialize(name = nil, *requirements)
71
87
  if requirements.last.is_a?(Hash)
72
- external_source = requirements.pop.select { |_, v| !v.nil? }
73
- @external_source = external_source unless external_source.empty?
74
- unless requirements.empty?
75
- raise Informative, 'A dependency with an external source may not ' \
76
- "specify version requirements (#{name})."
88
+ additional_params = requirements.pop.select { |_, v| !v.nil? }
89
+ additional_params = nil if additional_params.empty?
90
+
91
+ if additional_params && @podspec_repo = additional_params[:source]
92
+ # This dependency specifies the exact source podspec repo to use.
93
+ additional_params.delete(:source)
94
+ unless additional_params.empty?
95
+ raise Informative, 'A dependency with a specified podspec repo may ' \
96
+ "not include other source parameters (#{name})."
97
+ end
98
+ else
99
+ @external_source = additional_params
100
+ unless requirements.empty?
101
+ raise Informative, 'A dependency with an external source may not ' \
102
+ "specify version requirements (#{name})."
103
+ end
77
104
  end
78
105
 
79
106
  elsif requirements.last == :head
80
- @head = true
81
- requirements.pop
82
- unless requirements.empty?
83
- raise Informative, 'A `:head` dependency may not specify version ' \
84
- "requirements (#{name})."
85
- end
107
+ raise Informative, '`:head` dependencies have been removed. Please use ' \
108
+ "normal external source dependencies (`:git => 'GIT_REPO_URL'`) " \
109
+ "instead of `:head` for `#{name}`."
86
110
  end
87
111
 
88
112
  if requirements.length == 1 && requirements.first.is_a?(Requirement)
@@ -127,7 +151,7 @@ module Pod
127
151
  #
128
152
  def local?
129
153
  if external_source
130
- external_source[:path] || external_source[:local]
154
+ external_source[:path]
131
155
  end
132
156
  end
133
157
 
@@ -177,7 +201,6 @@ module Pod
177
201
  #
178
202
  def compatible?(other)
179
203
  return false unless name == other.name
180
- return false unless head? == other.head?
181
204
  return false unless external_source == other.external_source
182
205
 
183
206
  other.requirement.requirements.all? do |_operator, version|
@@ -193,7 +216,6 @@ module Pod
193
216
  self.class == other.class &&
194
217
  name == other.name &&
195
218
  requirement == other.requirement &&
196
- head? == other.head? &&
197
219
  external_source == other.external_source
198
220
  end
199
221
  alias_method :eql?, :==
@@ -217,11 +239,11 @@ module Pod
217
239
  # @param [Dependency] other
218
240
  # the other dependency to merge with.
219
241
  #
220
- # @note If one of the decencies specifies an external source or is head,
242
+ # @note If one of the dependencies specifies an external source or is head,
221
243
  # the resulting dependency preserves this attributes.
222
244
  #
223
- # @return [Dependency] a dependency (not necessary a new instance) that
224
- # includes also the version requirements of the given one.
245
+ # @return [Dependency] a dependency (not necessarily a new instance) that
246
+ # also includes the version requirements of the given one.
225
247
  #
226
248
  def merge(other)
227
249
  unless name == other.name
@@ -239,7 +261,6 @@ module Pod
239
261
  dep = self.class.new(name, self_req.as_list.concat(other_req.as_list))
240
262
  end
241
263
 
242
- dep.head = head? || other.head?
243
264
  if external_source || other.external_source
244
265
  self_external_source = external_source || {}
245
266
  other_external_source = other.external_source || {}
@@ -290,7 +311,6 @@ module Pod
290
311
  # "libPusher (= 1.0)"
291
312
  # "libPusher (~> 1.0.1)"
292
313
  # "libPusher (> 1.0, < 2.0)"
293
- # "libPusher (HEAD)"
294
314
  # "libPusher (from `www.example.com')"
295
315
  # "libPusher (defined in Podfile)"
296
316
  # "RestKit/JSON"
@@ -301,8 +321,6 @@ module Pod
301
321
  version = ''
302
322
  if external?
303
323
  version << external_source_description(external_source)
304
- elsif head?
305
- version << 'HEAD'
306
324
  elsif requirement != Requirement.default
307
325
  version << requirement.to_s
308
326
  end
@@ -332,8 +350,6 @@ module Pod
332
350
  case version
333
351
  when nil, /from `(.*)(`|')/
334
352
  Dependency.new(name)
335
- when /HEAD/
336
- Dependency.new(name, :head)
337
353
  else
338
354
  version_requirements = version.split(',') if version
339
355
  Dependency.new(name, version_requirements)
@@ -344,7 +360,7 @@ module Pod
344
360
  #
345
361
  def inspect
346
362
  "<#{self.class} name=#{name} requirements=#{requirement} " \
347
- "external_source=#{external_source || 'nil'}>"
363
+ "source=#{podspec_repo || 'nil'} external_source=#{external_source || 'nil'}>"
348
364
  end
349
365
 
350
366
  #--------------------------------------#
@@ -377,8 +393,6 @@ module Pod
377
393
  desc = "`#{source[:podspec]}`"
378
394
  elsif source.key?(:path)
379
395
  desc = "`#{source[:path]}`"
380
- elsif source.key?(:local)
381
- desc = "`#{source[:local]}`"
382
396
  else
383
397
  desc = "`#{source}`"
384
398
  end
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  # The version of the cocoapods-core.
3
3
  #
4
- CORE_VERSION = '0.39.0' unless defined? Pod::CORE_VERSION
4
+ CORE_VERSION = '1.0.0.beta.1'.freeze unless defined? Pod::CORE_VERSION
5
5
  end
@@ -239,7 +239,7 @@ module Pod
239
239
  # - added: Pods that weren't present in the Podfile.
240
240
  # - changed: Pods that were present in the Podfile but changed:
241
241
  # - Pods whose version is not compatible anymore with Podfile,
242
- # - Pods that changed their head or external options.
242
+ # - Pods that changed their external options.
243
243
  # - removed: Pods that were removed form the Podfile.
244
244
  # - unchanged: Pods that are still compatible with Podfile.
245
245
  #
@@ -316,6 +316,7 @@ module Pod
316
316
  # 'EXTERNAL SOURCES' => { "JSONKit" => { :podspec => path/JSONKit.podspec } },
317
317
  # 'SPEC CHECKSUMS' => { "BananaLib" => "439d9f683377ecf4a27de43e8cf3bce6be4df97b",
318
318
  # "JSONKit", "92ae5f71b77c8dec0cd8d0744adab79d38560949" },
319
+ # 'PODFILE CHECKSUM' => "439d9f683377ecf4a27de43e8cf3bce6be4df97b",
319
320
  # 'COCOAPODS' => "0.17.0"
320
321
  # }
321
322
  #
@@ -323,11 +324,24 @@ module Pod
323
324
  def to_hash
324
325
  hash = {}
325
326
  internal_data.each do |key, value|
326
- hash[key] = value unless value.empty?
327
+ hash[key] = value unless value.nil? || value.empty?
327
328
  end
328
329
  hash
329
330
  end
330
331
 
332
+ # @return [Array<String>] The order in which the hash keys should appear in
333
+ # a serialized Lockfile.
334
+ #
335
+ HASH_KEY_ORDER = [
336
+ 'PODS',
337
+ 'DEPENDENCIES',
338
+ 'EXTERNAL SOURCES',
339
+ 'CHECKOUT OPTIONS',
340
+ 'SPEC CHECKSUMS',
341
+ 'PODFILE CHECKSUM',
342
+ 'COCOAPODS',
343
+ ].map(&:freeze).freeze
344
+
331
345
  # @return [String] the YAML representation of the Lockfile, used for
332
346
  # serialization.
333
347
  #
@@ -336,15 +350,7 @@ module Pod
336
350
  # @note The YAML string is prettified.
337
351
  #
338
352
  def to_yaml
339
- keys_hint = [
340
- 'PODS',
341
- 'DEPENDENCIES',
342
- 'EXTERNAL SOURCES',
343
- 'CHECKOUT OPTIONS',
344
- 'SPEC CHECKSUMS',
345
- 'COCOAPODS',
346
- ]
347
- YAMLHelper.convert_hash(to_hash, keys_hint, "\n\n")
353
+ YAMLHelper.convert_hash(to_hash, HASH_KEY_ORDER, "\n\n")
348
354
  end
349
355
 
350
356
  #-------------------------------------------------------------------------#
@@ -374,6 +380,7 @@ module Pod
374
380
  'EXTERNAL SOURCES' => generate_external_sources_data(podfile),
375
381
  'CHECKOUT OPTIONS' => checkout_options,
376
382
  'SPEC CHECKSUMS' => generate_checksums(specs),
383
+ 'PODFILE CHECKSUM' => podfile.checksum,
377
384
  'COCOAPODS' => CORE_VERSION,
378
385
  }
379
386
  Lockfile.new(hash)
@@ -440,10 +447,6 @@ module Pod
440
447
  # the values store the external source hashes of each
441
448
  # dependency.
442
449
  #
443
- # @todo The downloader should generate an external source hash that
444
- # should be store for dependencies in head mode and for those
445
- # with external source.
446
- #
447
450
  def generate_external_sources_data(podfile)
448
451
  deps = podfile.dependencies.select(&:external?)
449
452
  deps = deps.sort { |d, other| d.name <=> other.name }
@@ -83,6 +83,14 @@ module Pod
83
83
  new :watchos
84
84
  end
85
85
 
86
+ # Convenience method to get all available platforms.
87
+ #
88
+ # @return [Array<Platform>] list of platforms.
89
+ #
90
+ def self.all
91
+ [ios, osx, watchos, tvos]
92
+ end
93
+
86
94
  # Checks if a platform is equivalent to another one or to a symbol
87
95
  # representation.
88
96
  #
@@ -45,7 +45,7 @@ module Pod
45
45
  @internal_hash = internal_hash
46
46
  if block
47
47
  default_target_def = TargetDefinition.new('Pods', self)
48
- default_target_def.link_with_first_target = true
48
+ default_target_def.abstract = true
49
49
  @root_target_definitions = [default_target_def]
50
50
  @current_target_definition = default_target_def
51
51
  instance_eval(&block)
@@ -74,6 +74,8 @@ module Pod
74
74
  Hash[target_definition_list.map { |td| [td.name, td] }]
75
75
  end
76
76
 
77
+ # @return [Array<TargetDefinition>] all target definitions in the podfile.
78
+ #
77
79
  def target_definition_list
78
80
  root_target_definitions.map { |td| [td, td.recursive_children] }.flatten
79
81
  end
@@ -134,6 +136,14 @@ module Pod
134
136
  get_hash_value('set_arc_compatibility_flag')
135
137
  end
136
138
 
139
+ # @return [(String,Hash)] the installation strategy and installation options
140
+ # to be used during installation.
141
+ #
142
+ def installation_method
143
+ get_hash_value('installation_method', 'name' => 'cocoapods', 'options' => {}).
144
+ values_at('name', 'options')
145
+ end
146
+
137
147
  #-------------------------------------------------------------------------#
138
148
 
139
149
  public
@@ -183,6 +193,7 @@ module Pod
183
193
  # @return [Array] The keys used by the hash representation of the Podfile.
184
194
  #
185
195
  HASH_KEYS = %w(
196
+ installation_method
186
197
  workspace
187
198
  sources
188
199
  plugins
@@ -348,7 +359,7 @@ module Pod
348
359
  # @param [Object] value
349
360
  # The value to store.
350
361
  #
351
- # @raise If the key is not recognized.
362
+ # @raise [StandardError] If the key is not recognized.
352
363
  #
353
364
  # @return [void]
354
365
  #
@@ -364,15 +375,19 @@ module Pod
364
375
  # @param [String] key
365
376
  # The key for which the value is needed.
366
377
  #
367
- # @raise If the key is not recognized.
378
+ # @param default
379
+ # The default value to return if the internal hash has no entry for
380
+ # the given `key`.
381
+ #
382
+ # @raise [StandardError] If the key is not recognized.
368
383
  #
369
384
  # @return [Object] The value for the key.
370
385
  #
371
- def get_hash_value(key)
386
+ def get_hash_value(key, default = nil)
372
387
  unless HASH_KEYS.include?(key)
373
388
  raise StandardError, "Unsupported hash key `#{key}`"
374
389
  end
375
- internal_hash[key]
390
+ internal_hash.fetch(key, default)
376
391
  end
377
392
 
378
393
  # @return [TargetDefinition] The current target definition to which the DSL
@@ -380,19 +395,6 @@ module Pod
380
395
  #
381
396
  attr_accessor :current_target_definition
382
397
 
383
- public
384
-
385
- # @!group Deprecations
386
- #-------------------------------------------------------------------------#
387
-
388
- # @deprecated Deprecated in favour of the more succinct {#pod}. Remove for
389
- # CocoaPods 1.0.
390
- #
391
- def dependency(name = nil, *requirements, &block)
392
- CoreUI.warn "[DEPRECATED] `dependency' is deprecated (use `pod')"
393
- pod(name, *requirements, &block)
394
- end
395
-
396
398
  #-------------------------------------------------------------------------#
397
399
  end
398
400
  end
@@ -5,9 +5,7 @@ module Pod
5
5
  # CocoaPods/cocoapods.github.com.
6
6
 
7
7
  # The Podfile is a specification that describes the dependencies of the
8
- # targets of one or more Xcode projects. The Podfile always creates an
9
- # implicit target, named `default`, which links to the first target of the
10
- # user project.
8
+ # targets of one or more Xcode projects.
11
9
  #
12
10
  # A Podfile can be very simple:
13
11
  #
@@ -15,19 +13,19 @@ module Pod
15
13
  #
16
14
  # An example of a more complex Podfile can be:
17
15
  #
18
- # source 'https://github.com/CocoaPods/Specs.git'
19
- #
20
- # platform :ios, '6.0'
16
+ # platform :ios, '9.0'
21
17
  # inhibit_all_warnings!
22
18
  #
23
- # xcodeproj 'MyProject'
24
- #
25
- # pod 'ObjectiveSugar', '~> 0.5'
19
+ # target "MyApp" do
20
+ # pod 'ObjectiveSugar', '~> 0.5'
26
21
  #
27
- # target :test do
28
- # pod 'OCMock', '~> 2.0.1'
22
+ # target "MyAppTests" do
23
+ # inherit! :search_paths
24
+ # pod 'OCMock', '~> 2.0.1'
25
+ # end
29
26
  # end
30
27
  #
28
+ #
31
29
  # post_install do |installer|
32
30
  # installer.pods_project.targets.each do |target|
33
31
  # puts "#{target.name}"
@@ -40,7 +38,7 @@ module Pod
40
38
  #
41
39
  # * `pod` is the way to declare a specific dependency.
42
40
  # * `podspec` provides an easy API for the creation of podspecs.
43
- # * `target` allows you to scope your dependencies to specific
41
+ # * `target` is how you scope your dependencies to specific
44
42
  # targets in your Xcode projects.
45
43
 
46
44
  #-----------------------------------------------------------------------#
@@ -82,13 +80,6 @@ module Pod
82
80
  # * [Semantic Versioning](http://semver.org)
83
81
  # * [RubyGems Versioning Policies](http://docs.rubygems.org/read/chapter/7)
84
82
  #
85
- # Finally, instead of a version, you can specify the `:head` flag. This
86
- # will use the spec of the newest available version in your spec repo(s),
87
- # but force the download of the ‘bleeding edge’ version (HEAD). Use this
88
- # with caution, as the spec _might_ not be compatible anymore.
89
- #
90
- # pod 'Objection', :head
91
- #
92
83
  # ------
93
84
  #
94
85
  # ### Build configurations
@@ -193,16 +184,9 @@ module Pod
193
184
  # @note This method allow a nil name and the raises to be more
194
185
  # informative.
195
186
  #
196
- # @note Support for inline podspecs has been deprecated.
197
- #
198
187
  # @return [void]
199
188
  #
200
- def pod(name = nil, *requirements, &block)
201
- if block
202
- raise StandardError, 'Inline specifications are deprecated. ' \
203
- 'Please store the specification in a `podspec` file.'
204
- end
205
-
189
+ def pod(name = nil, *requirements)
206
190
  unless name
207
191
  raise StandardError, 'A dependency requires a name.'
208
192
  end
@@ -210,9 +194,9 @@ module Pod
210
194
  current_target_definition.store_pod(name, *requirements)
211
195
  end
212
196
 
213
- # Use the dependencies of a Pod defined in the given podspec file. If no
214
- # arguments are passed the first podspec in the root of the Podfile is
215
- # used. It is intended to be used by the project of a library. Note:
197
+ # Use just the dependencies of a Pod defined in the given podspec file.
198
+ # If no arguments are passed the first podspec in the root of the Podfile
199
+ # is used. It is intended to be used by the project of a library. Note:
216
200
  # this does not include the sources derived from the podspec just the
217
201
  # CocoaPods infrastructure.
218
202
  #
@@ -235,7 +219,7 @@ module Pod
235
219
  # @option options [String] :name
236
220
  # the name of the podspec
237
221
  #
238
- # @note This method uses the dependencies declared by the for the
222
+ # @note This method uses the dependencies declared for the
239
223
  # platform of the target definition.
240
224
  #
241
225
  #
@@ -248,57 +232,173 @@ module Pod
248
232
  current_target_definition.store_podspec(options)
249
233
  end
250
234
 
251
- # Defines a new static library target and scopes dependencies defined
252
- # from the given block. The target will by default include the
253
- # dependencies defined outside of the block, unless the `:exclusive =>
254
- # true` option is
255
- # given.
256
- #
257
- # ---
258
- #
259
- # The Podfile creates a global target named `:default` which produces the
260
- # `libPods.a` file. This target is linked with the first target of user
261
- # project if not value is specified for the `link_with` attribute.
235
+ # Defines a CocoaPods target and scopes dependencies defined
236
+ # within the given block. A target should correspond to an Xcode target.
237
+ # By default the target includes the dependencies defined outside of
238
+ # the block, unless instructed not to `inherit!` them.
262
239
  #
263
240
  # @param [Symbol, String] name
264
- # the name of the target definition.
265
- #
266
- # @option options [Bool] :exclusive
267
- # whether the target should inherit the dependencies of its
268
- # parent. by default targets are inclusive.
241
+ # the name of the target.
269
242
  #
270
243
  # @example Defining a target
271
244
  #
272
- # target :ZipApp do
245
+ # target "ZipApp" do
273
246
  # pod 'SSZipArchive'
274
247
  # end
275
248
  #
276
- # @example Defining an exclusive target
249
+ # @example Defining a test target which can access SSZipArchive via Pods
250
+ # for it's parent target.
277
251
  #
278
- # target :ZipApp do
252
+ # target "ZipApp" do
279
253
  # pod 'SSZipArchive'
280
- # target :test, :exclusive => true do
281
- # pod 'JSONKit'
254
+ #
255
+ # target "ZipAppTests" do
256
+ # inherit! :search_paths
257
+ # pod 'Nimble'
258
+ # end
259
+ # end
260
+ #
261
+ # @example Defining a target applies Pods to multiple targets via its
262
+ # parent target
263
+ #
264
+ # target "ShowsApp" do
265
+ # pod 'ShowsKit'
266
+ #
267
+ # # Has it's own copy of ShowsKit + ShowTVAuth
268
+ # target "ShowsTV" do
269
+ # pod "ShowTVAuth"
270
+ # end
271
+ #
272
+ # # Has it's own copy of Specta + Expecta
273
+ # # and has access to ShowsKit via the app
274
+ # # that the test target is bundled into
275
+ #
276
+ # target "ShowsTests" do
277
+ # inherit! :search_paths
278
+ # pod 'Specta'
279
+ # pod 'Expecta'
282
280
  # end
283
281
  # end
284
282
  #
285
283
  # @return [void]
286
284
  #
287
- def target(name, options = {})
288
- if options && !options.keys.all? { |key| [:exclusive].include?(key) }
285
+ def target(name, options = nil)
286
+ if options
289
287
  raise Informative, "Unsupported options `#{options}` for " \
290
- "target `#{name}`"
288
+ "target `#{name}`."
291
289
  end
292
290
 
293
291
  parent = current_target_definition
294
292
  definition = TargetDefinition.new(name, parent)
295
- definition.exclusive = true if options[:exclusive]
296
293
  self.current_target_definition = definition
297
- yield
294
+ yield if block_given?
298
295
  ensure
299
296
  self.current_target_definition = parent
300
297
  end
301
298
 
299
+ # Defines a new abstract target that can be used for convenient
300
+ # target dependency inheritance.
301
+ #
302
+ # @param [Symbol, String] name
303
+ # the name of the target.
304
+ #
305
+ # @example Defining an abstract target
306
+ #
307
+ # abstract_target 'Networking' do
308
+ # pod 'AlamoFire'
309
+ #
310
+ # target 'Networking App 1'
311
+ # target 'Networking App 2'
312
+ # end
313
+ #
314
+ # @example Defining an abstract_target wrapping Pods to multiple targets
315
+ #
316
+ # # There are no targets called "Shows" in any Xcode projects
317
+ # abstract_target "Shows" do
318
+ # pod 'ShowsKit'
319
+ #
320
+ # # Has it's own copy of ShowsKit + ShowWebAuth
321
+ # target "ShowsiOS" do
322
+ # pod "ShowWebAuth"
323
+ # end
324
+ #
325
+ # # Has it's own copy of ShowsKit + ShowTVAuth
326
+ # target "ShowsTV" do
327
+ # pod "ShowTVAuth"
328
+ # end
329
+ #
330
+ # # Has it's own copy of Specta + Expecta
331
+ # # and has access to ShowsKit via the app
332
+ # # that the test target is bundled into
333
+ #
334
+ # target "ShowsTests" do
335
+ # inherit! :search_paths
336
+ # pod 'Specta'
337
+ # pod 'Expecta'
338
+ # end
339
+ # end
340
+ #
341
+ # @return [void]
342
+ #
343
+ def abstract_target(name)
344
+ target(name) do
345
+ abstract!
346
+ yield if block_given?
347
+ end
348
+ end
349
+
350
+ # Denotes that the current target is abstract, and thus will not directly
351
+ # link against an Xcode target.
352
+ #
353
+ # @return [void]
354
+ #
355
+ def abstract!(abstract = true)
356
+ current_target_definition.abstract = abstract
357
+ end
358
+
359
+ # Sets the inheritance mode for the current target.
360
+ #
361
+ # @param [:complete, :none, :search_paths] the inheritance mode to set.
362
+ #
363
+ # @example Inheriting only search paths
364
+ #
365
+ # target 'App' do
366
+ # target 'AppTests' do
367
+ # inherit! :search_paths
368
+ # end
369
+ # end
370
+ #
371
+ # @return [void]
372
+ #
373
+ def inherit!(inheritance)
374
+ current_target_definition.inheritance = inheritance
375
+ end
376
+
377
+ # Specifies the installation method to be used when CocoaPods installs
378
+ # this Podfile.
379
+ #
380
+ # @param [String] installation_method
381
+ # the name of the installation strategy.
382
+ #
383
+ # @param [Hash] options
384
+ # the installation options.
385
+ #
386
+ # @example Specifying custom CocoaPods installation options
387
+ #
388
+ # install! 'cocoapods',
389
+ # :deterministic_uuids => false,
390
+ # :integrate_targets => false
391
+ #
392
+ # @return [void]
393
+ #
394
+ def install!(installation_method, options = {})
395
+ unless current_target_definition.root?
396
+ raise Informative, 'The installation method can only be set at the root level of the Podfile.'
397
+ end
398
+
399
+ set_hash_value('installation_method', 'name' => installation_method, 'options' => options)
400
+ end
401
+
302
402
  #-----------------------------------------------------------------------#
303
403
 
304
404
  # @!group Target configuration
@@ -345,10 +445,9 @@ module Pod
345
445
  #
346
446
  # -----
347
447
  #
348
- # If no explicit project is specified, it will use the Xcode project of
349
- # the parent target. If none of the target definitions specify an
350
- # explicit project and there is only **one** project in the same
351
- # directory as the Podfile then that project will be used.
448
+ # If none of the target definitions specify an explicit project
449
+ # and there is only **one** project in the same directory as the Podfile
450
+ # then that project will be used.
352
451
  #
353
452
  # It is possible also to specify whether the build settings of your
354
453
  # custom build configurations should be modelled after the release or
@@ -369,20 +468,22 @@ module Pod
369
468
  #
370
469
  # @example Specifying the user project
371
470
  #
372
- # # Look for target to link with in an Xcode project called
373
- # # `MyProject.xcodeproj`.
374
- # xcodeproj 'MyProject'
471
+ # # This Target can be found in a Xcode project called `FastGPS`
472
+ # target "MyGPSApp" do
473
+ # xcodeproj 'FastGPS'
474
+ # ...
475
+ # end
375
476
  #
376
- # target :test do
377
- # # This Pods library links with a target in another project.
378
- # xcodeproj 'TestProject'
477
+ # # Same Podfile, multiple Xcodeprojects
478
+ # target "MyNotesApp" do
479
+ # xcodeproj 'FastNotes'
480
+ # ...
379
481
  # end
380
482
  #
381
483
  # @example Using custom build configurations
382
484
  #
383
485
  # xcodeproj 'TestProject', 'Mac App Store' => :release, 'Test' => :debug
384
486
  #
385
- #
386
487
  # @return [void]
387
488
  #
388
489
  def xcodeproj(path, build_configurations = {})
@@ -390,30 +491,18 @@ module Pod
390
491
  current_target_definition.build_configurations = build_configurations
391
492
  end
392
493
 
393
- # Specifies the target(s) in the user’s project that this Pods library
394
- # should be linked in.
395
- #
396
- # -----
397
- #
398
- # If no explicit target is specified, then the Pods target will be linked
399
- # with the first target in your project. So if you only have one target
400
- # you do not need to specify the target to link with.
401
- #
402
- # @param [String, Array<String>] targets
403
- # the target or the targets to link with.
494
+ # @!visibility private
404
495
  #
405
- # @example Link with a user project target
496
+ # @deprecated linking a single target with multiple Xcode targets is no
497
+ # longer supported. Use an {#abstract_target} and target
498
+ # inheritance instead.
406
499
  #
407
- # link_with 'MyApp'
408
- #
409
- # @example Link with multiple user project targets
410
- #
411
- # link_with 'MyApp', 'MyOtherApp'
412
- #
413
- # @return [void]
500
+ # TODO: This method can be deleted once people have migrated to this 1.0
501
+ # DSL.
414
502
  #
415
- def link_with(*targets)
416
- current_target_definition.link_with = targets.flatten
503
+ def link_with(*)
504
+ raise Informative, 'The specification of `link_with` in the Podfile ' \
505
+ 'is now unsupported, please use target blocks instead.'
417
506
  end
418
507
 
419
508
  # Inhibits **all** the warnings from the CocoaPods libraries.
@@ -589,7 +678,7 @@ module Pod
589
678
  # [`Pod::Installer`](http://rubydoc.info/gems/cocoapods/Pod/Installer/)
590
679
  # as its only argument.
591
680
  #
592
- # @example Defining a pre install hook in a Podfile.
681
+ # @example Defining a pre-install hook in a Podfile.
593
682
  #
594
683
  # pre_install do |installer|
595
684
  # # Do something fancy!