cocoapods-core 0.27.1 → 0.28.0
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.rb +0 -2
- data/lib/cocoapods-core/core_ui.rb +0 -1
- data/lib/cocoapods-core/dependency.rb +20 -15
- data/lib/cocoapods-core/gem_version.rb +1 -1
- data/lib/cocoapods-core/github.rb +1 -1
- data/lib/cocoapods-core/lockfile.rb +15 -11
- data/lib/cocoapods-core/platform.rb +10 -6
- data/lib/cocoapods-core/podfile.rb +18 -11
- data/lib/cocoapods-core/podfile/dsl.rb +25 -23
- data/lib/cocoapods-core/podfile/target_definition.rb +60 -36
- data/lib/cocoapods-core/requirement.rb +2 -2
- data/lib/cocoapods-core/source.rb +34 -10
- data/lib/cocoapods-core/source/acceptor.rb +12 -8
- data/lib/cocoapods-core/source/aggregate.rb +22 -9
- data/lib/cocoapods-core/source/health_reporter.rb +2 -2
- data/lib/cocoapods-core/specification.rb +14 -12
- data/lib/cocoapods-core/specification/consumer.rb +8 -6
- data/lib/cocoapods-core/specification/dsl.rb +66 -18
- data/lib/cocoapods-core/specification/dsl/attribute.rb +5 -4
- data/lib/cocoapods-core/specification/dsl/deprecations.rb +35 -23
- data/lib/cocoapods-core/specification/dsl/platform_proxy.rb +16 -11
- data/lib/cocoapods-core/specification/linter.rb +107 -36
- data/lib/cocoapods-core/specification/root_attribute_accessors.rb +16 -4
- data/lib/cocoapods-core/specification/set.rb +41 -24
- data/lib/cocoapods-core/specification/set/presenter.rb +7 -5
- data/lib/cocoapods-core/specification/yaml.rb +6 -2
- data/lib/cocoapods-core/standard_error.rb +3 -3
- data/lib/cocoapods-core/vendor.rb +0 -1
- data/lib/cocoapods-core/vendor/requirement.rb +9 -9
- data/lib/cocoapods-core/vendor/version.rb +143 -140
- data/lib/cocoapods-core/version.rb +5 -6
- data/lib/cocoapods-core/yaml_converter.rb +3 -2
- metadata +17 -3
@@ -224,10 +224,12 @@ module Pod
|
|
224
224
|
value = the_spec.attributes_hash[attr.name.to_s]
|
225
225
|
value = prepare_value(attr, value)
|
226
226
|
|
227
|
-
if attr.multi_platform?
|
228
|
-
|
229
|
-
|
230
|
-
|
227
|
+
if attr.multi_platform?
|
228
|
+
if platform_hash = the_spec.attributes_hash[platform_name.to_s]
|
229
|
+
platform_value = platform_hash[attr.name.to_s]
|
230
|
+
platform_value = prepare_value(attr, platform_value)
|
231
|
+
value = merge_values(attr, value, platform_value)
|
232
|
+
end
|
231
233
|
end
|
232
234
|
value
|
233
235
|
end
|
@@ -258,7 +260,7 @@ module Pod
|
|
258
260
|
r = [*existing_value] + [*new_value]
|
259
261
|
r.compact
|
260
262
|
elsif attr.container == Hash
|
261
|
-
existing_value
|
263
|
+
existing_value.merge(new_value) do |_, old, new|
|
262
264
|
if new.is_a?(Array) || old.is_a?(Array)
|
263
265
|
r = [*old] + [*new]
|
264
266
|
r.compact
|
@@ -289,7 +291,7 @@ module Pod
|
|
289
291
|
|
290
292
|
hook_name = prepare_hook_name(attr)
|
291
293
|
if self.respond_to?(hook_name, true)
|
292
|
-
value =
|
294
|
+
value = send(hook_name, value)
|
293
295
|
else
|
294
296
|
value
|
295
297
|
end
|
@@ -105,7 +105,8 @@ module Pod
|
|
105
105
|
|
106
106
|
# @!method authors=(authors)
|
107
107
|
#
|
108
|
-
# The name and email
|
108
|
+
# The name and email addresses of the library maintainers, not the
|
109
|
+
# Podspec maintainer.
|
109
110
|
#
|
110
111
|
# @example
|
111
112
|
#
|
@@ -124,7 +125,7 @@ module Pod
|
|
124
125
|
# the list of the authors of the library and their emails.
|
125
126
|
#
|
126
127
|
root_attribute :authors, {
|
127
|
-
:types => [
|
128
|
+
:types => [String, Array, Hash],
|
128
129
|
:container => Hash,
|
129
130
|
:required => true,
|
130
131
|
:singularize => true,
|
@@ -132,9 +133,34 @@ module Pod
|
|
132
133
|
|
133
134
|
#------------------#
|
134
135
|
|
136
|
+
# @!method social_media_url=(social_media_url)
|
137
|
+
#
|
138
|
+
# The URL for the social media contact of the Pod, CocoaPods web
|
139
|
+
# services can use this.
|
140
|
+
#
|
141
|
+
# For example, the @CocoaPodsFeed notifications will include the
|
142
|
+
# Twitter handle (shortening the description) if the URL is relative to
|
143
|
+
# Twitter. This does **not** necessarily have to be a Twitter URL, but
|
144
|
+
# only those are included in the Twitter @CocoaPodsFeed notifications.
|
145
|
+
#
|
146
|
+
# @example
|
147
|
+
#
|
148
|
+
# spec.social_media_url = 'https://twitter.com/cocoapods'
|
149
|
+
#
|
150
|
+
# @example
|
151
|
+
#
|
152
|
+
# spec.social_media_url = 'https://groups.google.com/forum/#!forum/cocoapods'
|
153
|
+
#
|
154
|
+
# @param [String] social_media_url
|
155
|
+
# the social media URL.
|
156
|
+
#
|
157
|
+
root_attribute :social_media_url
|
158
|
+
|
159
|
+
#------------------#
|
160
|
+
|
135
161
|
# The keys accepted by the license attribute.
|
136
162
|
#
|
137
|
-
LICENSE_KEYS = [
|
163
|
+
LICENSE_KEYS = [:type, :file, :text].freeze
|
138
164
|
|
139
165
|
# @!method license=(license)
|
140
166
|
#
|
@@ -210,15 +236,32 @@ module Pod
|
|
210
236
|
#
|
211
237
|
# The location from where the library should be retrieved.
|
212
238
|
#
|
213
|
-
# @example Specifying a Git source with a tag.
|
239
|
+
# @example Specifying a Git source with a tag. This is how most OSS Podspecs work.
|
214
240
|
#
|
215
241
|
# spec.source = { :git => 'https://github.com/AFNetworking/AFNetworking.git',
|
216
242
|
# :tag => 'v0.0.1' }
|
217
243
|
#
|
218
|
-
# @example Using the version of the Pod to identify the Git
|
244
|
+
# @example Using the version of the Pod to identify the Git commit and using submodules.
|
219
245
|
#
|
220
246
|
# spec.source = { :git => 'https://github.com/AFNetworking/AFNetworking.git',
|
221
|
-
# :
|
247
|
+
# :commit => "v#{spec.version}", :submodules => true }
|
248
|
+
#
|
249
|
+
# @example Using the version of the Pod to identify the Git branch.
|
250
|
+
#
|
251
|
+
# spec.source = { :git => 'https://github.com/AFNetworking/AFNetworking.git',
|
252
|
+
# :branch => "orta_fixes"}
|
253
|
+
#
|
254
|
+
# @example Using Subversion with a tag.
|
255
|
+
#
|
256
|
+
# spec.source = { :svn => "http://svn.code.sf.net/p/polyclipping/code", :tag => '4.8.8' }
|
257
|
+
#
|
258
|
+
# @example Using Mercurial with the same revision as the spec's semantic version string.
|
259
|
+
#
|
260
|
+
# spec.source = { :hg => "https://bitbucket.org/dcutting/hyperbek", :revision => "#{s.version}" }
|
261
|
+
#
|
262
|
+
# @example Using HTTP to download a compressed file of the code. It supports zip, tgz, bz2 and tar.
|
263
|
+
#
|
264
|
+
# spec.source = { :http => "http://dev.wechatapp.com/download/sdk/WeChat_SDK_iOS_en.zip" }
|
222
265
|
#
|
223
266
|
# @param [Hash{Symbol=>String}] source
|
224
267
|
# The location from where the library should be retrieved.
|
@@ -304,8 +347,9 @@ module Pod
|
|
304
347
|
|
305
348
|
# @!method documentation_url=(documentation_url)
|
306
349
|
#
|
307
|
-
# An URL for the documentation of the Pod which will be honored by
|
308
|
-
# CocoaPods web properties.
|
350
|
+
# An optional URL for the documentation of the Pod which will be honored by
|
351
|
+
# CocoaPods web properties. Leaving it blank will default to a CocoaDocs
|
352
|
+
# generated URL for your library.
|
309
353
|
#
|
310
354
|
# @example
|
311
355
|
#
|
@@ -396,9 +440,7 @@ module Pod
|
|
396
440
|
def platform=(args)
|
397
441
|
name, deployment_target = args
|
398
442
|
if name
|
399
|
-
|
400
|
-
name.to_s => deployment_target
|
401
|
-
}
|
443
|
+
attributes_hash["platforms"] = { name.to_s => deployment_target }
|
402
444
|
else
|
403
445
|
attributes_hash["platforms"] = {}
|
404
446
|
end
|
@@ -451,7 +493,8 @@ module Pod
|
|
451
493
|
# The deployment target of the platform.
|
452
494
|
#
|
453
495
|
def deployment_target=(*args)
|
454
|
-
raise Informative, "The deployment target can be declared only per
|
496
|
+
raise Informative, "The deployment target can be declared only per " \
|
497
|
+
"platform."
|
455
498
|
end
|
456
499
|
|
457
500
|
#-----------------------------------------------------------------------#
|
@@ -497,19 +540,25 @@ module Pod
|
|
497
540
|
#
|
498
541
|
def dependency(*args)
|
499
542
|
name, *version_requirements = args
|
500
|
-
|
543
|
+
if name == self.name
|
544
|
+
raise Informative, "A specification can't require itself as a " \
|
545
|
+
"subspec"
|
546
|
+
end
|
501
547
|
if @parent
|
502
548
|
composed_name = ""
|
503
549
|
@parent.name.split("/").each do |component|
|
504
550
|
composed_name << component
|
505
551
|
if name == composed_name
|
506
|
-
raise Informative, "A subspec can't require one of its
|
507
|
-
|
552
|
+
raise Informative, "A subspec can't require one of its " \
|
553
|
+
"parents specifications"
|
554
|
+
else
|
555
|
+
composed_name << "/"
|
508
556
|
end
|
509
|
-
composed_name << "/"
|
510
557
|
end
|
511
558
|
end
|
512
|
-
|
559
|
+
unless version_requirements.all? { |req| req.is_a?(String) }
|
560
|
+
raise Informative, "Unsupported version requirements"
|
561
|
+
end
|
513
562
|
attributes_hash["dependencies"] ||= {}
|
514
563
|
attributes_hash["dependencies"][name] = version_requirements
|
515
564
|
end
|
@@ -694,7 +743,6 @@ module Pod
|
|
694
743
|
:inherited => true
|
695
744
|
}
|
696
745
|
|
697
|
-
|
698
746
|
#------------------#
|
699
747
|
|
700
748
|
# @!method header_dir=(dir)
|
@@ -42,7 +42,7 @@ module Pod
|
|
42
42
|
@default_value = options.delete(:default_value) { nil }
|
43
43
|
@ios_default = options.delete(:ios_default) { nil }
|
44
44
|
@osx_default = options.delete(:osx_default) { nil }
|
45
|
-
@types = options.delete(:types) { [String
|
45
|
+
@types = options.delete(:types) { [String] }
|
46
46
|
|
47
47
|
unless options.empty?
|
48
48
|
raise StandardError, "Unrecognized options: #{options} for #{to_s}"
|
@@ -58,8 +58,8 @@ module Pod
|
|
58
58
|
# @return [String] A string representation suitable for debugging.
|
59
59
|
#
|
60
60
|
def inspect
|
61
|
-
"<#{self.class} name=#{
|
62
|
-
|
61
|
+
"<#{self.class} name=#{name} types=#{types} " \
|
62
|
+
"multi_platform=#{multi_platform?}>"
|
63
63
|
end
|
64
64
|
|
65
65
|
#---------------------------------------------------------------------#
|
@@ -209,7 +209,8 @@ module Pod
|
|
209
209
|
#
|
210
210
|
def validate_for_writing(spec, value)
|
211
211
|
if root_only? && !spec.root?
|
212
|
-
raise StandardError, "Can't set `#{name}` attribute for
|
212
|
+
raise StandardError, "Can't set `#{name}` attribute for " \
|
213
|
+
"subspecs (in `#{spec.name}`)."
|
213
214
|
end
|
214
215
|
|
215
216
|
if keys
|
@@ -8,59 +8,73 @@ module Pod
|
|
8
8
|
|
9
9
|
def preferred_dependency=(name)
|
10
10
|
self.default_subspec = name
|
11
|
-
CoreUI.warn "[#{to_s}] `preferred_dependency` has been renamed
|
11
|
+
CoreUI.warn "[#{to_s}] `preferred_dependency` has been renamed "\
|
12
|
+
"to `default_subspec`."
|
12
13
|
end
|
13
14
|
|
14
15
|
def singleton_method_added(method)
|
15
16
|
if method == :pre_install
|
16
|
-
CoreUI.warn "[#{to_s}] The use of `#{method}` by overriding
|
17
|
+
CoreUI.warn "[#{to_s}] The use of `#{method}` by overriding " \
|
18
|
+
"the method is deprecated."
|
17
19
|
@pre_install_callback = Proc.new do |pod, target_definition|
|
18
|
-
|
20
|
+
pre_install(pod, target_definition)
|
19
21
|
end
|
20
22
|
|
21
23
|
elsif method == :post_install
|
22
|
-
CoreUI.warn "[#{to_s}] The use of `#{method}` by overriding the
|
24
|
+
CoreUI.warn "[#{to_s}] The use of `#{method}` by overriding the " \
|
25
|
+
"method is deprecated."
|
23
26
|
@post_install_callback = Proc.new do |target_installer|
|
24
|
-
|
27
|
+
post_install(target_installer)
|
25
28
|
end
|
26
29
|
|
27
30
|
elsif method == :header_mappings
|
28
|
-
raise Informative, "[#{to_s}] The use of the `header_mappings`
|
29
|
-
"Use the `header_dir` and the
|
31
|
+
raise Informative, "[#{to_s}] The use of the `header_mappings` " \
|
32
|
+
"hook has been deprecated.\n Use the `header_dir` and the " \
|
33
|
+
"`header_mappings_dir` attributes."
|
30
34
|
|
31
35
|
elsif method == :copy_header_mapping
|
32
|
-
raise Informative, "[#{to_s}] The use of the
|
33
|
-
"
|
36
|
+
raise Informative, "[#{to_s}] The use of the " \
|
37
|
+
"`copy_header_mapping` hook has been deprecated.\nUse" \
|
38
|
+
"the `header_dir` and the `header_mappings_dir` attributes."
|
34
39
|
end
|
35
40
|
end
|
36
41
|
|
37
42
|
def documentation=(value)
|
38
|
-
CoreUI.warn "[#{to_s}] The `documentation` DSL directive of the
|
43
|
+
CoreUI.warn "[#{to_s}] The `documentation` DSL directive of the " \
|
44
|
+
"podspec format has been deprecated."
|
39
45
|
end
|
40
46
|
|
41
47
|
def clean_paths=(value)
|
42
|
-
raise Informative, "[#{to_s}] Clean paths are deprecated.
|
43
|
-
"cleans unused files by default. Use the
|
48
|
+
raise Informative, "[#{to_s}] Clean paths are deprecated. " \
|
49
|
+
"CocoaPods now cleans unused files by default. Use the " \
|
50
|
+
"`preserve_paths` attribute if needed."
|
44
51
|
end
|
45
52
|
|
46
|
-
|
53
|
+
DEPRECATED_METHODS = [
|
54
|
+
:part_of_dependency=,
|
55
|
+
:part_of=,
|
56
|
+
:exclude_header_search_paths=
|
57
|
+
]
|
58
|
+
|
59
|
+
DEPRECATED_METHODS.each do |method|
|
47
60
|
define_method method do |value|
|
48
|
-
raise Informative, "[#{to_s}] Attribute
|
61
|
+
raise Informative, "[#{to_s}] Attribute "\
|
62
|
+
"`#{method.to_s[0..-2]}` has been deprecated."
|
49
63
|
end
|
50
64
|
end
|
51
65
|
|
52
66
|
# @!group Hooks
|
53
67
|
#
|
54
|
-
# The specification class provides hooks which are called by
|
55
|
-
# when a Pod is installed.
|
68
|
+
# The specification class provides hooks which are called by
|
69
|
+
# CocoaPods when a Pod is installed.
|
56
70
|
|
57
71
|
#-----------------------------------------------------------------------#
|
58
72
|
|
59
|
-
# This is a convenience method which gets called after all pods have
|
60
|
-
# downloaded but before they have been installed, and the Xcode
|
61
|
-
# and related files have been generated. Note that this hook is
|
62
|
-
# for each Pods library and only for installations where the Pod
|
63
|
-
# installed.
|
73
|
+
# This is a convenience method which gets called after all pods have
|
74
|
+
# been downloaded but before they have been installed, and the Xcode
|
75
|
+
# project and related files have been generated. Note that this hook is
|
76
|
+
# called for each Pods library and only for installations where the Pod
|
77
|
+
# is installed.
|
64
78
|
#
|
65
79
|
# This hook should be used to generate and modify the files of the Pod.
|
66
80
|
#
|
@@ -117,9 +131,7 @@ module Pod
|
|
117
131
|
|
118
132
|
#-----------------------------------------------------------------------#
|
119
133
|
|
120
|
-
|
121
134
|
end
|
122
|
-
|
123
135
|
end
|
124
136
|
end
|
125
137
|
end
|
@@ -11,8 +11,8 @@ module Pod
|
|
11
11
|
#
|
12
12
|
attr_accessor :spec
|
13
13
|
|
14
|
-
# @return [Symbol] the platform described by this proxy. Can be either
|
15
|
-
# `:osx`.
|
14
|
+
# @return [Symbol] the platform described by this proxy. Can be either
|
15
|
+
# `:ios` or `:osx`.
|
16
16
|
#
|
17
17
|
attr_accessor :platform
|
18
18
|
|
@@ -23,18 +23,22 @@ module Pod
|
|
23
23
|
@spec, @platform = spec, platform
|
24
24
|
end
|
25
25
|
|
26
|
-
# Defines a setter method for each attribute of the specification
|
27
|
-
# that forwards the message to the {#specification} using the
|
26
|
+
# Defines a setter method for each attribute of the specification
|
27
|
+
# class, that forwards the message to the {#specification} using the
|
28
28
|
# {Specification#on_platform} method.
|
29
29
|
#
|
30
30
|
# @return [void]
|
31
31
|
#
|
32
32
|
def method_missing(meth, *args, &block)
|
33
|
-
|
34
|
-
attr.writer_name.to_sym == meth
|
33
|
+
attribute = Specification::DSL.attributes.values.find do |attr|
|
34
|
+
if attr.writer_name.to_sym == meth
|
35
|
+
true
|
36
|
+
elsif attr.writer_singular_form
|
37
|
+
attr.writer_singular_form.to_sym == meth
|
38
|
+
end
|
35
39
|
end
|
36
|
-
if
|
37
|
-
spec.store_attribute(
|
40
|
+
if attribute && attribute.multi_platform?
|
41
|
+
spec.store_attribute(attribute.name, args.first, platform)
|
38
42
|
else
|
39
43
|
super
|
40
44
|
end
|
@@ -47,9 +51,10 @@ module Pod
|
|
47
51
|
def dependency(*args)
|
48
52
|
name, *version_requirements = args
|
49
53
|
platform_name = platform.to_s
|
50
|
-
spec.attributes_hash[platform_name]
|
51
|
-
|
52
|
-
|
54
|
+
platform_hash = spec.attributes_hash[platform_name] || {}
|
55
|
+
platform_hash["dependencies"] ||= {}
|
56
|
+
platform_hash["dependencies"][name] = version_requirements
|
57
|
+
spec.attributes_hash[platform_name] = platform_hash
|
53
58
|
end
|
54
59
|
|
55
60
|
# Allows to set the deployment target for the platform.
|
@@ -90,13 +90,23 @@ module Pod
|
|
90
90
|
def perform_textual_analysis
|
91
91
|
return unless @file
|
92
92
|
text = @file.read
|
93
|
-
|
94
|
-
|
93
|
+
if text =~ /config\..?os.?/
|
94
|
+
error "`config.ios?` and `config.osx?` are deprecated."
|
95
|
+
end
|
96
|
+
if text =~ /clean_paths/
|
97
|
+
error "clean_paths are deprecated (use preserve_paths)."
|
98
|
+
end
|
99
|
+
|
95
100
|
all_lines_count = text.lines.count
|
96
101
|
comments_lines_count = text.scan(/^\s*#\s+/).length
|
97
102
|
comments_ratio = comments_lines_count.fdiv(all_lines_count)
|
98
|
-
|
99
|
-
|
103
|
+
if comments_lines_count > 20 && comments_ratio > 0.2
|
104
|
+
warning "Comments must be deleted."
|
105
|
+
end
|
106
|
+
if text.lines.first =~ /^\s*#\s+/
|
107
|
+
warning "Comments placed at the top of the specification must be " \
|
108
|
+
"deleted."
|
109
|
+
end
|
100
110
|
end
|
101
111
|
|
102
112
|
# Checks that every root only attribute which is required has a value.
|
@@ -138,7 +148,7 @@ module Pod
|
|
138
148
|
# @return [void]
|
139
149
|
#
|
140
150
|
def perform_all_specs_analysis
|
141
|
-
all_specs = [
|
151
|
+
all_specs = [spec, *spec.recursive_subspecs]
|
142
152
|
all_specs.each do |current_spec|
|
143
153
|
current_spec.available_platforms.each do |platform|
|
144
154
|
@consumer = Specification::Consumer.new(current_spec, platform)
|
@@ -193,7 +203,11 @@ module Pod
|
|
193
203
|
#
|
194
204
|
def _validate_name(n)
|
195
205
|
if spec.name && file
|
196
|
-
|
206
|
+
acceptable_names = [
|
207
|
+
spec.root.name + '.podspec',
|
208
|
+
spec.root.name + '.podspec.yaml'
|
209
|
+
]
|
210
|
+
names_match = acceptable_names.include?(file.basename.to_s)
|
197
211
|
unless names_match
|
198
212
|
error "The name of the spec should match the name of the file."
|
199
213
|
end
|
@@ -203,37 +217,56 @@ module Pod
|
|
203
217
|
def _validate_version(v)
|
204
218
|
if v.to_s.empty?
|
205
219
|
error "A version is required."
|
206
|
-
|
207
|
-
error "The version of the spec should be higher than 0."
|
220
|
+
elsif v <= Version::ZERO
|
221
|
+
error "The version of the spec should be higher than 0."
|
208
222
|
end
|
209
223
|
end
|
210
224
|
|
211
225
|
# Performs validations related to the `summary` attribute.
|
212
226
|
#
|
213
227
|
def _validate_summary(s)
|
214
|
-
|
215
|
-
|
228
|
+
if s.length > 140
|
229
|
+
warning "The summary should be a short version of `description` " \
|
230
|
+
"(max 140 characters)."
|
231
|
+
end
|
232
|
+
if s =~ /A short description of/
|
233
|
+
warning "The summary is not meaningful."
|
234
|
+
end
|
216
235
|
end
|
217
236
|
|
218
237
|
# Performs validations related to the `description` attribute.
|
219
238
|
#
|
220
239
|
def _validate_description(d)
|
221
|
-
|
222
|
-
|
223
|
-
|
240
|
+
if d =~ /An optional longer description of/
|
241
|
+
warning "The description is not meaningful."
|
242
|
+
end
|
243
|
+
if d == spec.summary
|
244
|
+
warning "The description is equal to the summary."
|
245
|
+
end
|
246
|
+
if d.length < spec.summary.length
|
247
|
+
warning "The description is shorter than the summary."
|
248
|
+
end
|
224
249
|
end
|
225
250
|
|
226
251
|
def _validate_homepage(h)
|
227
|
-
|
252
|
+
if h =~ %r[http://EXAMPLE]
|
253
|
+
warning "The homepage has not been updated from default"
|
254
|
+
end
|
228
255
|
end
|
229
256
|
|
230
257
|
# Performs validations related to the `license` attribute.
|
231
258
|
#
|
232
259
|
def _validate_license(l)
|
233
260
|
type = l[:type]
|
234
|
-
|
235
|
-
|
236
|
-
|
261
|
+
if type.nil?
|
262
|
+
warning "Missing license type."
|
263
|
+
end
|
264
|
+
if type && type.gsub(' ', '').gsub("\n", '').empty?
|
265
|
+
warning "Invalid license type."
|
266
|
+
end
|
267
|
+
if type && type =~ /\(example\)/
|
268
|
+
error "Sample license type."
|
269
|
+
end
|
237
270
|
end
|
238
271
|
|
239
272
|
# Performs validations related to the `source` attribute.
|
@@ -241,21 +274,49 @@ module Pod
|
|
241
274
|
def _validate_source(s)
|
242
275
|
if git = s[:git]
|
243
276
|
tag, commit = s.values_at(:tag, :commit)
|
244
|
-
|
245
|
-
version = spec.version.to_s
|
277
|
+
version = spec.version.to_s
|
246
278
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
279
|
+
if git =~ %r[http://EXAMPLE]
|
280
|
+
error "Example source."
|
281
|
+
end
|
282
|
+
if commit && commit.downcase =~ /head/
|
283
|
+
error 'The commit of a Git source cannot be `HEAD`.'
|
284
|
+
end
|
285
|
+
if tag && !tag.include?(version)
|
286
|
+
warning 'The version should be included in the Git tag.'
|
287
|
+
end
|
252
288
|
|
253
289
|
if version == '0.0.1'
|
254
|
-
|
290
|
+
if commit.nil? && tag.nil?
|
291
|
+
error 'Git sources should specify either a commit or a tag.'
|
292
|
+
end
|
255
293
|
else
|
256
294
|
warning 'Git sources should specify a tag.' if tag.nil?
|
257
295
|
end
|
258
296
|
end
|
297
|
+
|
298
|
+
perform_github_source_checks(s)
|
299
|
+
end
|
300
|
+
|
301
|
+
# Performs validations related to github sources.
|
302
|
+
#
|
303
|
+
def perform_github_source_checks(s)
|
304
|
+
supported_domains = [
|
305
|
+
'https://github.com',
|
306
|
+
'https://gist.github.com',
|
307
|
+
]
|
308
|
+
|
309
|
+
if git = s[:git]
|
310
|
+
is_github = git.include?('github.com')
|
311
|
+
if is_github
|
312
|
+
unless git.end_with?('.git')
|
313
|
+
warning "Github repositories should end in `.git`."
|
314
|
+
end
|
315
|
+
unless supported_domains.find { |domain| git.start_with?(domain) }
|
316
|
+
warning "Github repositories should use `https` link."
|
317
|
+
end
|
318
|
+
end
|
319
|
+
end
|
259
320
|
end
|
260
321
|
|
261
322
|
#-----------------------------------------------------------------------#
|
@@ -285,7 +346,8 @@ module Pod
|
|
285
346
|
end
|
286
347
|
patterns.each do |pattern|
|
287
348
|
if pattern.start_with?('/')
|
288
|
-
error "File patterns must be relative and cannot start with a
|
349
|
+
error "File patterns must be relative and cannot start with a " \
|
350
|
+
"slash (#{attrb.name})."
|
289
351
|
end
|
290
352
|
end
|
291
353
|
end
|
@@ -295,31 +357,38 @@ module Pod
|
|
295
357
|
#
|
296
358
|
def check_tmp_arc_not_nil
|
297
359
|
if consumer.requires_arc.nil?
|
298
|
-
warning "A value for `requires_arc` should be specified until the
|
360
|
+
warning "A value for `requires_arc` should be specified until the " \
|
361
|
+
"migration to a `true` default."
|
299
362
|
end
|
300
363
|
end
|
301
364
|
|
302
365
|
# Check empty subspec attributes
|
303
366
|
#
|
304
367
|
def check_if_spec_is_empty
|
305
|
-
methods = %w[ source_files resources preserve_paths dependencies ]
|
368
|
+
methods = %w[ source_files resources preserve_paths dependencies vendored_libraries vendored_frameworks ]
|
306
369
|
empty_patterns = methods.all? { |m| consumer.send(m).empty? }
|
307
370
|
empty = empty_patterns && consumer.spec.subspecs.empty?
|
308
371
|
if empty
|
309
|
-
error "The #{consumer.spec} spec is empty (no source files,
|
372
|
+
error "The #{consumer.spec} spec is empty (no source files, " \
|
373
|
+
"resources, preserve paths, , vendored_libraries, " \
|
374
|
+
"vendored_frameworks dependencies or subspecs)."
|
310
375
|
end
|
311
376
|
end
|
312
377
|
|
313
378
|
# Check the hooks
|
314
379
|
#
|
315
380
|
def check_install_hooks
|
316
|
-
|
317
|
-
"
|
318
|
-
|
381
|
+
unless consumer.spec.pre_install_callback.nil?
|
382
|
+
warning "The pre install hook of the specification DSL has been " \
|
383
|
+
"deprecated, use the `resource_bundles` or the " \
|
384
|
+
"`prepare_command` attributes."
|
385
|
+
end
|
319
386
|
|
320
|
-
|
321
|
-
"
|
322
|
-
|
387
|
+
unless consumer.spec.post_install_callback.nil?
|
388
|
+
warning "The post install hook of the specification DSL has been " \
|
389
|
+
"deprecated, use the `resource_bundles` or the " \
|
390
|
+
" `prepare_command` attributes."
|
391
|
+
end
|
323
392
|
end
|
324
393
|
|
325
394
|
#-----------------------------------------------------------------------#
|
@@ -403,7 +472,9 @@ module Pod
|
|
403
472
|
def to_s
|
404
473
|
r = "[#{type.to_s.upcase}] #{message}"
|
405
474
|
if platforms != Specification::PLATFORMS
|
406
|
-
platforms_names = platforms.uniq.map
|
475
|
+
platforms_names = platforms.uniq.map do |p|
|
476
|
+
Platform.string_name(p)
|
477
|
+
end
|
407
478
|
r << " [#{platforms_names * ' - '}]" unless platforms.empty?
|
408
479
|
end
|
409
480
|
r
|