cocoapods-core 0.17.2 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cocoapods-core/dependency.rb +72 -10
- data/lib/cocoapods-core/gem_version.rb +1 -1
- data/lib/cocoapods-core/podfile/dsl.rb +26 -7
- data/lib/cocoapods-core/podfile/target_definition.rb +57 -7
- data/lib/cocoapods-core/requirement.rb +60 -0
- data/lib/cocoapods-core/source.rb +29 -4
- data/lib/cocoapods-core/source/health_reporter.rb +1 -1
- data/lib/cocoapods-core/specification/yaml.rb +26 -2
- data/lib/cocoapods-core/vendor.rb +1 -2
- metadata +2 -3
- data/lib/cocoapods-core/vendor/dependency.rb +0 -264
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b8cd1d3394fab84bd79670bad3389820b40a6110
|
|
4
|
+
data.tar.gz: 064af0e2916d74b5ea2db298397198e9a06c204a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8445099953c499685134515408e0c1640e46509181b9b3a743b47716bcbfa9004b9b7b6063e2dde0261d4c842a945a6649f953d678f5e9bda0b7cf86ceb974f3
|
|
7
|
+
data.tar.gz: b6e932b7c370d35f851683cd79ebafb3152eea3349dcc1f27bc46697da0cd88633854e15c3b06f151bd7d027bcfe63967b6bc14e3779b4db6fc00149346e4883
|
|
@@ -4,10 +4,16 @@ module Pod
|
|
|
4
4
|
# {Specification} on a Pod. It stores the name of the dependency, version
|
|
5
5
|
# requirements and external sources information.
|
|
6
6
|
#
|
|
7
|
-
# This class
|
|
8
|
-
#
|
|
7
|
+
# This class is based on the dependency class of RubyGems and mimics its
|
|
8
|
+
# implementation with adjustments specific to CocoaPods. RubyGems is
|
|
9
|
+
# available under the
|
|
10
|
+
# [MIT license](https://github.com/rubygems/rubygems/blob/master/MIT.txt).
|
|
9
11
|
#
|
|
10
|
-
class Dependency
|
|
12
|
+
class Dependency
|
|
13
|
+
|
|
14
|
+
# @return [String] The name of the Pod described by this dependency.
|
|
15
|
+
#
|
|
16
|
+
attr_accessor :name
|
|
11
17
|
|
|
12
18
|
# @return [Hash{Symbol=>String}] a hash describing the external source
|
|
13
19
|
# where the pod should be fetched. The external source has to
|
|
@@ -27,7 +33,7 @@ module Pod
|
|
|
27
33
|
# @param [String] name
|
|
28
34
|
# the name of the Pod.
|
|
29
35
|
#
|
|
30
|
-
# @param [Array] requirements
|
|
36
|
+
# @param [Array, Version, String, Requirement] requirements
|
|
31
37
|
# an array specifying the version requirements of the
|
|
32
38
|
# dependency.
|
|
33
39
|
#
|
|
@@ -78,7 +84,11 @@ module Pod
|
|
|
78
84
|
end
|
|
79
85
|
end
|
|
80
86
|
|
|
81
|
-
|
|
87
|
+
if requirements.length == 1 && requirements.first.is_a?(Requirement)
|
|
88
|
+
requirements = requirements.first
|
|
89
|
+
end
|
|
90
|
+
@name = name
|
|
91
|
+
@requirement = Requirement.create(requirements)
|
|
82
92
|
end
|
|
83
93
|
|
|
84
94
|
# @return [Version] whether the dependency points to a specific version.
|
|
@@ -94,7 +104,7 @@ module Pod
|
|
|
94
104
|
#
|
|
95
105
|
def requirement
|
|
96
106
|
return Requirement.new(Version.new(specific_version.version)) if specific_version
|
|
97
|
-
|
|
107
|
+
@requirement
|
|
98
108
|
end
|
|
99
109
|
|
|
100
110
|
# @return [Bool] whether the dependency points to a subspec.
|
|
@@ -117,6 +127,9 @@ module Pod
|
|
|
117
127
|
# what particular specification (subspecs or top level) is
|
|
118
128
|
# required.
|
|
119
129
|
#
|
|
130
|
+
# @todo This should not use `dup`. The `name` property should be an
|
|
131
|
+
# attr_reader.
|
|
132
|
+
#
|
|
120
133
|
# @return [Dependency] a dependency with the same versions requirements
|
|
121
134
|
# that is guaranteed to point to a top level specification.
|
|
122
135
|
#
|
|
@@ -165,10 +178,28 @@ module Pod
|
|
|
165
178
|
# external source.
|
|
166
179
|
#
|
|
167
180
|
def ==(other)
|
|
168
|
-
|
|
181
|
+
Dependency === other &&
|
|
182
|
+
name == other.name &&
|
|
183
|
+
requirement == other.requirement &&
|
|
184
|
+
head? == other.head? &&
|
|
185
|
+
external_source == other.external_source
|
|
169
186
|
end
|
|
170
187
|
alias :eql? :==
|
|
171
188
|
|
|
189
|
+
# @return [Fixnum] The hash value based on the name and on the
|
|
190
|
+
# requirements.
|
|
191
|
+
#
|
|
192
|
+
def hash
|
|
193
|
+
name.hash ^ requirement.hash
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# @return [Fixnum] How the dependency should be sorted respect to another
|
|
197
|
+
# one according to its name.
|
|
198
|
+
#
|
|
199
|
+
def <=> other
|
|
200
|
+
self.name <=> other.name
|
|
201
|
+
end
|
|
202
|
+
|
|
172
203
|
# Merges the version requirements of the dependency with another one.
|
|
173
204
|
#
|
|
174
205
|
# @param [Dependency] other
|
|
@@ -181,7 +212,21 @@ module Pod
|
|
|
181
212
|
# includes also the version requirements of the given one.
|
|
182
213
|
#
|
|
183
214
|
def merge(other)
|
|
184
|
-
|
|
215
|
+
unless name == other.name then
|
|
216
|
+
raise ArgumentError, "#{self} and #{other} have different names"
|
|
217
|
+
end
|
|
218
|
+
default = Requirement.default
|
|
219
|
+
self_req = self.requirement
|
|
220
|
+
other_req = other.requirement
|
|
221
|
+
|
|
222
|
+
if other_req == default
|
|
223
|
+
dep = self.class.new(name, self_req)
|
|
224
|
+
elsif self_req == default
|
|
225
|
+
dep = self.class.new(name, other_req)
|
|
226
|
+
else
|
|
227
|
+
dep = self.class.new(name, self_req.as_list.concat(other_req.as_list))
|
|
228
|
+
end
|
|
229
|
+
|
|
185
230
|
dep.head = head? || other.head?
|
|
186
231
|
if external_source || other.external_source
|
|
187
232
|
self_external_source = external_source || {}
|
|
@@ -191,6 +236,23 @@ module Pod
|
|
|
191
236
|
dep
|
|
192
237
|
end
|
|
193
238
|
|
|
239
|
+
# Checks whether the dependency would be satisfied by the specification
|
|
240
|
+
# with the given name and version.
|
|
241
|
+
#
|
|
242
|
+
# @param [String]
|
|
243
|
+
# The proposed name.
|
|
244
|
+
#
|
|
245
|
+
# @param [String, Version] version
|
|
246
|
+
# The proposed version.
|
|
247
|
+
#
|
|
248
|
+
# @return [Bool] Whether the dependency is satisfied.
|
|
249
|
+
#
|
|
250
|
+
def match?(name, version)
|
|
251
|
+
return false unless self.name === name
|
|
252
|
+
return true if requirement.none?
|
|
253
|
+
requirement.satisfied_by?(Version.new(version))
|
|
254
|
+
end
|
|
255
|
+
|
|
194
256
|
#-------------------------------------------------------------------------#
|
|
195
257
|
|
|
196
258
|
# !@group String representation
|
|
@@ -220,8 +282,8 @@ module Pod
|
|
|
220
282
|
version << external_source_description(external_source)
|
|
221
283
|
elsif head?
|
|
222
284
|
version << 'HEAD'
|
|
223
|
-
elsif
|
|
224
|
-
version <<
|
|
285
|
+
elsif requirement != Requirement.default
|
|
286
|
+
version << requirement.to_s
|
|
225
287
|
end
|
|
226
288
|
result = @name.dup
|
|
227
289
|
result << " (#{version})" unless version.empty?
|
|
@@ -88,6 +88,26 @@ module Pod
|
|
|
88
88
|
#
|
|
89
89
|
# Dependencies can be obtained also from external sources.
|
|
90
90
|
#
|
|
91
|
+
#
|
|
92
|
+
# ### Using the files from a folder local to the machine.
|
|
93
|
+
#
|
|
94
|
+
# If you wold like to use develop a Pod in tandem with its client
|
|
95
|
+
# project you can use the `local` option.
|
|
96
|
+
#
|
|
97
|
+
# pod 'AFNetworking', :local => '~/Documents/AFNetworking'
|
|
98
|
+
#
|
|
99
|
+
# Using this option CocoaPods will assume the given folder to be the
|
|
100
|
+
# root of the Pod and will link the files directly from there in the
|
|
101
|
+
# Pods project. This means that your edits will persist to CocoaPods
|
|
102
|
+
# installations.
|
|
103
|
+
#
|
|
104
|
+
# The referenced folder can be a checkout of your your favorite SCM or
|
|
105
|
+
# even a git submodule of the current repo.
|
|
106
|
+
#
|
|
107
|
+
# Note that the `podspec` of the Pod file is expected to be in the
|
|
108
|
+
# folder.
|
|
109
|
+
#
|
|
110
|
+
#
|
|
91
111
|
# ### From a podspec in the root of a library repo.
|
|
92
112
|
#
|
|
93
113
|
# Sometimes you may want to use the bleeding edge version of a Pod. Or a
|
|
@@ -103,16 +123,9 @@ module Pod
|
|
|
103
123
|
#
|
|
104
124
|
# pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :commit => '082f8319af'
|
|
105
125
|
#
|
|
106
|
-
#
|
|
107
|
-
# Or specify a local folder in the machine:
|
|
108
|
-
#
|
|
109
|
-
# pod 'AFNetworking', :local => '~/Documents/AFNetworking'
|
|
110
|
-
#
|
|
111
|
-
#
|
|
112
126
|
# It is important to note, though, that this means that the version will
|
|
113
127
|
# have to satisfy any other dependencies on the Pod by other Pods.
|
|
114
128
|
#
|
|
115
|
-
#
|
|
116
129
|
# The `podspec` file is expected to be in the root of the repo, if this
|
|
117
130
|
# library does not have a `podspec` file in its repo yet, you will have
|
|
118
131
|
# to use one of the approaches outlined in the sections below.
|
|
@@ -125,6 +138,7 @@ module Pod
|
|
|
125
138
|
#
|
|
126
139
|
# pod 'JSONKit', :podspec => 'https://raw.github.com/gist/1346394/1d26570f68ca27377a27430c65841a0880395d72/JSONKit.podspec'
|
|
127
140
|
#
|
|
141
|
+
#
|
|
128
142
|
# @note This method allow a nil name and the raises to be more
|
|
129
143
|
# informative.
|
|
130
144
|
#
|
|
@@ -351,6 +365,11 @@ module Pod
|
|
|
351
365
|
#
|
|
352
366
|
# This attribute is inherited by child target definitions.
|
|
353
367
|
#
|
|
368
|
+
# If you would like to inhibit warnings per Pod you can use the
|
|
369
|
+
# following syntax:
|
|
370
|
+
#
|
|
371
|
+
# pod 'SSZipArchive', :inhibit_warnings => true
|
|
372
|
+
#
|
|
354
373
|
def inhibit_all_warnings!
|
|
355
374
|
current_target_definition.inhibit_all_warnings = true
|
|
356
375
|
end
|
|
@@ -267,15 +267,19 @@ module Pod
|
|
|
267
267
|
|
|
268
268
|
#--------------------------------------#
|
|
269
269
|
|
|
270
|
-
# @return [Bool] whether the target definition should
|
|
271
|
-
#
|
|
270
|
+
# @return [Bool] whether the target definition should inhibit warnings
|
|
271
|
+
# for a single pod. If inhibit_all_warnings is true, it will
|
|
272
|
+
# return true for any asked pod.
|
|
272
273
|
#
|
|
273
|
-
def
|
|
274
|
-
|
|
274
|
+
def inhibits_warnings_for_pod?(pod_name)
|
|
275
|
+
return true if inhibit_warnings_hash['all'] || (parent.inhibits_warnings_for_pod?(name) unless root?)
|
|
276
|
+
|
|
277
|
+
inhibit_warnings_hash['for_pods'] ||= []
|
|
278
|
+
inhibit_warnings_hash['for_pods'].include? pod_name
|
|
275
279
|
end
|
|
276
280
|
|
|
277
281
|
# Sets whether the target definition should inhibit the warnings during
|
|
278
|
-
# compilation.
|
|
282
|
+
# compilation for all pods.
|
|
279
283
|
#
|
|
280
284
|
# @param [Bool] flag
|
|
281
285
|
# Whether the warnings should be suppressed.
|
|
@@ -283,7 +287,19 @@ module Pod
|
|
|
283
287
|
# @return [void]
|
|
284
288
|
#
|
|
285
289
|
def inhibit_all_warnings=(flag)
|
|
286
|
-
|
|
290
|
+
inhibit_warnings_hash['all'] = flag
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
# Inhibits warnings for a specific pod during compilation.
|
|
294
|
+
#
|
|
295
|
+
# @param [String] pod name
|
|
296
|
+
# Whether the warnings should be suppressed.
|
|
297
|
+
#
|
|
298
|
+
# @return [void]
|
|
299
|
+
#
|
|
300
|
+
def inhibit_warnings_for_pod(pod_name)
|
|
301
|
+
inhibit_warnings_hash['for_pods'] ||= []
|
|
302
|
+
inhibit_warnings_hash['for_pods'] << pod_name
|
|
287
303
|
end
|
|
288
304
|
|
|
289
305
|
#--------------------------------------#
|
|
@@ -354,11 +370,14 @@ module Pod
|
|
|
354
370
|
# @return [void]
|
|
355
371
|
#
|
|
356
372
|
def store_pod(name, *requirements)
|
|
373
|
+
parse_inhibit_warnings(name, requirements)
|
|
374
|
+
|
|
357
375
|
if requirements && !requirements.empty?
|
|
358
376
|
pod = { name => requirements }
|
|
359
377
|
else
|
|
360
378
|
pod = name
|
|
361
379
|
end
|
|
380
|
+
|
|
362
381
|
get_hash_value('dependencies', []) << pod
|
|
363
382
|
end
|
|
364
383
|
|
|
@@ -406,7 +425,7 @@ module Pod
|
|
|
406
425
|
'exclusive',
|
|
407
426
|
'link_with',
|
|
408
427
|
'link_with_first_target',
|
|
409
|
-
'
|
|
428
|
+
'inhibit_warnings',
|
|
410
429
|
'user_project_path',
|
|
411
430
|
'build_configurations',
|
|
412
431
|
'dependencies',
|
|
@@ -491,6 +510,16 @@ module Pod
|
|
|
491
510
|
internal_hash[key] ||= base_value
|
|
492
511
|
end
|
|
493
512
|
|
|
513
|
+
# Returns the inhibit_warnings hash prepopulated with default values
|
|
514
|
+
#
|
|
515
|
+
# @return [Hash<String, Array>] Hash with :all key for inhibiting all warnings,
|
|
516
|
+
# and :for_pods key for inhibiting warnings per pod
|
|
517
|
+
#
|
|
518
|
+
def inhibit_warnings_hash
|
|
519
|
+
get_hash_value('inhibit_warnings', {})
|
|
520
|
+
end
|
|
521
|
+
|
|
522
|
+
|
|
494
523
|
# @return [Array<Dependency>] The dependencies specified by the user for
|
|
495
524
|
# this target definition.
|
|
496
525
|
#
|
|
@@ -547,6 +576,27 @@ module Pod
|
|
|
547
576
|
end
|
|
548
577
|
end
|
|
549
578
|
|
|
579
|
+
# Removes :inhibit_warnings from the requirements list, and adds
|
|
580
|
+
# the pod's name into internal hash for disabling warnings.
|
|
581
|
+
#
|
|
582
|
+
# @param [String] pod name
|
|
583
|
+
#
|
|
584
|
+
# @param [Array] requirements
|
|
585
|
+
# If :inhibit_warnings is the only key in the hash, the hash
|
|
586
|
+
# should be destroyed because it confuses Gem::Dependency.
|
|
587
|
+
#
|
|
588
|
+
# @return [void]
|
|
589
|
+
#
|
|
590
|
+
def parse_inhibit_warnings(name, requirements)
|
|
591
|
+
options = requirements.last
|
|
592
|
+
return requirements unless options.is_a?(Hash)
|
|
593
|
+
|
|
594
|
+
should_inhibit = options.delete(:inhibit_warnings)
|
|
595
|
+
inhibit_warnings_for_pod(name) if should_inhibit
|
|
596
|
+
|
|
597
|
+
requirements.pop if options.empty?
|
|
598
|
+
end
|
|
599
|
+
|
|
550
600
|
#-----------------------------------------------------------------------#
|
|
551
601
|
|
|
552
602
|
end
|
|
@@ -10,6 +10,66 @@ module Pod
|
|
|
10
10
|
# the Dependency class.
|
|
11
11
|
#
|
|
12
12
|
class Requirement < Pod::Vendor::Gem::Requirement
|
|
13
|
+
|
|
14
|
+
quoted_operators = OPS.keys.map { |k| Regexp.quote k }.join "|"
|
|
15
|
+
|
|
16
|
+
# @return [Regexp] The regular expression used to validate input strings.
|
|
17
|
+
#
|
|
18
|
+
PATTERN = /\A\s*(#{quoted_operators})?\s*(#{Version::VERSION_PATTERN})\s*\z/
|
|
19
|
+
|
|
20
|
+
#-------------------------------------------------------------------------#
|
|
21
|
+
|
|
22
|
+
# Factory method to create a new requirement.
|
|
23
|
+
#
|
|
24
|
+
# @param [Requirement, Version, Array<Version>, String, Nil] input
|
|
25
|
+
# The input used to create the requirement.
|
|
26
|
+
#
|
|
27
|
+
# @return [Requirement] A new requirement.
|
|
28
|
+
#
|
|
29
|
+
def self.create(input)
|
|
30
|
+
case input
|
|
31
|
+
when Requirement
|
|
32
|
+
input
|
|
33
|
+
when Version, Array
|
|
34
|
+
new(input)
|
|
35
|
+
else
|
|
36
|
+
if input.respond_to? :to_str
|
|
37
|
+
new([input.to_str])
|
|
38
|
+
else
|
|
39
|
+
default
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# @return [Requirement] The default requirement.
|
|
45
|
+
#
|
|
46
|
+
def self.default
|
|
47
|
+
new('>= 0')
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Parses the given object returning an tuple where the first entry is an
|
|
51
|
+
# operator and the second a version. If not operator is provided it
|
|
52
|
+
# defaults to `=`.
|
|
53
|
+
#
|
|
54
|
+
# @param [String, Version] input
|
|
55
|
+
# The input passed to create the requirement.
|
|
56
|
+
#
|
|
57
|
+
# @return [Array] A tuple representing the requirement.
|
|
58
|
+
#
|
|
59
|
+
def self.parse(input)
|
|
60
|
+
return ["=", input] if input.is_a?(Version)
|
|
61
|
+
|
|
62
|
+
unless PATTERN =~ input.to_s
|
|
63
|
+
raise ArgumentError, "Illformed requirement `#{input.inspect}`"
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
operator = $1 || "="
|
|
67
|
+
version = Version.new($2)
|
|
68
|
+
[operator, version]
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
#-------------------------------------------------------------------------#
|
|
72
|
+
|
|
13
73
|
end
|
|
14
74
|
|
|
15
75
|
end
|
|
@@ -29,7 +29,7 @@ module Pod
|
|
|
29
29
|
# @return [String] the name of the source.
|
|
30
30
|
#
|
|
31
31
|
def name
|
|
32
|
-
|
|
32
|
+
repo.basename.to_s
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
alias_method :to_s, :name
|
|
@@ -53,7 +53,7 @@ module Pod
|
|
|
53
53
|
# @return [Array<String>] the list of the name of all the Pods.
|
|
54
54
|
#
|
|
55
55
|
def pods
|
|
56
|
-
|
|
56
|
+
specs_dir.children.map do |child|
|
|
57
57
|
child.basename.to_s if child.directory? && child.basename.to_s != '.git'
|
|
58
58
|
end.compact
|
|
59
59
|
end
|
|
@@ -71,7 +71,7 @@ module Pod
|
|
|
71
71
|
# the name of the Pod.
|
|
72
72
|
#
|
|
73
73
|
def versions(name)
|
|
74
|
-
pod_dir =
|
|
74
|
+
pod_dir = specs_dir + name
|
|
75
75
|
return unless pod_dir.exist?
|
|
76
76
|
pod_dir.children.map do |v|
|
|
77
77
|
basename = v.basename.to_s
|
|
@@ -98,7 +98,7 @@ module Pod
|
|
|
98
98
|
# @return [Pathname] The path of the specification.
|
|
99
99
|
#
|
|
100
100
|
def specification_path(name, version)
|
|
101
|
-
path =
|
|
101
|
+
path = specs_dir + name + version.to_s
|
|
102
102
|
specification_path = path + "#{name}.podspec.yaml"
|
|
103
103
|
unless specification_path.exist?
|
|
104
104
|
specification_path = path + "#{name}.podspec"
|
|
@@ -194,6 +194,31 @@ module Pod
|
|
|
194
194
|
to_hash.to_yaml
|
|
195
195
|
end
|
|
196
196
|
|
|
197
|
+
private
|
|
198
|
+
|
|
199
|
+
#-------------------------------------------------------------------------#
|
|
200
|
+
|
|
201
|
+
# @group Private Helpers
|
|
202
|
+
|
|
203
|
+
# @return [Pathname] The directory where the specs are stored.
|
|
204
|
+
#
|
|
205
|
+
# @note In previous versions of CocoaPods they used to be stored in
|
|
206
|
+
# the root of the repo. This lead to issues, especially with
|
|
207
|
+
# the GitHub interface and now the are stored in a dedicated
|
|
208
|
+
# folder.
|
|
209
|
+
#
|
|
210
|
+
def specs_dir
|
|
211
|
+
unless @specs_dir
|
|
212
|
+
specs_sub_dir = repo + 'Specs'
|
|
213
|
+
if repo.children.include?(specs_sub_dir)
|
|
214
|
+
@specs_dir = repo + 'Specs'
|
|
215
|
+
else
|
|
216
|
+
@specs_dir = repo
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
@specs_dir
|
|
220
|
+
end
|
|
221
|
+
|
|
197
222
|
#-------------------------------------------------------------------------#
|
|
198
223
|
|
|
199
224
|
end
|
|
@@ -111,7 +111,7 @@ module Pod
|
|
|
111
111
|
#
|
|
112
112
|
def check_spec_path(name, version, spec)
|
|
113
113
|
unless spec.name == name && spec.version.to_s == version.to_s
|
|
114
|
-
report.add_message(:error, "Incorrect path", name, spec.version)
|
|
114
|
+
report.add_message(:error, "Incorrect path #{ spec.defined_in_file }", name, spec.version)
|
|
115
115
|
end
|
|
116
116
|
end
|
|
117
117
|
|
|
@@ -21,9 +21,33 @@ module Pod
|
|
|
21
21
|
# without loss of information.
|
|
22
22
|
#
|
|
23
23
|
def safe_to_hash?
|
|
24
|
-
pre_install_callback.nil? && post_install_callback.nil?
|
|
24
|
+
!has_file_list(self) && pre_install_callback.nil? && post_install_callback.nil?
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
# @return [Bool] If any of the specs uses the FileList class.
|
|
28
|
+
#
|
|
29
|
+
def has_file_list(spec)
|
|
30
|
+
result = false
|
|
31
|
+
all_specs = [ spec, *spec.recursive_subspecs ]
|
|
32
|
+
all_specs.each do |current_spec|
|
|
33
|
+
current_spec.available_platforms.each do |platform|
|
|
34
|
+
consumer = Specification::Consumer.new(current_spec, platform)
|
|
35
|
+
attributes = DSL.attributes.values.select(&:file_patterns?)
|
|
36
|
+
attributes.each do |attrb|
|
|
37
|
+
patterns = consumer.send(attrb.name)
|
|
38
|
+
if patterns.is_a?(Hash)
|
|
39
|
+
patterns = patterns.values.flatten(1)
|
|
40
|
+
end
|
|
41
|
+
patterns.each do |pattern|
|
|
42
|
+
if pattern.is_a?(Rake::FileList)
|
|
43
|
+
result = true
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
result
|
|
50
|
+
end
|
|
27
51
|
end
|
|
28
52
|
|
|
29
53
|
# Configures a new specification from the given hash.
|
|
@@ -39,7 +63,7 @@ module Pod
|
|
|
39
63
|
subspecs = attributes_hash.delete('subspecs')
|
|
40
64
|
spec.attributes_hash = attributes_hash
|
|
41
65
|
if subspecs
|
|
42
|
-
spec.subspecs = subspecs.map { |
|
|
66
|
+
spec.subspecs = subspecs.map { |s_hash| Specification.from_hash(s_hash) }
|
|
43
67
|
end
|
|
44
68
|
spec
|
|
45
69
|
end
|
|
@@ -22,11 +22,10 @@ module Pod
|
|
|
22
22
|
|
|
23
23
|
require 'cocoapods-core/vendor/version'
|
|
24
24
|
require 'cocoapods-core/vendor/requirement'
|
|
25
|
-
require 'cocoapods-core/vendor/dependency'
|
|
26
25
|
|
|
27
26
|
#-----------------------------------------------------------------------#
|
|
28
27
|
# RubyGems License #
|
|
29
|
-
# https://github.com/rubygems/rubygems/blob/master/MIT.txt
|
|
28
|
+
# https://github.com/rubygems/rubygems/blob/master/MIT.txt #
|
|
30
29
|
#-----------------------------------------------------------------------#
|
|
31
30
|
|
|
32
31
|
# Copyright (c) Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
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: 0.
|
|
4
|
+
version: 0.18.0
|
|
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: 2013-04-
|
|
12
|
+
date: 2013-04-08 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|
|
@@ -119,7 +119,6 @@ files:
|
|
|
119
119
|
- lib/cocoapods-core/specification/yaml.rb
|
|
120
120
|
- lib/cocoapods-core/specification.rb
|
|
121
121
|
- lib/cocoapods-core/standard_error.rb
|
|
122
|
-
- lib/cocoapods-core/vendor/dependency.rb
|
|
123
122
|
- lib/cocoapods-core/vendor/requirement.rb
|
|
124
123
|
- lib/cocoapods-core/vendor/version.rb
|
|
125
124
|
- lib/cocoapods-core/vendor.rb
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
module Pod::Vendor
|
|
2
|
-
|
|
3
|
-
# require "rubygems/requirement"
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
# The Dependency class holds a Gem name and a Gem::Requirement.
|
|
7
|
-
|
|
8
|
-
class Gem::Dependency
|
|
9
|
-
|
|
10
|
-
##
|
|
11
|
-
# Valid dependency types.
|
|
12
|
-
#--
|
|
13
|
-
# When this list is updated, be sure to change
|
|
14
|
-
# Gem::Specification::CURRENT_SPECIFICATION_VERSION as well.
|
|
15
|
-
|
|
16
|
-
TYPES = [
|
|
17
|
-
:development,
|
|
18
|
-
:runtime,
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
##
|
|
22
|
-
# Dependency name or regular expression.
|
|
23
|
-
|
|
24
|
-
attr_accessor :name
|
|
25
|
-
|
|
26
|
-
##
|
|
27
|
-
# Allows you to force this dependency to be a prerelease.
|
|
28
|
-
|
|
29
|
-
attr_writer :prerelease
|
|
30
|
-
|
|
31
|
-
##
|
|
32
|
-
# Constructs a dependency with +name+ and +requirements+. The last
|
|
33
|
-
# argument can optionally be the dependency type, which defaults to
|
|
34
|
-
# <tt>:runtime</tt>.
|
|
35
|
-
|
|
36
|
-
def initialize name, *requirements
|
|
37
|
-
if Regexp === name then
|
|
38
|
-
msg = ["NOTE: Dependency.new w/ a regexp is deprecated.",
|
|
39
|
-
"Dependency.new called from #{Gem.location_of_caller.join(":")}"]
|
|
40
|
-
warn msg.join("\n") unless Gem::Deprecate.skip
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
type = Symbol === requirements.last ? requirements.pop : :runtime
|
|
44
|
-
requirements = requirements.first if 1 == requirements.length # unpack
|
|
45
|
-
|
|
46
|
-
unless TYPES.include? type
|
|
47
|
-
raise ArgumentError, "Valid types are #{TYPES.inspect}, "
|
|
48
|
-
+ "not #{type.inspect}"
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
@name = name
|
|
52
|
-
@requirement = Gem::Requirement.create requirements
|
|
53
|
-
@type = type
|
|
54
|
-
@prerelease = false
|
|
55
|
-
|
|
56
|
-
# This is for Marshal backwards compatibility. See the comments in
|
|
57
|
-
# +requirement+ for the dirty details.
|
|
58
|
-
|
|
59
|
-
@version_requirements = @requirement
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
##
|
|
63
|
-
# A dependency's hash is the XOR of the hashes of +name+, +type+,
|
|
64
|
-
# and +requirement+.
|
|
65
|
-
|
|
66
|
-
def hash # :nodoc:
|
|
67
|
-
name.hash ^ type.hash ^ requirement.hash
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def inspect # :nodoc:
|
|
71
|
-
"<%s type=%p name=%p requirements=%p>" %
|
|
72
|
-
[self.class, self.type, self.name, requirement.to_s]
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
##
|
|
76
|
-
# Does this dependency require a prerelease?
|
|
77
|
-
|
|
78
|
-
def prerelease?
|
|
79
|
-
@prerelease || requirement.prerelease?
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def pretty_print q # :nodoc:
|
|
83
|
-
q.group 1, 'Gem::Dependency.new(', ')' do
|
|
84
|
-
q.pp name
|
|
85
|
-
q.text ','
|
|
86
|
-
q.breakable
|
|
87
|
-
|
|
88
|
-
q.pp requirement
|
|
89
|
-
|
|
90
|
-
q.text ','
|
|
91
|
-
q.breakable
|
|
92
|
-
|
|
93
|
-
q.pp type
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
##
|
|
98
|
-
# What does this dependency require?
|
|
99
|
-
|
|
100
|
-
def requirement
|
|
101
|
-
return @requirement if defined?(@requirement) and @requirement
|
|
102
|
-
|
|
103
|
-
# @version_requirements and @version_requirement are legacy ivar
|
|
104
|
-
# names, and supported here because older gems need to keep
|
|
105
|
-
# working and Dependency doesn't implement marshal_dump and
|
|
106
|
-
# marshal_load. In a happier world, this would be an
|
|
107
|
-
# attr_accessor. The horrifying instance_variable_get you see
|
|
108
|
-
# below is also the legacy of some old restructurings.
|
|
109
|
-
#
|
|
110
|
-
# Note also that because of backwards compatibility (loading new
|
|
111
|
-
# gems in an old RubyGems installation), we can't add explicit
|
|
112
|
-
# marshaling to this class until we want to make a big
|
|
113
|
-
# break. Maybe 2.0.
|
|
114
|
-
#
|
|
115
|
-
# Children, define explicit marshal and unmarshal behavior for
|
|
116
|
-
# public classes. Marshal formats are part of your public API.
|
|
117
|
-
|
|
118
|
-
if defined?(@version_requirement) && @version_requirement
|
|
119
|
-
version = @version_requirement.instance_variable_get :@version
|
|
120
|
-
@version_requirement = nil
|
|
121
|
-
@version_requirements = Gem::Requirement.new version
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
@requirement = @version_requirements if defined?(@version_requirements)
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
def requirements_list
|
|
128
|
-
requirement.as_list
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
def to_s # :nodoc:
|
|
132
|
-
if type != :runtime then
|
|
133
|
-
"#{name} (#{requirement}, #{type})"
|
|
134
|
-
else
|
|
135
|
-
"#{name} (#{requirement})"
|
|
136
|
-
end
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
##
|
|
140
|
-
# Dependency type.
|
|
141
|
-
|
|
142
|
-
def type
|
|
143
|
-
@type ||= :runtime
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
def == other # :nodoc:
|
|
147
|
-
Gem::Dependency === other &&
|
|
148
|
-
self.name == other.name &&
|
|
149
|
-
self.type == other.type &&
|
|
150
|
-
self.requirement == other.requirement
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
##
|
|
154
|
-
# Dependencies are ordered by name.
|
|
155
|
-
|
|
156
|
-
def <=> other
|
|
157
|
-
self.name <=> other.name
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
##
|
|
161
|
-
# Uses this dependency as a pattern to compare to +other+. This
|
|
162
|
-
# dependency will match if the name matches the other's name, and
|
|
163
|
-
# other has only an equal version requirement that satisfies this
|
|
164
|
-
# dependency.
|
|
165
|
-
|
|
166
|
-
def =~ other
|
|
167
|
-
unless Gem::Dependency === other
|
|
168
|
-
return unless other.respond_to?(:name) && other.respond_to?(:version)
|
|
169
|
-
other = Gem::Dependency.new other.name, other.version
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
return false unless name === other.name
|
|
173
|
-
|
|
174
|
-
reqs = other.requirement.requirements
|
|
175
|
-
|
|
176
|
-
return false unless reqs.length == 1
|
|
177
|
-
return false unless reqs.first.first == '='
|
|
178
|
-
|
|
179
|
-
version = reqs.first.last
|
|
180
|
-
|
|
181
|
-
requirement.satisfied_by? version
|
|
182
|
-
end
|
|
183
|
-
|
|
184
|
-
def match? name, version
|
|
185
|
-
return false unless self.name === name
|
|
186
|
-
return true if requirement.none?
|
|
187
|
-
|
|
188
|
-
requirement.satisfied_by? Gem::Version.new(version)
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
def matches_spec? spec
|
|
192
|
-
return false unless name === spec.name
|
|
193
|
-
return true if requirement.none?
|
|
194
|
-
|
|
195
|
-
requirement.satisfied_by?(spec.version)
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
##
|
|
199
|
-
# Merges the requirements of +other+ into this dependency
|
|
200
|
-
|
|
201
|
-
def merge other
|
|
202
|
-
unless name == other.name then
|
|
203
|
-
raise ArgumentError,
|
|
204
|
-
"#{self} and #{other} have different names"
|
|
205
|
-
end
|
|
206
|
-
|
|
207
|
-
default = Gem::Requirement.default
|
|
208
|
-
self_req = self.requirement
|
|
209
|
-
other_req = other.requirement
|
|
210
|
-
|
|
211
|
-
return self.class.new name, self_req if other_req == default
|
|
212
|
-
return self.class.new name, other_req if self_req == default
|
|
213
|
-
|
|
214
|
-
self.class.new name, self_req.as_list.concat(other_req.as_list)
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
def matching_specs platform_only = false
|
|
218
|
-
matches = Gem::Specification.find_all { |spec|
|
|
219
|
-
self.name === spec.name and # TODO: == instead of ===
|
|
220
|
-
requirement.satisfied_by? spec.version
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
if platform_only
|
|
224
|
-
matches.reject! { |spec|
|
|
225
|
-
not Gem::Platform.match spec.platform
|
|
226
|
-
}
|
|
227
|
-
end
|
|
228
|
-
|
|
229
|
-
matches = matches.sort_by { |s| s.sort_obj } # HACK: shouldn't be needed
|
|
230
|
-
end
|
|
231
|
-
|
|
232
|
-
##
|
|
233
|
-
# True if the dependency will not always match the latest version.
|
|
234
|
-
|
|
235
|
-
def specific?
|
|
236
|
-
@requirement.specific?
|
|
237
|
-
end
|
|
238
|
-
|
|
239
|
-
def to_specs
|
|
240
|
-
matches = matching_specs true
|
|
241
|
-
|
|
242
|
-
# TODO: check Gem.activated_spec[self.name] in case matches falls outside
|
|
243
|
-
|
|
244
|
-
if matches.empty? then
|
|
245
|
-
specs = Gem::Specification.all_names.join ", "
|
|
246
|
-
error = Gem::LoadError.new "Could not find #{name} (#{requirement}) amongst [#{specs}]"
|
|
247
|
-
error.name = self.name
|
|
248
|
-
error.requirement = self.requirement
|
|
249
|
-
raise error
|
|
250
|
-
end
|
|
251
|
-
|
|
252
|
-
# TODO: any other resolver validations should go here
|
|
253
|
-
|
|
254
|
-
matches
|
|
255
|
-
end
|
|
256
|
-
|
|
257
|
-
def to_spec
|
|
258
|
-
matches = self.to_specs
|
|
259
|
-
|
|
260
|
-
matches.find { |spec| spec.activated? } or matches.last
|
|
261
|
-
end
|
|
262
|
-
end
|
|
263
|
-
|
|
264
|
-
end
|