cocoapods-core 1.5.0 → 1.5.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
  SHA256:
3
- metadata.gz: 27023cacaa567adc10f3c6c07f9fa9f3b60246771e1ac6960db97d3b7524b10e
4
- data.tar.gz: 22d2ddd9b8d6566cd64f3a3827ff670592af8c774e88242d85e3d42e6afc9025
3
+ metadata.gz: 0ad2c3c33b4ea9899853422195b23e20e9b86acfe646575db6f255fbfc1db989
4
+ data.tar.gz: 326792eaebedfcb50b51c2f23770e878e5050cc93f63e2e7fd3dde7cdbf4061c
5
5
  SHA512:
6
- metadata.gz: c048a6eb46799df401205b91a0d8aebf1021735cbc3d2f818d08ca6305232c8689cb6727ad61054ba7fd97bfeb3c5e096bdb4a96fc69e5fc3c0402fc748d5a2b
7
- data.tar.gz: 7140a164772ee9faa275056c866c3a1bfeba18cddc8d17b691df6ccc6c190ab47ff85fadf6b8ecca02560c210e464e9205537c97c8b1085875b893cdafb9b0f0
6
+ metadata.gz: 95ea884f860997afdf5532d3641c6eeb3a4048dfca3ab6b0e7416f5f79332bb61fa8b7c2e8b8c9367ca05c00a99183370af2383c0285b9e751bf338e20e68bb2
7
+ data.tar.gz: 2920b288267a62a81d1cbb73c14129c4d847b3805202e71e70a306bbae86009b31a01dc6d5f82d0da12a2b607b563c306569785f7b7c48b8d51649204854d98d
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  # The version of the cocoapods-core.
3
3
  #
4
- CORE_VERSION = '1.5.0'.freeze unless defined? Pod::CORE_VERSION
4
+ CORE_VERSION = '1.5.1'.freeze unless defined? Pod::CORE_VERSION
5
5
  end
@@ -290,13 +290,23 @@ module Pod
290
290
  result = {}
291
291
  [:added, :changed, :removed, :unchanged].each { |k| result[k] = [] }
292
292
 
293
- installed_deps = dependencies.map do |dep|
294
- dependencies_to_lock_pod_named(dep.root_name)
295
- end.flatten
296
- all_dep_names = (dependencies + podfile.dependencies).map(&:name).uniq
293
+ installed_deps = {}
294
+ dependencies.each do |dep|
295
+ name = dep.root_name
296
+ installed_deps[name] ||= dependencies_to_lock_pod_named(name)
297
+ end
298
+
299
+ installed_deps = installed_deps.values.flatten(1).group_by(&:name)
300
+
301
+ podfile_dependencies = podfile.dependencies
302
+ podfile_dependencies_by_name = podfile_dependencies.group_by(&:name)
303
+
304
+ all_dep_names = (dependencies + podfile_dependencies).map(&:name).uniq
297
305
  all_dep_names.each do |name|
298
- installed_dep = installed_deps.find { |d| d.name == name }
299
- podfile_dep = podfile.dependencies.find { |d| d.name == name }
306
+ installed_dep = installed_deps[name]
307
+ installed_dep &&= installed_dep.first
308
+ podfile_dep = podfile_dependencies_by_name[name]
309
+ podfile_dep &&= podfile_dep.first
300
310
 
301
311
  if installed_dep.nil? then key = :added
302
312
  elsif podfile_dep.nil? then key = :removed
@@ -477,13 +487,14 @@ module Pod
477
487
  # Generates the hash of spec repo sources used in the Podfile.
478
488
  #
479
489
  # @example Output
480
- # { "https://github.com/CocoaPods/CocoaPods.git" => ["Alamofire", "Moya"] }
490
+ # { "https://github.com/cocoapods/cocoapods.git" => ["Alamofire", "Moya"] }
481
491
  #
482
492
  def generate_spec_repos(spec_repos)
483
493
  Hash[spec_repos.map do |source, specs|
484
494
  next unless source
485
495
  next if specs.empty?
486
496
  key = source.url || source.name
497
+ key = key.downcase if source.name == Pod::MasterSource::MASTER_REPO_NAME
487
498
  value = specs.map { |s| s.root.name }.uniq
488
499
  [key, value]
489
500
  end.compact]
@@ -3,5 +3,6 @@ module Pod
3
3
  # For now, the MasterSource behaves exactly the same as any other Source.
4
4
  # In the future we may apply separate logic to the MasterSource that doesn't
5
5
  # depend on the file system.
6
+ MASTER_REPO_NAME = 'master'.freeze
6
7
  end
7
8
  end
@@ -231,6 +231,11 @@ module Pod
231
231
  end
232
232
  end
233
233
 
234
+ def ==(other)
235
+ self.class == other.class &&
236
+ root_target_definitions == other.root_target_definitions
237
+ end
238
+
234
239
  # @!group Class methods
235
240
  #-------------------------------------------------------------------------#
236
241
 
@@ -748,6 +748,12 @@ module Pod
748
748
  hash
749
749
  end
750
750
 
751
+ def ==(other)
752
+ self.class == other.class &&
753
+ internal_hash == other.internal_hash &&
754
+ children == other.children
755
+ end
756
+
751
757
  # Configures a new target definition from the given hash.
752
758
  #
753
759
  # @param [Hash] the hash which contains the information of the
@@ -767,7 +773,7 @@ module Pod
767
773
 
768
774
  #-----------------------------------------------------------------------#
769
775
 
770
- private
776
+ protected
771
777
 
772
778
  # @!group Private helpers
773
779
 
@@ -780,6 +786,8 @@ module Pod
780
786
  #
781
787
  attr_accessor :internal_hash
782
788
 
789
+ private
790
+
783
791
  # Set a value in the internal hash of the target definition for the given
784
792
  # key.
785
793
  #
@@ -435,7 +435,7 @@ module Pod
435
435
 
436
436
  def git_tracking_branch
437
437
  path = repo.join('.git', 'cocoapods_branch')
438
- path.file? ? path.read.strip : 'master'
438
+ path.file? ? path.read.strip : Pod::MasterSource::MASTER_REPO_NAME
439
439
  end
440
440
 
441
441
  def diff_until_commit_hash(commit_hash)
@@ -64,7 +64,7 @@ module Pod
64
64
  # @return [Array<Source>] The CocoaPods Master Repo source.
65
65
  #
66
66
  def master
67
- sources(['master']).select { |s| s.repo.directory? }
67
+ sources([Pod::MasterSource::MASTER_REPO_NAME]).select { |s| s.repo.directory? }
68
68
  end
69
69
 
70
70
  # @!group Master repo
@@ -72,7 +72,7 @@ module Pod
72
72
  # @return [Pathname] The path of the master repo.
73
73
  #
74
74
  def master_repo_dir
75
- source_dir('master')
75
+ source_dir(Pod::MasterSource::MASTER_REPO_NAME)
76
76
  end
77
77
 
78
78
  # @return [Bool] Checks if the master repo is usable.
@@ -283,7 +283,7 @@ module Pod
283
283
  #
284
284
  def source_from_path(path)
285
285
  @sources_by_path ||= Hash.new do |hash, key|
286
- hash[key] = if key.basename.to_s == 'master'
286
+ hash[key] = if key.basename.to_s == Pod::MasterSource::MASTER_REPO_NAME
287
287
  MasterSource.new(key)
288
288
  else
289
289
  Source.new(key)
@@ -386,7 +386,7 @@ module Pod
386
386
 
387
387
  case url.to_s.downcase
388
388
  when %r{github.com[:/]+cocoapods/specs}
389
- base = 'master'
389
+ base = Pod::MasterSource::MASTER_REPO_NAME
390
390
  when %r{github.com[:/]+(.+)/(.+)}
391
391
  base = Regexp.last_match[1]
392
392
  when %r{^\S+@(\S+)[:/]+(.+)$}
@@ -50,6 +50,16 @@ module Pod
50
50
  yield self if block_given?
51
51
  end
52
52
 
53
+ def initialize_copy(other)
54
+ super
55
+
56
+ @subspecs = @subspecs.map do |subspec|
57
+ subspec = subspec.dup
58
+ subspec.instance_variable_set :@parent, self
59
+ subspec
60
+ end
61
+ end
62
+
53
63
  # @return [Hash] the hash that stores the information of the attributes of
54
64
  # the specification.
55
65
  #
@@ -666,6 +666,12 @@ module Pod
666
666
  attributes_hash['dependencies'][name] = version_requirements
667
667
  end
668
668
 
669
+ def dependency=(args)
670
+ joined = args.join('\', \'')
671
+ arguments = "\'#{joined}\'"
672
+ raise Informative, "Cannot assign value to `dependency`. Did you mean: `dependency #{arguments}`?"
673
+ end
674
+
669
675
  #------------------#
670
676
 
671
677
  # @!method requires_arc=(flag)
@@ -950,6 +956,55 @@ module Pod
950
956
  attribute :header_mappings_dir,
951
957
  :inherited => true
952
958
 
959
+ #------------------#
960
+
961
+ SCRIPT_PHASE_REQUIRED_KEYS = [:name, :script].freeze
962
+
963
+ SCRIPT_PHASE_OPTIONAL_KEYS = [:shell_path, :input_files, :output_files, :show_env_vars_in_log, :execution_position].freeze
964
+
965
+ EXECUTION_POSITION_KEYS = [:before_compile, :after_compile, :any].freeze
966
+
967
+ ALL_SCRIPT_PHASE_KEYS = (SCRIPT_PHASE_REQUIRED_KEYS + SCRIPT_PHASE_OPTIONAL_KEYS).freeze
968
+
969
+ # @!method script_phases=(*script_phases)
970
+ #
971
+ # This attribute allows to define a script phase to execute as part of compilation of the Pod.
972
+ # Unlike a prepare command, script phases execute as part of `xcodebuild` they can also utilize all environment
973
+ # variables that are set during compilation.
974
+ #
975
+ # A Pod can provide multiple script phases to execute and they will be added in the order they were
976
+ # declared and after taking into consideration their execution position setting.
977
+ #
978
+ # **Note** In order to provide visibility and awareness of the contents of all script phases,
979
+ # a warning will be presented to the user upon installing your pod if it includes any script phases.
980
+ #
981
+ # @example
982
+ #
983
+ # spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"' }
984
+ #
985
+ # @example
986
+ #
987
+ # spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"', :execution_position => :before_compile }
988
+ #
989
+ # @example
990
+ #
991
+ # spec.script_phase = { :name => 'Hello World', :script => 'puts "Hello World"', :shell_path => '/usr/bin/ruby' } }
992
+ #
993
+ # @example
994
+ #
995
+ # spec.script_phases = [
996
+ # { :name => 'Hello World', :script => 'echo "Hello World"' },
997
+ # { :name => 'Hello Ruby World', :script => 'puts "Hello World"', :shell_path => '/usr/bin/ruby' } },
998
+ # ]
999
+ #
1000
+ # @param [Array<Hash{Symbol=>String}>] script_phases
1001
+ # An array of hashes where each hash represents a single script phase.
1002
+ #
1003
+ attribute :script_phases,
1004
+ :types => [Hash],
1005
+ :container => Array,
1006
+ :singularize => true
1007
+
953
1008
  #-----------------------------------------------------------------------#
954
1009
 
955
1010
  # @!group File patterns
@@ -1157,9 +1212,9 @@ module Pod
1157
1212
  # hash where the keys represent the name of the bundles and the values
1158
1213
  # the file patterns that they should include.
1159
1214
  #
1160
- # We strongly **recommend** library developers to adopt resource
1161
- # bundles as there can be name collisions using the resources
1162
- # attribute.
1215
+ # For building the Pod as a static library, we strongly **recommend**
1216
+ # library developers to adopt resource bundles as there can be name
1217
+ # collisions using the resources attribute.
1163
1218
  #
1164
1219
  # The names of the bundles should at least include the name of the Pod
1165
1220
  # to minimise the chance of name collisions.
@@ -1194,8 +1249,8 @@ module Pod
1194
1249
  #
1195
1250
  # A list of resources that should be copied into the target bundle.
1196
1251
  #
1197
- # We strongly **recommend** library developers to adopt [resource
1198
- # bundles](http://guides.cocoapods.org/syntax/podspec.html#resource_bundles)
1252
+ # For building the Pod as a static library, we strongly **recommend**
1253
+ # library developers to adopt [resource bundles](http://guides.cocoapods.org/syntax/podspec.html#resource_bundles)
1199
1254
  # as there can be name collisions using the resources attribute.
1200
1255
  # Moreover, resources specified with this attribute are copied
1201
1256
  # directly to the client target and therefore they are not
@@ -1288,55 +1343,6 @@ module Pod
1288
1343
  attribute :module_map,
1289
1344
  :root_only => true
1290
1345
 
1291
- #------------------#
1292
-
1293
- SCRIPT_PHASE_REQUIRED_KEYS = [:name, :script].freeze
1294
-
1295
- SCRIPT_PHASE_OPTIONAL_KEYS = [:shell_path, :input_files, :output_files, :show_env_vars_in_log, :execution_position].freeze
1296
-
1297
- EXECUTION_POSITION_KEYS = [:before_compile, :after_compile, :any].freeze
1298
-
1299
- ALL_SCRIPT_PHASE_KEYS = (SCRIPT_PHASE_REQUIRED_KEYS + SCRIPT_PHASE_OPTIONAL_KEYS).freeze
1300
-
1301
- # @!method script_phases=(*script_phases)
1302
- #
1303
- # This attribute allows to define a script phase to execute as part of compilation of the Pod.
1304
- # Unlike a prepare command, script phases execute as part of `xcodebuild` they can also utilize all environment
1305
- # variables that are set during compilation.
1306
- #
1307
- # A Pod can provide multiple script phases to execute and they will be added in the order they were
1308
- # declared and after taking into consideration their execution position setting.
1309
- #
1310
- # **Note** In order to provide visibility and awareness of the contents of all script phases,
1311
- # a warning will be presented to the user upon installing your pod if it includes any script phases.
1312
- #
1313
- # @example
1314
- #
1315
- # spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"' }
1316
- #
1317
- # @example
1318
- #
1319
- # spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"', :execution_position => :before_compile }
1320
- #
1321
- # @example
1322
- #
1323
- # spec.script_phase = { :name => 'Hello World', :script => 'puts "Hello World"', :shell_path => '/usr/bin/ruby' } }
1324
- #
1325
- # @example
1326
- #
1327
- # spec.script_phases = [
1328
- # { :name => 'Hello World', :script => 'echo "Hello World"' },
1329
- # { :name => 'Hello Ruby World', :script => 'puts "Hello World"', :shell_path => '/usr/bin/ruby' } },
1330
- # ]
1331
- #
1332
- # @param [Array<Hash{Symbol=>String}>] script_phases
1333
- # An array of hashes where each hash represents a single script phase.
1334
- #
1335
- attribute :script_phases,
1336
- :types => [Hash],
1337
- :container => Array,
1338
- :singularize => true
1339
-
1340
1346
  #-----------------------------------------------------------------------#
1341
1347
 
1342
1348
  # @!group Subspecs
@@ -254,11 +254,9 @@ module Pod
254
254
  # @return [Array] The sorted array.
255
255
  #
256
256
  def sorted_array(array)
257
- array.sort do |x, y|
258
- x_string = sorting_string(x)
259
- y_string = sorting_string(y)
260
- x_string <=> y_string
261
- end
257
+ array.each_with_index.sort_by do |element, index|
258
+ [sorting_string(element), index]
259
+ end.map(&:first)
262
260
  end
263
261
 
264
262
  # Returns the string representation of a value useful for sorting.
@@ -275,7 +273,7 @@ module Pod
275
273
  when Symbol then sorting_string(value.to_s)
276
274
  when Array then sorting_string(value.first)
277
275
  when Hash then value.keys.map { |key| key.to_s.downcase }.sort.first
278
- else raise "Cannot sort #{value.inspect}"
276
+ else raise ArgumentError, "Cannot sort #{value.inspect}"
279
277
  end
280
278
  end
281
279
 
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.5.0
4
+ version: 1.5.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: 2018-04-04 00:00:00.000000000 Z
12
+ date: 2018-05-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport