cocoapods-core 1.2.1 → 1.3.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: c1de14c247ae7bcd804ad2a80098c0f7619c6063
4
- data.tar.gz: f9a9501dd9e17b952442b11cddee85bcee0d1d75
3
+ metadata.gz: dd5bbd87ab68623c39c934248891b30a148f27ad
4
+ data.tar.gz: 4cd668a92915fc51452e08a69e5fe5d4f32a3341
5
5
  SHA512:
6
- metadata.gz: 5f685cc69b6259f8bf6a73f8e79fa00763d14782596c642e5ac62306f60f32a5cb6f85bf3e7b085bd86f3e1cb58cc3ac23272f89cfbe959e4317fa983d70965d
7
- data.tar.gz: cce835c31af2dd9064822d99dc9f74dfdb065451ccfb4bcd389b7ff1c588aa3b12a3908ac5a6f11f2e4d966ba8b93b1158bae2132695d465a519ee9d5da82ddb
6
+ metadata.gz: 94c167d862dc5230ad19caf7ac4a2c7c5b50eec997c6d0ce77190abff8866aca95d9a4dc5c045a74c94f35ff25df771a2f23d09b08cf7074d524674c9276d883
7
+ data.tar.gz: 299de42c3b2ed71dd7ce9e8b442fe788b6281c1ea8ac90ed9428d49509bc15163a67095ddd37108f288c9668c7402867a395774c0ae63fce3637108b9bbc2c9b
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  # The version of the cocoapods-core.
3
3
  #
4
- CORE_VERSION = '1.2.1'.freeze unless defined? Pod::CORE_VERSION
4
+ CORE_VERSION = '1.3.0.beta.1'.freeze unless defined? Pod::CORE_VERSION
5
5
  end
@@ -131,7 +131,7 @@ module Pod
131
131
  # @return [Nil] if the given url is not a valid github repo url.
132
132
  #
133
133
  def self.repo_id_from_url(url)
134
- url[%r{github.com/([^/]*/[^/]*)\.*}, 1]
134
+ url[%r{github.com[/:]([^/]*/(?:(?!\.git)[^/])*)\.*}, 1]
135
135
  end
136
136
 
137
137
  # Performs a get request with the given URL.
@@ -1,35 +1,7 @@
1
1
  module Pod
2
2
  class MasterSource < Source
3
- # @!group Updating the source
4
- #-------------------------------------------------------------------------#
5
-
6
- # Updates the local clone of the source repo.
7
- #
8
- # @param [Bool] show_output
9
- #
10
- # @return [Array<String>] changed_spec_paths
11
- # Returns the list of changed spec paths.
12
- #
13
- def update(show_output)
14
- if requires_update?
15
- super
16
- else
17
- []
18
- end
19
- end
20
-
21
- private
22
-
23
- # Returns whether a source requires updating.
24
- #
25
- # @param [Source] source
26
- # The source to check.
27
- #
28
- # @return [Bool] Whether the given source should be updated.
29
- #
30
- def requires_update?
31
- commit_hash = git_commit_hash
32
- GitHub.modified_since_commit('CocoaPods/Specs', commit_hash)
33
- end
3
+ # For now, the MasterSource behaves exactly the same as any other Source.
4
+ # In the future we may apply separate logic to the MasterSource that doesn't
5
+ # depend on the file system.
34
6
  end
35
7
  end
@@ -67,6 +67,14 @@ module Pod
67
67
  new :osx
68
68
  end
69
69
 
70
+ # Convenience method to initialize a macOS platform.
71
+ #
72
+ # @return [Platform] a macOS platform.
73
+ #
74
+ def self.macos
75
+ osx
76
+ end
77
+
70
78
  # Convenience method to initialize a tvOS platform.
71
79
  #
72
80
  # @return [Platform] a tvOS platform.
@@ -224,7 +232,7 @@ module Pod
224
232
  def self.string_name(symbolic_name)
225
233
  case symbolic_name
226
234
  when :ios then 'iOS'
227
- when :osx then 'OS X'
235
+ when :osx then 'macOS'
228
236
  when :watchos then 'watchOS'
229
237
  when :tvos then 'tvOS'
230
238
  else symbolic_name.to_s
@@ -483,6 +483,7 @@ module Pod
483
483
  # @return [void]
484
484
  #
485
485
  def set_platform(name, target = nil)
486
+ name = :osx if name == :macos
486
487
  unless [:ios, :osx, :tvos, :watchos].include?(name)
487
488
  raise StandardError, "Unsupported platform `#{name}`. Platform " \
488
489
  'must be `:ios`, `:osx`, `:tvos`, or `:watchos`.'
@@ -330,6 +330,7 @@ module Pod
330
330
  # Returns the list of changed spec paths.
331
331
  #
332
332
  def update(show_output)
333
+ return [] if unchanged_github_repo?
333
334
  prev_commit_hash = git_commit_hash
334
335
  update_git_repo(show_output)
335
336
  refresh_metadata
@@ -437,6 +438,12 @@ module Pod
437
438
  (`#{command}` || '').strip
438
439
  end
439
440
 
441
+ def unchanged_github_repo?
442
+ url = repo_git(%w(config --get remote.origin.url))
443
+ return unless url =~ /github.com/
444
+ !GitHub.modified_since_commit(url, git_commit_hash)
445
+ end
446
+
440
447
  #-------------------------------------------------------------------------#
441
448
  end
442
449
  end
@@ -34,13 +34,18 @@ module Pod
34
34
  # @param [String] name
35
35
  # the name of the specification.
36
36
  #
37
- def initialize(parent = nil, name = nil)
37
+ # @param [Bool] test_specification
38
+ # Whether the specification is a test specification
39
+ #
40
+ def initialize(parent = nil, name = nil, test_specification = false)
38
41
  @attributes_hash = {}
39
42
  @subspecs = []
40
43
  @consumers = {}
41
44
  @parent = parent
42
45
  @hash_value = nil
46
+ @test_specification = test_specification
43
47
  attributes_hash['name'] = name
48
+ attributes_hash['test_type'] = :unit if test_specification
44
49
 
45
50
  yield self if block_given?
46
51
  end
@@ -54,6 +59,11 @@ module Pod
54
59
  #
55
60
  attr_accessor :subspecs
56
61
 
62
+ # @return [Bool] If this specification is a test specification.
63
+ #
64
+ attr_accessor :test_specification
65
+ alias_method :test_specification?, :test_specification
66
+
57
67
  # Checks if a specification is equal to the given one according its name
58
68
  # and to its version.
59
69
  #
@@ -203,7 +213,20 @@ module Pod
203
213
 
204
214
  # @!group Dependencies & Subspecs
205
215
 
206
- # @return [Array<Specifications>] the recursive list of all the subspecs of
216
+ # @return [Symbol] the test type supported if this is a test specification.
217
+ #
218
+ def test_type
219
+ attributes_hash['test_type'].to_sym
220
+ end
221
+
222
+ # @return [Array<Specification>] the list of all the test subspecs of
223
+ # a specification.
224
+ #
225
+ def test_specs
226
+ subspecs.select(&:test_specification?)
227
+ end
228
+
229
+ # @return [Array<Specification>] the recursive list of all the subspecs of
207
230
  # a specification.
208
231
  #
209
232
  def recursive_subspecs
@@ -232,7 +255,7 @@ module Pod
232
255
  #
233
256
  # @return [Specification] the subspec with the given name or self.
234
257
  #
235
- def subspec_by_name(relative_name, raise_if_missing = true)
258
+ def subspec_by_name(relative_name, raise_if_missing = true, include_test_specifications = false)
236
259
  if relative_name.nil? || relative_name == base_name
237
260
  self
238
261
  elsif relative_name.downcase == base_name.downcase
@@ -241,7 +264,7 @@ module Pod
241
264
  else
242
265
  remainder = relative_name[base_name.size + 1..-1]
243
266
  subspec_name = remainder.split('/').shift
244
- subspec = subspecs.find { |s| s.base_name == subspec_name }
267
+ subspec = subspecs.find { |s| s.base_name == subspec_name && (include_test_specifications || !s.test_specification?) }
245
268
  unless subspec
246
269
  if raise_if_missing
247
270
  raise Informative, 'Unable to find a specification named ' \
@@ -250,7 +273,7 @@ module Pod
250
273
  return nil
251
274
  end
252
275
  end
253
- subspec.subspec_by_name(remainder, raise_if_missing)
276
+ subspec.subspec_by_name(remainder, raise_if_missing, include_test_specifications)
254
277
  end
255
278
  end
256
279
 
@@ -274,7 +297,7 @@ module Pod
274
297
  #
275
298
  def subspec_dependencies(platform = nil)
276
299
  specs = if default_subspecs.empty?
277
- subspecs.compact
300
+ subspecs.compact.reject(&:test_specification?)
278
301
  else
279
302
  default_subspecs.map do |subspec_name|
280
303
  root.subspec_by_name("#{name}/#{subspec_name}")
@@ -288,9 +311,8 @@ module Pod
288
311
 
289
312
  # Returns the dependencies on other Pods or subspecs of other Pods.
290
313
  #
291
- # @param [Bool] all_platforms
292
- # whether the dependencies should be returned for all platforms
293
- # instead of the active one.
314
+ # @param [Platform] platform
315
+ # return only dependencies supported on the given platform.
294
316
  #
295
317
  # @note External dependencies are inherited by subspecs
296
318
  #
@@ -571,7 +593,7 @@ module Pod
571
593
  end
572
594
 
573
595
  spec.defined_in_file = path
574
- spec.subspec_by_name(subspec_name)
596
+ spec.subspec_by_name(subspec_name, true)
575
597
  end
576
598
 
577
599
  # Sets the path of the `podspec` file used to load the specification.
@@ -136,6 +136,14 @@ module Pod
136
136
 
137
137
  #-----------------------------------------------------------------------#
138
138
 
139
+ # @!group Test Support
140
+
141
+ # @return [Symbol] the test type supported by this specification.
142
+ #
143
+ spec_attr_accessor :test_type
144
+
145
+ #-----------------------------------------------------------------------#
146
+
139
147
  # @!group File patterns
140
148
 
141
149
  # @return [Array<String>] the source files of the Pod.
@@ -539,6 +539,7 @@ module Pod
539
539
  #
540
540
  def platform=(args)
541
541
  name, deployment_target = args
542
+ name = :osx if name.to_s == 'macos'
542
543
  attributes_hash['platforms'] = if name
543
544
  { name.to_s => deployment_target }
544
545
  else
@@ -1012,8 +1013,10 @@ module Pod
1012
1013
  # ---
1013
1014
  #
1014
1015
  # These are the headers that will be exposed to the user’s project and
1015
- # from which documentation will be generated. If no public headers are
1016
- # specified then **all** the headers in source_files are considered public.
1016
+ # from which documentation will be generated. When the library is built,
1017
+ # these headers will appear in the build directory. If no public headers
1018
+ # are specified then **all** the headers in source_files are considered
1019
+ # public.
1017
1020
  #
1018
1021
  # @example
1019
1022
  #
@@ -1037,7 +1040,13 @@ module Pod
1037
1040
  # These patterns are matched against the public headers (or all the
1038
1041
  # headers if no public headers have been specified) to exclude those
1039
1042
  # headers which should not be exposed to the user project and which
1040
- # should not be used to generate the documentation.
1043
+ # should not be used to generate the documentation. When the library
1044
+ # is built, these headers will appear in the build directory.
1045
+ #
1046
+ # Header files that are not listed as neither public nor private will
1047
+ # be treated as private, but in addition will not appear in the build
1048
+ # directory at all.
1049
+ #
1041
1050
  #
1042
1051
  # @example
1043
1052
  #
@@ -1316,6 +1325,46 @@ module Pod
1316
1325
  subspec
1317
1326
  end
1318
1327
 
1328
+ # The list of the test types currently supported.
1329
+ #
1330
+ SUPPORTED_TEST_TYPES = [:unit].freeze
1331
+
1332
+ # The test type this specification supports. This only applies to test specifications.
1333
+ #
1334
+ # ---
1335
+ #
1336
+ # @example
1337
+ #
1338
+ # test_spec.test_type = :unit
1339
+ #
1340
+ # @param [Symbol] type
1341
+ # The test type to use.
1342
+ attribute :test_type,
1343
+ :types => [Symbol],
1344
+ :multi_platform => false
1345
+
1346
+ # Represents a test specification for the library. Here you can place all
1347
+ # your tests for your podspec along with the test dependencies.
1348
+ #
1349
+ # ---
1350
+ #
1351
+ # @example
1352
+ #
1353
+ # Pod::Spec.new do |spec|
1354
+ # spec.name = 'NSAttributedString+CCLFormat'
1355
+ #
1356
+ # spec.test_spec do |test_spec|
1357
+ # test_spec.source_files = 'NSAttributedString+CCLFormatTests.m'
1358
+ # test_spec.dependency 'Expecta'
1359
+ # end
1360
+ # end
1361
+ #
1362
+ def test_spec(name = 'Tests', &block)
1363
+ subspec = Specification.new(self, name, true, &block)
1364
+ @subspecs << subspec
1365
+ subspec
1366
+ end
1367
+
1319
1368
  #------------------#
1320
1369
 
1321
1370
  # @!method default_subspecs=(subspec_array)
@@ -1390,6 +1439,8 @@ module Pod
1390
1439
  PlatformProxy.new(self, :osx)
1391
1440
  end
1392
1441
 
1442
+ alias macos osx
1443
+
1393
1444
  # Provides support for specifying tvOS attributes.
1394
1445
  #
1395
1446
  # @example
@@ -59,6 +59,7 @@ module Pod
59
59
  attributes_hash = hash.dup
60
60
  subspecs = attributes_hash.delete('subspecs')
61
61
  spec.attributes_hash = attributes_hash
62
+ spec.test_specification = !attributes_hash['test_type'].nil?
62
63
  if subspecs
63
64
  spec.subspecs = subspecs.map do |s_hash|
64
65
  Specification.from_hash(s_hash, spec)
@@ -128,7 +128,7 @@ module Pod
128
128
  run_validation_hooks(attributes, spec)
129
129
  end
130
130
 
131
- # Run validations for multi-platform attributes activating .
131
+ # Run validations for multi-platform attributes activating.
132
132
  #
133
133
  # @return [void]
134
134
  #
@@ -364,6 +364,16 @@ module Pod
364
364
  end
365
365
  end
366
366
 
367
+ def _validate_test_type(t)
368
+ unless consumer.spec.test_specification?
369
+ results.add_error('test_type', 'Test type can only be used for test specifications.')
370
+ return
371
+ end
372
+ supported_test_types = Specification::DSL::SUPPORTED_TEST_TYPES
373
+ results.add_error('test_type', "The test type `#{t}` is not supported. " \
374
+ "Supported test type values are #{supported_test_types}.") unless supported_test_types.include?(t)
375
+ end
376
+
367
377
  # Performs validations related to github sources.
368
378
  #
369
379
  def perform_github_source_checks(s)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-04-11 00:00:00.000000000 Z
12
+ date: 2017-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -20,7 +20,7 @@ dependencies:
20
20
  version: 4.0.2
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '5'
23
+ version: '6'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,7 +30,7 @@ dependencies:
30
30
  version: 4.0.2
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '5'
33
+ version: '6'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: nap
36
36
  requirement: !ruby/object:Gem::Requirement