cocoapods-core 1.4.0 → 1.5.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-core/dependency.rb +28 -11
- data/lib/cocoapods-core/gem_version.rb +1 -1
- data/lib/cocoapods-core/http.rb +7 -2
- data/lib/cocoapods-core/lockfile.rb +55 -6
- data/lib/cocoapods-core/podfile/dsl.rb +33 -0
- data/lib/cocoapods-core/podfile/target_definition.rb +114 -0
- data/lib/cocoapods-core/source.rb +15 -7
- data/lib/cocoapods-core/specification/dsl.rb +9 -8
- data/lib/cocoapods-core/specification/set.rb +1 -1
- data/lib/cocoapods-core/specification.rb +2 -2
- data/lib/cocoapods-core/yaml_helper.rb +19 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5951e63ba532abe3d6996c0e03644fe213db6d3cdba2202ceb9ceb375356167
|
4
|
+
data.tar.gz: 642e58e2d8f48431a0ba79a90488e526fa7075135934cfd0836653c6a9f1e273
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfbd4c782d9b20283bdd459bdb51ba302537d58773b2ac5ca70f48683667920882820be623056ae15aeffe526b2ffa7c23e84709d6acaa4aed4d4f8aa9338214
|
7
|
+
data.tar.gz: 1aa4a692e6147769145320bd71c491c148c08c182133d7e7eb0959fde3763877707c602e9bec4f08e38cb80b3aa557f94672ec18dff01683a70ff5eebaf17885
|
@@ -95,8 +95,7 @@ module Pod
|
|
95
95
|
raise Informative, 'A dependency with a specified podspec repo may ' \
|
96
96
|
"not include other source parameters (#{name})."
|
97
97
|
end
|
98
|
-
|
99
|
-
@external_source = additional_params
|
98
|
+
elsif @external_source = additional_params
|
100
99
|
unless requirements.empty?
|
101
100
|
raise Informative, 'A dependency with an external source may not ' \
|
102
101
|
"specify version requirements (#{name})."
|
@@ -216,7 +215,8 @@ module Pod
|
|
216
215
|
self.class == other.class &&
|
217
216
|
name == other.name &&
|
218
217
|
requirement == other.requirement &&
|
219
|
-
external_source == other.external_source
|
218
|
+
external_source == other.external_source &&
|
219
|
+
podspec_repo == other.podspec_repo
|
220
220
|
end
|
221
221
|
alias_method :eql?, :==
|
222
222
|
|
@@ -249,24 +249,41 @@ module Pod
|
|
249
249
|
unless name == other.name
|
250
250
|
raise ArgumentError, "#{self} and #{other} have different names"
|
251
251
|
end
|
252
|
+
|
252
253
|
default = Requirement.default
|
253
254
|
self_req = requirement
|
254
255
|
other_req = other.requirement
|
255
256
|
|
256
|
-
|
257
|
-
|
257
|
+
req = if other_req == default
|
258
|
+
self_req
|
258
259
|
elsif self_req == default
|
259
|
-
|
260
|
+
other_req
|
260
261
|
else
|
261
|
-
|
262
|
+
self_req.as_list.concat(other_req.as_list)
|
262
263
|
end
|
263
264
|
|
265
|
+
opts = {}
|
266
|
+
|
264
267
|
if external_source || other.external_source
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
+
opts.
|
269
|
+
merge!(external_source || {}).
|
270
|
+
merge!(other.external_source || {})
|
271
|
+
|
272
|
+
req_to_set = req
|
273
|
+
req = []
|
274
|
+
end
|
275
|
+
|
276
|
+
if podspec_repo && other.podspec_repo && podspec_repo != other.podspec_repo
|
277
|
+
raise ArgumentError, "#{self} and #{other} have different podspec repos"
|
278
|
+
end
|
279
|
+
|
280
|
+
if repo = podspec_repo || other.podspec_repo
|
281
|
+
opts[:source] = repo
|
282
|
+
end
|
283
|
+
|
284
|
+
self.class.new(name, *req, opts).tap do |dep|
|
285
|
+
dep.instance_variable_set(:@requirement, Requirement.create(req_to_set)) if req_to_set
|
268
286
|
end
|
269
|
-
dep
|
270
287
|
end
|
271
288
|
|
272
289
|
# Whether the dependency has any pre-release requirements
|
data/lib/cocoapods-core/http.rb
CHANGED
@@ -44,7 +44,7 @@ module Pod
|
|
44
44
|
begin
|
45
45
|
url = get_actual_url(url)
|
46
46
|
resp = perform_head_request(url)
|
47
|
-
rescue SocketError, URI::InvalidURIError, REST::Error, REST::
|
47
|
+
rescue SocketError, URI::InvalidURIError, REST::Error, REST::Error::Connection
|
48
48
|
resp = nil
|
49
49
|
end
|
50
50
|
|
@@ -65,7 +65,12 @@ module Pod
|
|
65
65
|
resp = ::REST.head(url, 'User-Agent' => USER_AGENT)
|
66
66
|
|
67
67
|
if resp.status_code >= 400
|
68
|
-
resp = ::REST.get(url, 'User-Agent' => USER_AGENT
|
68
|
+
resp = ::REST.get(url, 'User-Agent' => USER_AGENT,
|
69
|
+
'Range' => 'bytes=0-0')
|
70
|
+
|
71
|
+
if resp.status_code >= 400
|
72
|
+
resp = ::REST.get(url, 'User-Agent' => USER_AGENT)
|
73
|
+
end
|
69
74
|
end
|
70
75
|
|
71
76
|
resp
|
@@ -77,7 +77,7 @@ module Pod
|
|
77
77
|
|
78
78
|
# Returns the version of the given Pod.
|
79
79
|
#
|
80
|
-
# @param [
|
80
|
+
# @param [String] pod_name The name of the Pod (root name of the specification).
|
81
81
|
#
|
82
82
|
# @return [Version] The version of the pod.
|
83
83
|
#
|
@@ -92,9 +92,21 @@ module Pod
|
|
92
92
|
pod_versions[root_name]
|
93
93
|
end
|
94
94
|
|
95
|
+
# Returns the source of the given Pod.
|
96
|
+
#
|
97
|
+
# @param [String] pod_name The name of the Pod (root name of the specification).
|
98
|
+
#
|
99
|
+
# @return [String] The source of the pod.
|
100
|
+
#
|
101
|
+
# @return [Nil] If there is no source stored for the given name.
|
102
|
+
#
|
103
|
+
def spec_repo(pod_name)
|
104
|
+
spec_repos_by_pod[pod_name]
|
105
|
+
end
|
106
|
+
|
95
107
|
# Returns the checksum for the given Pod.
|
96
108
|
#
|
97
|
-
# @param [
|
109
|
+
# @param [String] name The name of the Pod (root name of the specification).
|
98
110
|
#
|
99
111
|
# @return [String] The checksum of the specification for the given Pod.
|
100
112
|
#
|
@@ -121,6 +133,17 @@ module Pod
|
|
121
133
|
@dependencies
|
122
134
|
end
|
123
135
|
|
136
|
+
# Returns pod names grouped by the spec repo they were sourced from.
|
137
|
+
#
|
138
|
+
# @return [Hash<String, Array<String>>] A hash, where the keys are spec
|
139
|
+
# repo source URLs (or names), and the values are arrays of pod names.
|
140
|
+
#
|
141
|
+
# @note It does not include pods that come from "external sources".
|
142
|
+
#
|
143
|
+
def pods_by_spec_repo
|
144
|
+
@pods_by_spec_repo ||= internal_data['SPEC REPOS'] || {}
|
145
|
+
end
|
146
|
+
|
124
147
|
# Generates a dependency that requires the exact version of the Pod with the
|
125
148
|
# given name.
|
126
149
|
#
|
@@ -225,6 +248,17 @@ module Pod
|
|
225
248
|
internal_data['SPEC CHECKSUMS'] || {}
|
226
249
|
end
|
227
250
|
|
251
|
+
# @return [Hash{String => String}] A hash containing the spec repo used for the specification
|
252
|
+
# by the name of the root spec.
|
253
|
+
#
|
254
|
+
def spec_repos_by_pod
|
255
|
+
@spec_repos_by_pod ||= pods_by_spec_repo.each_with_object({}) do |(spec_repo, pods), spec_repos_by_pod|
|
256
|
+
pods.each do |pod|
|
257
|
+
spec_repos_by_pod[pod] = spec_repo
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
228
262
|
#-------------------------------------------------------------------------#
|
229
263
|
|
230
264
|
# !@group Comparison with a Podfile
|
@@ -335,6 +369,7 @@ module Pod
|
|
335
369
|
HASH_KEY_ORDER = [
|
336
370
|
'PODS',
|
337
371
|
'DEPENDENCIES',
|
372
|
+
'SPEC REPOS',
|
338
373
|
'EXTERNAL SOURCES',
|
339
374
|
'CHECKOUT OPTIONS',
|
340
375
|
'SPEC CHECKSUMS',
|
@@ -350,9 +385,7 @@ module Pod
|
|
350
385
|
# @note The YAML string is prettified.
|
351
386
|
#
|
352
387
|
def to_yaml
|
353
|
-
|
354
|
-
yaml_string = yaml_string.tr("'", '')
|
355
|
-
yaml_string.tr('"', '')
|
388
|
+
YAMLHelper.convert_hash(to_hash, HASH_KEY_ORDER, "\n\n")
|
356
389
|
end
|
357
390
|
|
358
391
|
#-------------------------------------------------------------------------#
|
@@ -375,10 +408,11 @@ module Pod
|
|
375
408
|
#
|
376
409
|
# @return [Lockfile] a new lockfile.
|
377
410
|
#
|
378
|
-
def generate(podfile, specs, checkout_options)
|
411
|
+
def generate(podfile, specs, checkout_options, spec_repos = {})
|
379
412
|
hash = {
|
380
413
|
'PODS' => generate_pods_data(specs),
|
381
414
|
'DEPENDENCIES' => generate_dependencies_data(podfile),
|
415
|
+
'SPEC REPOS' => generate_spec_repos(spec_repos),
|
382
416
|
'EXTERNAL SOURCES' => generate_external_sources_data(podfile),
|
383
417
|
'CHECKOUT OPTIONS' => checkout_options,
|
384
418
|
'SPEC CHECKSUMS' => generate_checksums(specs),
|
@@ -440,6 +474,21 @@ module Pod
|
|
440
474
|
podfile.dependencies.map(&:to_s).sort
|
441
475
|
end
|
442
476
|
|
477
|
+
# Generates the hash of spec repo sources used in the Podfile.
|
478
|
+
#
|
479
|
+
# @example Output
|
480
|
+
# { "https://github.com/CocoaPods/CocoaPods.git" => ["Alamofire", "Moya"] }
|
481
|
+
#
|
482
|
+
def generate_spec_repos(spec_repos)
|
483
|
+
Hash[spec_repos.map do |source, specs|
|
484
|
+
next unless source
|
485
|
+
next if specs.empty?
|
486
|
+
key = source.url || source.name
|
487
|
+
value = specs.map { |s| s.root.name }.uniq
|
488
|
+
[key, value]
|
489
|
+
end.compact]
|
490
|
+
end
|
491
|
+
|
443
492
|
# Generates the information of the external sources.
|
444
493
|
#
|
445
494
|
# @example Output
|
@@ -142,6 +142,19 @@ module Pod
|
|
142
142
|
#
|
143
143
|
# ------
|
144
144
|
#
|
145
|
+
# ### Source
|
146
|
+
#
|
147
|
+
# By default the sources specified at the global level are searched in the order
|
148
|
+
# they are specified for a dependency match. This behaviour can be altered
|
149
|
+
# for a specific dependency by specifying the source with the dependency:
|
150
|
+
#
|
151
|
+
# pod 'PonyDebugger', :source => 'https://github.com/CocoaPods/Specs.git'
|
152
|
+
#
|
153
|
+
# In this case only the specified source will be searched for the dependency
|
154
|
+
# and any global sources ignored.
|
155
|
+
#
|
156
|
+
# ------
|
157
|
+
#
|
145
158
|
# ### Subspecs
|
146
159
|
#
|
147
160
|
# When installing a Pod via its name, it will install all of the
|
@@ -607,6 +620,26 @@ module Pod
|
|
607
620
|
current_target_definition.inhibit_all_warnings = true
|
608
621
|
end
|
609
622
|
|
623
|
+
# Use modular headers for all CocoaPods static libraries.
|
624
|
+
#
|
625
|
+
# ------
|
626
|
+
#
|
627
|
+
# This attribute is inherited by child target definitions.
|
628
|
+
#
|
629
|
+
# If you would like to use modular headers per Pod you can use the
|
630
|
+
# following syntax:
|
631
|
+
#
|
632
|
+
# pod 'SSZipArchive', :modular_headers => true
|
633
|
+
#
|
634
|
+
# Additionally, when you use the `use_modular_headers!` attribute,
|
635
|
+
# you can exclude a particular Pod from modular headers using the following:
|
636
|
+
#
|
637
|
+
# pod 'SSZipArchive', :modular_headers => false
|
638
|
+
#
|
639
|
+
def use_modular_headers!
|
640
|
+
current_target_definition.use_modular_headers_for_all_pods = true
|
641
|
+
end
|
642
|
+
|
610
643
|
# Use frameworks instead of static libraries for Pods.
|
611
644
|
#
|
612
645
|
# ------
|
@@ -457,6 +457,96 @@ module Pod
|
|
457
457
|
|
458
458
|
#--------------------------------------#
|
459
459
|
|
460
|
+
def raw_use_modular_headers_hash
|
461
|
+
get_hash_value('use_modular_headers', {})
|
462
|
+
end
|
463
|
+
private :raw_use_modular_headers_hash
|
464
|
+
|
465
|
+
# Returns the use_modular_headers hash pre-populated with default values.
|
466
|
+
#
|
467
|
+
# @return [Hash<String, Array>] Hash with :all key for building all
|
468
|
+
# pods as modules, :for_pods key for building as module per Pod,
|
469
|
+
# and :not_for_pods key for not biulding as module per Pod.
|
470
|
+
#
|
471
|
+
def use_modular_headers_hash
|
472
|
+
raw_hash = raw_use_modular_headers_hash
|
473
|
+
if exclusive?
|
474
|
+
raw_hash
|
475
|
+
else
|
476
|
+
parent_hash = parent.send(:use_modular_headers_hash).dup
|
477
|
+
if parent_hash['not_for_pods']
|
478
|
+
# Remove pods that are set to not use modular headers inside parent
|
479
|
+
# if they are set to use modular headers inside current target.
|
480
|
+
parent_hash['not_for_pods'] -= Array(raw_hash['for_pods'])
|
481
|
+
end
|
482
|
+
if parent_hash['for_pods']
|
483
|
+
# Remove pods that are set to use modular headers inside parent if they are set to not use modular headers inside current target.
|
484
|
+
parent_hash['for_pods'] -= Array(raw_hash['for_pods'])
|
485
|
+
end
|
486
|
+
if raw_hash['all']
|
487
|
+
# Clean pods that are set to not use modular headers inside parent if use_modular_headers! was set.
|
488
|
+
parent_hash['not_for_pods'] = nil
|
489
|
+
end
|
490
|
+
parent_hash.merge(raw_hash) do |_, l, r|
|
491
|
+
Array(l).concat(r).uniq
|
492
|
+
end
|
493
|
+
end
|
494
|
+
end
|
495
|
+
|
496
|
+
# @return [Bool] whether the target definition should use modular headers
|
497
|
+
# for a single pod. If use_modular_headers! is true, it will
|
498
|
+
# return true for any asked pod.
|
499
|
+
#
|
500
|
+
def build_pod_as_module?(pod_name)
|
501
|
+
if Array(use_modular_headers_hash['not_for_pods']).include?(pod_name)
|
502
|
+
false
|
503
|
+
elsif use_modular_headers_hash['all']
|
504
|
+
true
|
505
|
+
elsif !root? && parent.build_pod_as_module?(pod_name)
|
506
|
+
true
|
507
|
+
else
|
508
|
+
Array(use_modular_headers_hash['for_pods']).include? pod_name
|
509
|
+
end
|
510
|
+
end
|
511
|
+
|
512
|
+
# Sets whether the target definition should use modular headers for all pods.
|
513
|
+
#
|
514
|
+
# @param [Bool] flag
|
515
|
+
# Whether the warnings should be suppressed.
|
516
|
+
#
|
517
|
+
# @return [void]
|
518
|
+
#
|
519
|
+
def use_modular_headers_for_all_pods=(flag)
|
520
|
+
raw_use_modular_headers_hash['all'] = flag
|
521
|
+
end
|
522
|
+
|
523
|
+
# Use modular headers for a specific pod during compilation.
|
524
|
+
#
|
525
|
+
# @param [String] pod_name
|
526
|
+
# Name of the pod for which modular headers will be used.
|
527
|
+
#
|
528
|
+
# @param [Bool] flag
|
529
|
+
# Whether modular headers should be used.
|
530
|
+
#
|
531
|
+
# @return [void]
|
532
|
+
#
|
533
|
+
def set_use_modular_headers_for_pod(pod_name, flag)
|
534
|
+
hash_key = case flag
|
535
|
+
when true
|
536
|
+
'for_pods'
|
537
|
+
when false
|
538
|
+
'not_for_pods'
|
539
|
+
when nil
|
540
|
+
return
|
541
|
+
else
|
542
|
+
raise ArgumentError, "Got `#{flag.inspect}`, should be a boolean"
|
543
|
+
end
|
544
|
+
raw_use_modular_headers_hash[hash_key] ||= []
|
545
|
+
raw_use_modular_headers_hash[hash_key] << pod_name
|
546
|
+
end
|
547
|
+
|
548
|
+
#--------------------------------------#
|
549
|
+
|
460
550
|
PLATFORM_DEFAULTS = { :ios => '4.3', :osx => '10.6', :tvos => '9.0', :watchos => '2.0' }.freeze
|
461
551
|
|
462
552
|
# @return [Platform] the platform of the target definition.
|
@@ -542,6 +632,7 @@ module Pod
|
|
542
632
|
def store_pod(name, *requirements)
|
543
633
|
return if parse_subspecs(name, requirements) # This parse method must be called first
|
544
634
|
parse_inhibit_warnings(name, requirements)
|
635
|
+
parse_modular_headers(name, requirements)
|
545
636
|
parse_configuration_whitelist(name, requirements)
|
546
637
|
|
547
638
|
if requirements && !requirements.empty?
|
@@ -634,6 +725,7 @@ module Pod
|
|
634
725
|
link_with
|
635
726
|
link_with_first_target
|
636
727
|
inhibit_warnings
|
728
|
+
use_modular_headers
|
637
729
|
user_project_path
|
638
730
|
build_configurations
|
639
731
|
dependencies
|
@@ -873,6 +965,28 @@ module Pod
|
|
873
965
|
requirements.pop if options.empty?
|
874
966
|
end
|
875
967
|
|
968
|
+
# Removes :modular_headers from the requirements list, and adds
|
969
|
+
# the pods name into internal hash for modular headers.
|
970
|
+
#
|
971
|
+
# @param [String] pod name
|
972
|
+
#
|
973
|
+
# @param [Array] requirements
|
974
|
+
# If :modular_headers is the only key in the hash, the hash
|
975
|
+
# should be destroyed because it confuses Gem::Dependency.
|
976
|
+
#
|
977
|
+
# @return [void]
|
978
|
+
#
|
979
|
+
def parse_modular_headers(name, requirements)
|
980
|
+
options = requirements.last
|
981
|
+
return requirements unless options.is_a?(Hash)
|
982
|
+
|
983
|
+
defines_module = options.delete(:modular_headers)
|
984
|
+
pod_name = Specification.root_name(name)
|
985
|
+
set_use_modular_headers_for_pod(pod_name, defines_module)
|
986
|
+
|
987
|
+
requirements.pop if options.empty?
|
988
|
+
end
|
989
|
+
|
876
990
|
# Removes :configurations or :configuration from the requirements list,
|
877
991
|
# and adds the pod's name into the internal hash for which pods should be
|
878
992
|
# linked in which configuration only.
|
@@ -42,11 +42,13 @@ module Pod
|
|
42
42
|
# option. See https://github.com/CocoaPods/CocoaPods/issues/2724.
|
43
43
|
#
|
44
44
|
def url
|
45
|
-
|
46
|
-
|
47
|
-
remote
|
48
|
-
|
49
|
-
|
45
|
+
@url ||= begin
|
46
|
+
remote = repo_git(%w(config --get remote.origin.url))
|
47
|
+
if !remote.empty?
|
48
|
+
remote
|
49
|
+
elsif (repo + '.git').exist?
|
50
|
+
"file://#{repo}/.git"
|
51
|
+
end
|
50
52
|
end
|
51
53
|
end
|
52
54
|
|
@@ -260,7 +262,13 @@ module Pod
|
|
260
262
|
if query.is_a?(Dependency)
|
261
263
|
query = query.root_name
|
262
264
|
end
|
263
|
-
|
265
|
+
|
266
|
+
found = []
|
267
|
+
Pathname.glob(pod_path(query)) do |path|
|
268
|
+
next unless Dir.foreach(path).any? { |child| child != '.' && child != '..' }
|
269
|
+
found << path.basename.to_s
|
270
|
+
end
|
271
|
+
|
264
272
|
if [query] == found
|
265
273
|
set = set(query)
|
266
274
|
set if set.specification_name == query
|
@@ -435,7 +443,7 @@ module Pod
|
|
435
443
|
end
|
436
444
|
|
437
445
|
def repo_git(args, include_error: false)
|
438
|
-
command = "git -C \"#{repo}\" " << args.join(' ')
|
446
|
+
command = "env -u GIT_CONFIG git -C \"#{repo}\" " << args.join(' ')
|
439
447
|
command << ' 2>&1' if include_error
|
440
448
|
(`#{command}` || '').strip
|
441
449
|
end
|
@@ -42,14 +42,15 @@ module Pod
|
|
42
42
|
# Or it can be quite detailed:
|
43
43
|
#
|
44
44
|
# Pod::Spec.new do |spec|
|
45
|
-
# spec.name
|
46
|
-
# spec.version
|
47
|
-
# spec.license
|
48
|
-
# spec.homepage
|
49
|
-
# spec.authors
|
50
|
-
# spec.summary
|
51
|
-
# spec.source
|
52
|
-
# spec.module_name
|
45
|
+
# spec.name = 'Reachability'
|
46
|
+
# spec.version = '3.1.0'
|
47
|
+
# spec.license = { :type => 'BSD' }
|
48
|
+
# spec.homepage = 'https://github.com/tonymillion/Reachability'
|
49
|
+
# spec.authors = { 'Tony Million' => 'tonymillion@gmail.com' }
|
50
|
+
# spec.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X.'
|
51
|
+
# spec.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
|
52
|
+
# spec.module_name = 'Rich'
|
53
|
+
# spec.swift_version = '4.0'
|
53
54
|
#
|
54
55
|
# spec.ios.deployment_target = '9.0'
|
55
56
|
# spec.osx.deployment_target = '10.10'
|
@@ -68,7 +68,7 @@ module Pod
|
|
68
68
|
# from highest to lowest.
|
69
69
|
#
|
70
70
|
def versions
|
71
|
-
versions_by_source.values.flatten.uniq.sort.reverse
|
71
|
+
@versions ||= versions_by_source.values.flatten.uniq.sort.reverse
|
72
72
|
end
|
73
73
|
|
74
74
|
# @return [Version] The highest version known of the specification.
|
@@ -152,7 +152,7 @@ module Pod
|
|
152
152
|
# @return [String] the root name
|
153
153
|
#
|
154
154
|
def self.root_name(full_name)
|
155
|
-
full_name.split('/').first
|
155
|
+
full_name.split('/', 2).first
|
156
156
|
end
|
157
157
|
|
158
158
|
# Returns the module name of a specification
|
@@ -607,7 +607,7 @@ module Pod
|
|
607
607
|
# @return [Specification] the specification
|
608
608
|
#
|
609
609
|
def self.from_string(spec_contents, path, subspec_name = nil)
|
610
|
-
path = Pathname.new(path)
|
610
|
+
path = Pathname.new(path).expand_path
|
611
611
|
spec = nil
|
612
612
|
Dir.chdir(path.parent.directory? ? path.parent : Dir.pwd) do
|
613
613
|
case path.extname
|
@@ -109,6 +109,8 @@ module Pod
|
|
109
109
|
# @return [String] the YAML representation of the given object.
|
110
110
|
#
|
111
111
|
def process_array(array)
|
112
|
+
return '[]' if array.empty?
|
113
|
+
|
112
114
|
result = sorted_array(array).map do |array_value|
|
113
115
|
processed = process_according_to_class(array_value)
|
114
116
|
case array_value
|
@@ -143,6 +145,8 @@ module Pod
|
|
143
145
|
# @return [String] the YAML representation of the given object.
|
144
146
|
#
|
145
147
|
def process_hash(hash, hash_keys_hint = nil, line_separator = "\n")
|
148
|
+
return '{}' if hash.empty?
|
149
|
+
|
146
150
|
keys = sorted_array_with_hint(hash.keys, hash_keys_hint)
|
147
151
|
key_lines = keys.map do |key|
|
148
152
|
key_value = hash[key]
|
@@ -275,7 +279,7 @@ module Pod
|
|
275
279
|
end
|
276
280
|
end
|
277
281
|
|
278
|
-
RESOLVED_TAGS =
|
282
|
+
RESOLVED_TAGS = Regexp.union(
|
279
283
|
'null', 'Null', 'NULL', '~', '', # resolve to null
|
280
284
|
'true', 'True', 'TRUE', 'false', 'False', 'FALSE', # bool
|
281
285
|
/[-+]?[0-9]+/, # base 10 int
|
@@ -284,19 +288,29 @@ module Pod
|
|
284
288
|
/[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?/, # float
|
285
289
|
/[-+]?\.(inf|Inf|INF)/, # infinity
|
286
290
|
/\.(nan|NaN|NAN)/, # NaN
|
287
|
-
|
291
|
+
)
|
288
292
|
private_constant :RESOLVED_TAGS
|
289
293
|
|
294
|
+
INDICATOR_START_CHARS = %w(- ? : , [ ] { } # & * ! | > ' " % @ `).freeze
|
295
|
+
INDICATOR_START = /\A#{Regexp.union(INDICATOR_START_CHARS)}/
|
296
|
+
private_constant :INDICATOR_START_CHARS, :INDICATOR_START
|
297
|
+
|
290
298
|
RESOLVED_TAGS_PATTERN = /\A#{Regexp.union(RESOLVED_TAGS)}\z/
|
291
299
|
private_constant :RESOLVED_TAGS_PATTERN
|
292
300
|
|
301
|
+
VALID_PLAIN_SCALAR_STRING = %r{\A
|
302
|
+
[\w&&[^#{INDICATOR_START_CHARS}]] # valid first character
|
303
|
+
[\w/\ \(\)~<>=\.:`,-]* # all characters allowed after the first one
|
304
|
+
\z}ox
|
305
|
+
private_constant :VALID_PLAIN_SCALAR_STRING
|
306
|
+
|
293
307
|
def process_string(string)
|
294
308
|
case string
|
295
|
-
when /\A\s*\z/
|
296
|
-
string.inspect
|
297
309
|
when RESOLVED_TAGS_PATTERN
|
298
310
|
"'#{string}'"
|
299
|
-
when
|
311
|
+
when /\A\s*\z/, INDICATOR_START, /:\z/
|
312
|
+
string.inspect
|
313
|
+
when VALID_PLAIN_SCALAR_STRING
|
300
314
|
string
|
301
315
|
else
|
302
316
|
string.inspect
|
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.
|
4
|
+
version: 1.5.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: 2018-
|
12
|
+
date: 2018-03-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
version: '0'
|
147
147
|
requirements: []
|
148
148
|
rubyforge_project:
|
149
|
-
rubygems_version: 2.7.
|
149
|
+
rubygems_version: 2.7.6
|
150
150
|
signing_key:
|
151
151
|
specification_version: 3
|
152
152
|
summary: The models of CocoaPods
|