cocoapods-core 0.30.0 → 1.15.2
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 +5 -5
- data/README.md +7 -10
- data/lib/cocoapods-core/build_type.rb +121 -0
- data/lib/cocoapods-core/cdn_source.rb +501 -0
- data/lib/cocoapods-core/core_ui.rb +4 -3
- data/lib/cocoapods-core/dependency.rb +100 -73
- data/lib/cocoapods-core/gem_version.rb +1 -2
- data/lib/cocoapods-core/github.rb +32 -5
- data/lib/cocoapods-core/http.rb +86 -0
- data/lib/cocoapods-core/lockfile.rb +161 -56
- data/lib/cocoapods-core/metrics.rb +47 -0
- data/lib/cocoapods-core/platform.rb +99 -11
- data/lib/cocoapods-core/podfile/dsl.rb +623 -124
- data/lib/cocoapods-core/podfile/target_definition.rb +662 -109
- data/lib/cocoapods-core/podfile.rb +138 -65
- data/lib/cocoapods-core/requirement.rb +37 -8
- data/lib/cocoapods-core/source/acceptor.rb +16 -13
- data/lib/cocoapods-core/source/aggregate.rb +79 -103
- data/lib/cocoapods-core/source/health_reporter.rb +9 -18
- data/lib/cocoapods-core/source/manager.rb +488 -0
- data/lib/cocoapods-core/source/metadata.rb +79 -0
- data/lib/cocoapods-core/source.rb +241 -70
- data/lib/cocoapods-core/specification/consumer.rb +187 -47
- data/lib/cocoapods-core/specification/dsl/attribute.rb +49 -85
- data/lib/cocoapods-core/specification/dsl/attribute_support.rb +6 -8
- data/lib/cocoapods-core/specification/dsl/deprecations.rb +9 -126
- data/lib/cocoapods-core/specification/dsl/platform_proxy.rb +30 -20
- data/lib/cocoapods-core/specification/dsl.rb +943 -296
- data/lib/cocoapods-core/specification/json.rb +64 -23
- data/lib/cocoapods-core/specification/linter/analyzer.rb +218 -0
- data/lib/cocoapods-core/specification/linter/result.rb +128 -0
- data/lib/cocoapods-core/specification/linter.rb +310 -309
- data/lib/cocoapods-core/specification/root_attribute_accessors.rb +90 -39
- data/lib/cocoapods-core/specification/set/presenter.rb +35 -71
- data/lib/cocoapods-core/specification/set.rb +42 -96
- data/lib/cocoapods-core/specification.rb +368 -130
- data/lib/cocoapods-core/standard_error.rb +45 -24
- data/lib/cocoapods-core/trunk_source.rb +14 -0
- data/lib/cocoapods-core/vendor/requirement.rb +133 -53
- data/lib/cocoapods-core/vendor/version.rb +197 -156
- data/lib/cocoapods-core/vendor.rb +1 -5
- data/lib/cocoapods-core/version.rb +137 -42
- data/lib/cocoapods-core/yaml_helper.rb +334 -0
- data/lib/cocoapods-core.rb +10 -4
- metadata +100 -27
- data/lib/cocoapods-core/source/abstract_data_provider.rb +0 -71
- data/lib/cocoapods-core/source/file_system_data_provider.rb +0 -150
- data/lib/cocoapods-core/source/github_data_provider.rb +0 -143
- data/lib/cocoapods-core/specification/set/statistics.rb +0 -266
- data/lib/cocoapods-core/yaml_converter.rb +0 -192
@@ -2,18 +2,15 @@ require 'cocoapods-core/podfile/dsl'
|
|
2
2
|
require 'cocoapods-core/podfile/target_definition'
|
3
3
|
|
4
4
|
module Pod
|
5
|
-
|
6
5
|
# The Podfile is a specification that describes the dependencies of the
|
7
6
|
# targets of an Xcode project.
|
8
7
|
#
|
9
|
-
# It supports its own DSL and
|
10
|
-
# `CocoaPods.podfile` or `Podfile`.
|
8
|
+
# It supports its own DSL and is stored in a file named `Podfile`.
|
11
9
|
#
|
12
|
-
# The Podfile creates a hierarchy of target definitions that
|
13
|
-
# information
|
10
|
+
# The Podfile creates a hierarchy of target definitions that store the
|
11
|
+
# information necessary to generate the CocoaPods libraries.
|
14
12
|
#
|
15
13
|
class Podfile
|
16
|
-
|
17
14
|
# @!group DSL support
|
18
15
|
|
19
16
|
include Pod::Podfile::DSL
|
@@ -24,8 +21,8 @@ module Pod
|
|
24
21
|
|
25
22
|
#-------------------------------------------------------------------------#
|
26
23
|
|
27
|
-
# @return [Pathname] the path
|
28
|
-
# if the
|
24
|
+
# @return [Pathname] the path used to load the Podfile. It is nil
|
25
|
+
# if the Podfile was generated programmatically.
|
29
26
|
#
|
30
27
|
attr_accessor :defined_in_file
|
31
28
|
|
@@ -33,7 +30,7 @@ module Pod
|
|
33
30
|
# the path of the podfile.
|
34
31
|
#
|
35
32
|
# @param [Proc] block
|
36
|
-
# an optional block that configures the
|
33
|
+
# an optional block that configures the Podfile through the DSL.
|
37
34
|
#
|
38
35
|
# @example Creating a Podfile.
|
39
36
|
#
|
@@ -46,8 +43,8 @@ module Pod
|
|
46
43
|
self.defined_in_file = defined_in_file
|
47
44
|
@internal_hash = internal_hash
|
48
45
|
if block
|
49
|
-
default_target_def = TargetDefinition.new(
|
50
|
-
default_target_def.
|
46
|
+
default_target_def = TargetDefinition.new('Pods', self)
|
47
|
+
default_target_def.abstract = true
|
51
48
|
@root_target_definitions = [default_target_def]
|
52
49
|
@current_target_definition = default_target_def
|
53
50
|
instance_eval(&block)
|
@@ -60,31 +57,33 @@ module Pod
|
|
60
57
|
# presented to the user.
|
61
58
|
#
|
62
59
|
def to_s
|
63
|
-
|
60
|
+
'Podfile'
|
64
61
|
end
|
65
62
|
|
66
63
|
#-------------------------------------------------------------------------#
|
67
64
|
|
68
65
|
public
|
69
66
|
|
70
|
-
# @!group Working with a
|
67
|
+
# @!group Working with a Podfile
|
71
68
|
|
72
69
|
# @return [Hash{Symbol,String => TargetDefinition}] the target definitions
|
73
|
-
# of the
|
70
|
+
# of the Podfile stored by their name.
|
74
71
|
#
|
75
72
|
def target_definitions
|
76
73
|
Hash[target_definition_list.map { |td| [td.name, td] }]
|
77
74
|
end
|
78
75
|
|
76
|
+
# @return [Array<TargetDefinition>] all target definitions in the Podfile.
|
77
|
+
#
|
79
78
|
def target_definition_list
|
80
79
|
root_target_definitions.map { |td| [td, td.recursive_children] }.flatten
|
81
80
|
end
|
82
81
|
|
83
|
-
# @return [Array<TargetDefinition>] The root target
|
82
|
+
# @return [Array<TargetDefinition>] The root target definitions.
|
84
83
|
#
|
85
84
|
attr_accessor :root_target_definitions
|
86
85
|
|
87
|
-
# @return [Array<Dependency>] the dependencies of
|
86
|
+
# @return [Array<Dependency>] the dependencies of all of the target
|
88
87
|
# definitions.
|
89
88
|
#
|
90
89
|
def dependencies
|
@@ -97,6 +96,18 @@ module Pod
|
|
97
96
|
|
98
97
|
# @!group Attributes
|
99
98
|
|
99
|
+
# @return [Array<String>] The names of the sources.
|
100
|
+
#
|
101
|
+
def sources
|
102
|
+
get_hash_value('sources') || []
|
103
|
+
end
|
104
|
+
|
105
|
+
# @return [Hash<String, Hash>] The plugins, keyed by name.
|
106
|
+
#
|
107
|
+
def plugins
|
108
|
+
get_hash_value('plugins') || {}
|
109
|
+
end
|
110
|
+
|
100
111
|
# @return [String] the path of the workspace if specified by the user.
|
101
112
|
#
|
102
113
|
def workspace_path
|
@@ -110,20 +121,28 @@ module Pod
|
|
110
121
|
end
|
111
122
|
end
|
112
123
|
|
113
|
-
# @return [
|
124
|
+
# @return [Boolean] whether the podfile should generate a BridgeSupport
|
114
125
|
# metadata document.
|
115
126
|
#
|
116
127
|
def generate_bridge_support?
|
117
128
|
get_hash_value('generate_bridge_support')
|
118
129
|
end
|
119
130
|
|
120
|
-
# @return [
|
131
|
+
# @return [Boolean] whether the -fobjc-arc flag should be added to the
|
121
132
|
# OTHER_LD_FLAGS.
|
122
133
|
#
|
123
134
|
def set_arc_compatibility_flag?
|
124
135
|
get_hash_value('set_arc_compatibility_flag')
|
125
136
|
end
|
126
137
|
|
138
|
+
# @return [(String,Hash)] the installation strategy and installation options
|
139
|
+
# to be used during installation.
|
140
|
+
#
|
141
|
+
def installation_method
|
142
|
+
get_hash_value('installation_method', 'name' => 'cocoapods', 'options' => {}).
|
143
|
+
values_at('name', 'options')
|
144
|
+
end
|
145
|
+
|
127
146
|
#-------------------------------------------------------------------------#
|
128
147
|
|
129
148
|
public
|
@@ -135,7 +154,7 @@ module Pod
|
|
135
154
|
# @param [Pod::Installer] installer
|
136
155
|
# the installer that is performing the installation.
|
137
156
|
#
|
138
|
-
# @return [
|
157
|
+
# @return [Boolean] whether a pre install callback was specified and it was
|
139
158
|
# called.
|
140
159
|
#
|
141
160
|
def pre_install!(installer)
|
@@ -147,12 +166,29 @@ module Pod
|
|
147
166
|
end
|
148
167
|
end
|
149
168
|
|
169
|
+
# Calls the pre integrate callback if defined.
|
170
|
+
#
|
171
|
+
# @param [Pod::Installer] installer
|
172
|
+
# the installer that is performing the installation.
|
173
|
+
#
|
174
|
+
# @return [Boolean] whether a pre integrate callback was specified and it was
|
175
|
+
# called.
|
176
|
+
#
|
177
|
+
def pre_integrate!(installer)
|
178
|
+
if @pre_integrate_callback
|
179
|
+
@pre_integrate_callback.call(installer)
|
180
|
+
true
|
181
|
+
else
|
182
|
+
false
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
150
186
|
# Calls the post install callback if defined.
|
151
187
|
#
|
152
188
|
# @param [Pod::Installer] installer
|
153
189
|
# the installer that is performing the installation.
|
154
190
|
#
|
155
|
-
# @return [
|
191
|
+
# @return [Boolean] whether a post install callback was specified and it was
|
156
192
|
# called.
|
157
193
|
#
|
158
194
|
def post_install!(installer)
|
@@ -164,6 +200,23 @@ module Pod
|
|
164
200
|
end
|
165
201
|
end
|
166
202
|
|
203
|
+
# Calls the post integrate callback if defined.
|
204
|
+
#
|
205
|
+
# @param [Pod::Installer] installer
|
206
|
+
# the installer that is performing the installation.
|
207
|
+
#
|
208
|
+
# @return [Boolean] whether a post install callback was specified and it was
|
209
|
+
# called.
|
210
|
+
#
|
211
|
+
def post_integrate!(installer)
|
212
|
+
if @post_integrate_callback
|
213
|
+
@post_integrate_callback.call(installer)
|
214
|
+
true
|
215
|
+
else
|
216
|
+
false
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
167
220
|
#-------------------------------------------------------------------------#
|
168
221
|
|
169
222
|
public
|
@@ -173,10 +226,13 @@ module Pod
|
|
173
226
|
# @return [Array] The keys used by the hash representation of the Podfile.
|
174
227
|
#
|
175
228
|
HASH_KEYS = %w(
|
176
|
-
|
229
|
+
installation_method
|
177
230
|
workspace
|
178
|
-
|
231
|
+
sources
|
232
|
+
plugins
|
179
233
|
set_arc_compatibility_flag
|
234
|
+
generate_bridge_support
|
235
|
+
target_definitions
|
180
236
|
).freeze
|
181
237
|
|
182
238
|
# @return [Hash] The hash representation of the Podfile.
|
@@ -191,21 +247,40 @@ module Pod
|
|
191
247
|
# @return [String] The YAML representation of the Podfile.
|
192
248
|
#
|
193
249
|
def to_yaml
|
194
|
-
|
250
|
+
require 'cocoapods-core/yaml_helper'
|
251
|
+
"---\n" << YAMLHelper.convert_hash(to_hash, HASH_KEYS)
|
195
252
|
end
|
196
253
|
|
197
|
-
|
254
|
+
# @return [String] The SHA1 digest of the file in which the Podfile
|
255
|
+
# is defined.
|
256
|
+
#
|
257
|
+
# @return [Nil] If the podfile is not defined in a file.
|
258
|
+
#
|
259
|
+
def checksum
|
260
|
+
@checksum ||= begin
|
261
|
+
unless defined_in_file.nil?
|
262
|
+
require 'digest'
|
263
|
+
checksum = Digest::SHA1.hexdigest(File.read(defined_in_file))
|
264
|
+
checksum = checksum.encode('UTF-8') if checksum.respond_to?(:encode)
|
265
|
+
checksum
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
198
269
|
|
199
|
-
|
270
|
+
def ==(other)
|
271
|
+
self.class == other.class &&
|
272
|
+
to_hash == other.to_hash
|
273
|
+
end
|
200
274
|
|
201
275
|
# @!group Class methods
|
276
|
+
#-------------------------------------------------------------------------#
|
202
277
|
|
203
|
-
# Initializes a
|
278
|
+
# Initializes a Podfile from the file with the given path.
|
204
279
|
#
|
205
280
|
# @param [Pathname] path
|
206
|
-
# the path from where the
|
281
|
+
# the path from where the Podfile should be loaded.
|
207
282
|
#
|
208
|
-
# @return [Podfile] the generated
|
283
|
+
# @return [Podfile] the generated Podfile.
|
209
284
|
#
|
210
285
|
def self.from_file(path)
|
211
286
|
path = Pathname.new(path)
|
@@ -214,7 +289,7 @@ module Pod
|
|
214
289
|
end
|
215
290
|
|
216
291
|
case path.extname
|
217
|
-
when '', '.podfile'
|
292
|
+
when '', '.podfile', '.rb'
|
218
293
|
Podfile.from_ruby(path)
|
219
294
|
when '.yaml'
|
220
295
|
Podfile.from_yaml(path)
|
@@ -225,51 +300,59 @@ module Pod
|
|
225
300
|
|
226
301
|
# Configures a new Podfile from the given ruby string.
|
227
302
|
#
|
228
|
-
# @param [String] string
|
229
|
-
# The ruby string which will configure the podfile with the DSL.
|
230
|
-
#
|
231
303
|
# @param [Pathname] path
|
232
304
|
# The path from which the Podfile is loaded.
|
233
305
|
#
|
306
|
+
# @param [String] contents
|
307
|
+
# The ruby string which will configure the Podfile with the DSL.
|
308
|
+
#
|
234
309
|
# @return [Podfile] the new Podfile
|
235
310
|
#
|
236
|
-
def self.from_ruby(path)
|
237
|
-
|
311
|
+
def self.from_ruby(path, contents = nil)
|
312
|
+
contents ||= File.open(path, 'r:utf-8', &:read)
|
313
|
+
|
238
314
|
# Work around for Rubinius incomplete encoding in 1.9 mode
|
239
|
-
if
|
240
|
-
|
315
|
+
if contents.respond_to?(:encoding) && contents.encoding.name != 'UTF-8'
|
316
|
+
contents.encode!('UTF-8')
|
317
|
+
end
|
318
|
+
|
319
|
+
if contents.tr!('“”‘’‛', %(""'''))
|
320
|
+
# Changes have been made
|
321
|
+
CoreUI.warn "Smart quotes were detected and ignored in your #{path.basename}. " \
|
322
|
+
'To avoid issues in the future, you should not use ' \
|
323
|
+
'TextEdit for editing it. If you are not using TextEdit, ' \
|
324
|
+
'you should turn off smart quotes in your editor of choice.'
|
241
325
|
end
|
326
|
+
|
242
327
|
podfile = Podfile.new(path) do
|
328
|
+
# rubocop:disable Lint/RescueException
|
243
329
|
begin
|
244
|
-
# rubocop:disable Eval
|
245
|
-
eval(
|
246
|
-
# rubocop:enable Eval
|
330
|
+
# rubocop:disable Security/Eval
|
331
|
+
eval(contents, nil, path.to_s)
|
332
|
+
# rubocop:enable Security/Eval
|
247
333
|
rescue Exception => e
|
248
334
|
message = "Invalid `#{path.basename}` file: #{e.message}"
|
249
|
-
raise DSLError.new(message, path, e
|
335
|
+
raise DSLError.new(message, path, e, contents)
|
250
336
|
end
|
337
|
+
# rubocop:enable Lint/RescueException
|
251
338
|
end
|
252
339
|
podfile
|
253
340
|
end
|
254
341
|
|
255
342
|
# Configures a new Podfile from the given YAML representation.
|
256
343
|
#
|
257
|
-
# @param [String] yaml
|
258
|
-
# The YAML encoded hash which contains the information of the
|
259
|
-
# Podfile.
|
260
|
-
#
|
261
344
|
# @param [Pathname] path
|
262
345
|
# The path from which the Podfile is loaded.
|
263
346
|
#
|
264
347
|
# @return [Podfile] the new Podfile
|
265
348
|
#
|
266
349
|
def self.from_yaml(path)
|
267
|
-
string = File.open(path, 'r:utf-8'
|
350
|
+
string = File.open(path, 'r:utf-8', &:read)
|
268
351
|
# Work around for Rubinius incomplete encoding in 1.9 mode
|
269
|
-
if string.respond_to?(:encoding) && string.encoding.name !=
|
352
|
+
if string.respond_to?(:encoding) && string.encoding.name != 'UTF-8'
|
270
353
|
string.encode!('UTF-8')
|
271
354
|
end
|
272
|
-
hash =
|
355
|
+
hash = YAMLHelper.load_string(string)
|
273
356
|
from_hash(hash, path)
|
274
357
|
end
|
275
358
|
|
@@ -312,7 +395,7 @@ module Pod
|
|
312
395
|
# @param [Object] value
|
313
396
|
# The value to store.
|
314
397
|
#
|
315
|
-
# @raise If the key is not recognized.
|
398
|
+
# @raise [StandardError] If the key is not recognized.
|
316
399
|
#
|
317
400
|
# @return [void]
|
318
401
|
#
|
@@ -328,15 +411,19 @@ module Pod
|
|
328
411
|
# @param [String] key
|
329
412
|
# The key for which the value is needed.
|
330
413
|
#
|
331
|
-
# @
|
414
|
+
# @param default
|
415
|
+
# The default value to return if the internal hash has no entry for
|
416
|
+
# the given `key`.
|
417
|
+
#
|
418
|
+
# @raise [StandardError] If the key is not recognized.
|
332
419
|
#
|
333
420
|
# @return [Object] The value for the key.
|
334
421
|
#
|
335
|
-
def get_hash_value(key)
|
422
|
+
def get_hash_value(key, default = nil)
|
336
423
|
unless HASH_KEYS.include?(key)
|
337
424
|
raise StandardError, "Unsupported hash key `#{key}`"
|
338
425
|
end
|
339
|
-
internal_hash
|
426
|
+
internal_hash.fetch(key, default)
|
340
427
|
end
|
341
428
|
|
342
429
|
# @return [TargetDefinition] The current target definition to which the DSL
|
@@ -344,20 +431,6 @@ module Pod
|
|
344
431
|
#
|
345
432
|
attr_accessor :current_target_definition
|
346
433
|
|
347
|
-
public
|
348
|
-
|
349
|
-
# @!group Deprecations
|
350
|
-
#-------------------------------------------------------------------------#
|
351
|
-
|
352
|
-
# @deprecated Deprecated in favour of the more succinct {#pod}. Remove for
|
353
|
-
# CocoaPods 1.0.
|
354
|
-
#
|
355
|
-
def dependency(name = nil, *requirements, &block)
|
356
|
-
CoreUI.warn "[DEPRECATED] `dependency' is deprecated (use `pod')"
|
357
|
-
pod(name, *requirements, &block)
|
358
|
-
end
|
359
|
-
|
360
434
|
#-------------------------------------------------------------------------#
|
361
|
-
|
362
435
|
end
|
363
436
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
module Pod
|
2
|
-
|
3
2
|
# A Requirement is a set of one or more version restrictions of a
|
4
3
|
# {Dependency}.
|
5
4
|
#
|
@@ -10,13 +9,14 @@ module Pod
|
|
10
9
|
# the Dependency class.
|
11
10
|
#
|
12
11
|
class Requirement < Pod::Vendor::Gem::Requirement
|
13
|
-
|
14
|
-
quoted_operators = OPS.keys.map { |k| Regexp.quote k }.join "|"
|
12
|
+
quoted_operators = OPS.keys.map { |k| Regexp.quote k }.join '|'
|
15
13
|
|
16
14
|
# @return [Regexp] The regular expression used to validate input strings.
|
17
15
|
#
|
18
16
|
PATTERN = /\A\s*(#{quoted_operators})?\s*(#{Version::VERSION_PATTERN})\s*\z/
|
19
17
|
|
18
|
+
DefaultRequirement = ['>=', Version.new(0)] # rubocop:disable Naming/ConstantName
|
19
|
+
|
20
20
|
#-------------------------------------------------------------------------#
|
21
21
|
|
22
22
|
# Factory method to create a new requirement.
|
@@ -47,7 +47,7 @@ module Pod
|
|
47
47
|
new('>= 0')
|
48
48
|
end
|
49
49
|
|
50
|
-
# Parses the given object returning
|
50
|
+
# Parses the given object returning a tuple where the first entry is an
|
51
51
|
# operator and the second a version. If not operator is provided it
|
52
52
|
# defaults to `=`.
|
53
53
|
#
|
@@ -57,19 +57,48 @@ module Pod
|
|
57
57
|
# @return [Array] A tuple representing the requirement.
|
58
58
|
#
|
59
59
|
def self.parse(input)
|
60
|
-
return [
|
60
|
+
return ['=', input] if input.is_a?(Version)
|
61
61
|
|
62
62
|
unless PATTERN =~ input.to_s
|
63
63
|
raise ArgumentError, "Illformed requirement `#{input.inspect}`"
|
64
64
|
end
|
65
65
|
|
66
|
-
operator = Regexp.last_match[1] ||
|
66
|
+
operator = Regexp.last_match[1] || '='
|
67
67
|
version = Version.new(Regexp.last_match[2])
|
68
68
|
[operator, version]
|
69
69
|
end
|
70
70
|
|
71
|
-
|
71
|
+
# Constructs a requirement from `requirements`.
|
72
|
+
#
|
73
|
+
# @param [String, Version, Array<String>, Array<Version>] requirements
|
74
|
+
# The set of requirements
|
75
|
+
#
|
76
|
+
# @note Duplicate requirements are ignored.
|
77
|
+
#
|
78
|
+
# @note An empty set of `requirements` is the same as `">= 0"`
|
79
|
+
#
|
80
|
+
def initialize(*requirements)
|
81
|
+
requirements = requirements.flatten
|
82
|
+
requirements.compact!
|
83
|
+
requirements.uniq!
|
72
84
|
|
73
|
-
|
85
|
+
@requirements = if requirements.empty?
|
86
|
+
[DefaultRequirement]
|
87
|
+
else
|
88
|
+
requirements.map! { |r| self.class.parse r }
|
89
|
+
end
|
90
|
+
end
|
74
91
|
|
92
|
+
#
|
93
|
+
# @return [Boolean] true if this pod has no requirements.
|
94
|
+
#
|
95
|
+
def none?
|
96
|
+
if @requirements.size == 1
|
97
|
+
@requirements[0] == DefaultRequirement
|
98
|
+
else
|
99
|
+
false
|
100
|
+
end
|
101
|
+
end
|
102
|
+
#-------------------------------------------------------------------------#
|
103
|
+
end
|
75
104
|
end
|
@@ -1,12 +1,10 @@
|
|
1
1
|
module Pod
|
2
2
|
class Source
|
3
|
-
|
4
3
|
# Checks whether a podspec can be accepted by a source. The check takes
|
5
4
|
# into account the introduction of 0.0.1 version if there are already
|
6
5
|
# tagged ones or whether there is change in the source.
|
7
6
|
#
|
8
7
|
class Acceptor
|
9
|
-
|
10
8
|
# @return [Source] the source where the podspec should be added.
|
11
9
|
#
|
12
10
|
attr_reader :source
|
@@ -45,7 +43,7 @@ module Pod
|
|
45
43
|
spec = Specification.from_file(spec_path)
|
46
44
|
analyze(spec)
|
47
45
|
rescue
|
48
|
-
[
|
46
|
+
['Unable to load the specification.']
|
49
47
|
end
|
50
48
|
|
51
49
|
private
|
@@ -61,6 +59,8 @@ module Pod
|
|
61
59
|
# @return [void]
|
62
60
|
#
|
63
61
|
def check_spec_source_change(spec, errors)
|
62
|
+
require 'cocoapods-core/http'
|
63
|
+
|
64
64
|
return unless spec
|
65
65
|
return if spec.source[:http]
|
66
66
|
return unless reference_spec(spec)
|
@@ -68,11 +68,15 @@ module Pod
|
|
68
68
|
source = spec.source.values_at(*keys).compact.first
|
69
69
|
old_source = reference_spec(spec).source.values_at(*keys).compact.first
|
70
70
|
unless source == old_source
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
71
|
+
source = HTTP.get_actual_url(source)
|
72
|
+
old_source = HTTP.get_actual_url(old_source)
|
73
|
+
unless source == old_source
|
74
|
+
message = "The source of the spec doesn't match with the recorded "
|
75
|
+
message << "ones. Source: `#{source}`. Previous: `#{old_source}`.\n "
|
76
|
+
message << 'Please contact the specs repo maintainers if the '
|
77
|
+
message << 'library changed location.'
|
78
|
+
errors << message
|
79
|
+
end
|
76
80
|
end
|
77
81
|
end
|
78
82
|
|
@@ -90,8 +94,8 @@ module Pod
|
|
90
94
|
s.version != '0.0.1'
|
91
95
|
end
|
92
96
|
if has_tagged_spec
|
93
|
-
errors <<
|
94
|
-
|
97
|
+
errors << 'There is already at least one versioned specification ' \
|
98
|
+
'so untagged versions cannot be accepted.'
|
95
99
|
end
|
96
100
|
end
|
97
101
|
|
@@ -104,7 +108,7 @@ module Pod
|
|
104
108
|
return unless previous_spec
|
105
109
|
return unless spec.version == Version.new('0.0.1')
|
106
110
|
unless spec.source[:commit] == previous_spec.source[:commit]
|
107
|
-
errors <<
|
111
|
+
errors << 'Attempt to rewrite the commit of a 0.0.1 version.'
|
108
112
|
end
|
109
113
|
end
|
110
114
|
|
@@ -118,7 +122,7 @@ module Pod
|
|
118
122
|
set = source.search(dep)
|
119
123
|
unless set && set.specification
|
120
124
|
errors << "Unable to find a specification for the `#{dep}` " \
|
121
|
-
|
125
|
+
'dependency.'
|
122
126
|
end
|
123
127
|
end
|
124
128
|
end
|
@@ -161,7 +165,6 @@ module Pod
|
|
161
165
|
end
|
162
166
|
|
163
167
|
#-----------------------------------------------------------------------#
|
164
|
-
|
165
168
|
end
|
166
169
|
end
|
167
170
|
end
|