cocoapods-core 0.17.0.rc5 → 0.17.0.rc6
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/README.md +16 -8
- data/lib/cocoapods-core.rb +1 -0
- data/lib/cocoapods-core/core_ui.rb +8 -8
- data/lib/cocoapods-core/dependency.rb +7 -4
- data/lib/cocoapods-core/gem_version.rb +1 -1
- data/lib/cocoapods-core/lockfile.rb +12 -22
- data/lib/cocoapods-core/platform.rb +1 -1
- data/lib/cocoapods-core/podfile.rb +8 -3
- data/lib/cocoapods-core/podfile/dsl.rb +1 -3
- data/lib/cocoapods-core/podfile/target_definition.rb +1 -5
- data/lib/cocoapods-core/source.rb +8 -112
- data/lib/cocoapods-core/source/acceptor.rb +159 -0
- data/lib/cocoapods-core/source/aggregate.rb +229 -0
- data/lib/cocoapods-core/source/health_reporter.rb +208 -0
- data/lib/cocoapods-core/specification.rb +11 -5
- data/lib/cocoapods-core/specification/consumer.rb +1 -7
- data/lib/cocoapods-core/specification/dsl.rb +4 -3
- data/lib/cocoapods-core/specification/dsl/deprecations.rb +9 -4
- data/lib/cocoapods-core/specification/linter.rb +52 -29
- data/lib/cocoapods-core/specification/set/presenter.rb +2 -2
- data/lib/cocoapods-core/version.rb +3 -0
- data/lib/cocoapods-core/yaml_converter.rb +2 -13
- metadata +5 -3
- data/lib/cocoapods-core/source/validator.rb +0 -183
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f16df566bf9d03c8f0e5026dbc78ed3d2b2224b
|
4
|
+
data.tar.gz: 67af4c059d2f9ffc0cccf953e86b534027a18a43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0ac43dc421675a3dc4f717251d150a3c981147acda279caa52f7e5f5bf3d13c0a4c19a81903f814fa221f364a3354b65583df777abc8369ffbdd19fadb70515
|
7
|
+
data.tar.gz: adb5be37a6b3d9fea4f8b9b5be0c42af1432c9c3cc9f89e1a8792033616088a19a3b8f0e9c12b1cfcb27131229995658c587a6f9b266ce367775ac09fe52a2ba
|
data/README.md
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# CocoaPods Core
|
2
2
|
|
3
|
-
[](https://travis-ci.org/CocoaPods/Core)
|
4
|
+
[](https://coveralls.io/r/CocoaPods/Core)
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
The CocoaPods-Core gem provides support to work with the models of CocoaPods.
|
7
|
+
It is intended to be used in place of the CocoaPods when the installation
|
8
|
+
of the dependencies is not needed. Therefore, it is suitable for web services.
|
8
9
|
|
9
10
|
Provides support for working with the following models:
|
10
11
|
|
@@ -12,7 +13,10 @@ Provides support for working with the following models:
|
|
12
13
|
- `Pod::Podfile` - [podfile specifications](http://cocoapods.github.com/podfile.html).
|
13
14
|
- `Pod::Source` - collections of podspec files like the [CocoaPods Spec repo](https://github.com/CocoaPods/Specs).
|
14
15
|
|
15
|
-
The gem also provides support for ancillary features like
|
16
|
+
The gem also provides support for ancillary features like
|
17
|
+
`Pod::Specification::Set::Presenter` suitable for presetting descriptions of
|
18
|
+
Pods and the `Specification::Linter`, which ensures the validity of podspec
|
19
|
+
files.
|
16
20
|
|
17
21
|
## Installation
|
18
22
|
|
@@ -27,10 +31,14 @@ The `cocoapods-core` gem requires either:
|
|
27
31
|
|
28
32
|
## Collaborate
|
29
33
|
|
30
|
-
All CocoaPods development happens on GitHub, there is a repository for
|
34
|
+
All CocoaPods development happens on GitHub, there is a repository for
|
35
|
+
[CocoaPods](https://github.com/CocoaPods/CocoaPods) and one for the [CocoaPods
|
36
|
+
specs](https://github.com/CocoaPods/Specs). Contributing patches or Pods is
|
37
|
+
really easy and gratifying.
|
31
38
|
|
32
|
-
Follow [@CocoaPodsOrg](http://twitter.com/CocoaPodsOrg) to get up to date
|
39
|
+
Follow [@CocoaPodsOrg](http://twitter.com/CocoaPodsOrg) to get up to date
|
40
|
+
information about what's going on in the CocoaPods world.
|
33
41
|
|
34
42
|
## License
|
35
43
|
|
36
|
-
This gem and CocoaPods are available under the MIT license.
|
44
|
+
This gem and CocoaPods are available under the MIT license.
|
data/lib/cocoapods-core.rb
CHANGED
@@ -4,16 +4,16 @@ module Pod
|
|
4
4
|
#
|
5
5
|
module CoreUI
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
def warn(message)
|
13
|
-
STDERR.puts message
|
14
|
-
end
|
7
|
+
def self.puts(message)
|
8
|
+
STDOUT.puts message
|
9
|
+
end
|
15
10
|
|
11
|
+
def self.warn(message)
|
12
|
+
STDERR.puts message
|
16
13
|
end
|
14
|
+
|
15
|
+
#-------------------------------------------------------------------------#
|
16
|
+
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -84,8 +84,12 @@ module Pod
|
|
84
84
|
# @return [Requirement] the requirement of this dependency (a set of
|
85
85
|
# one or more version restrictions).
|
86
86
|
#
|
87
|
+
# @todo The specific version is stripped from head information because
|
88
|
+
# because its string representation would not parse. It would
|
89
|
+
# be better to add something like Version#display_string.
|
90
|
+
#
|
87
91
|
def requirement
|
88
|
-
return Requirement.new(specific_version) if specific_version
|
92
|
+
return Requirement.new(Version.new(specific_version.version)) if specific_version
|
89
93
|
super
|
90
94
|
end
|
91
95
|
|
@@ -209,7 +213,7 @@ module Pod
|
|
209
213
|
def to_s
|
210
214
|
version = ''
|
211
215
|
if external?
|
212
|
-
version << external_source_description
|
216
|
+
version << external_source_description(external_source)
|
213
217
|
elsif head?
|
214
218
|
version << 'HEAD'
|
215
219
|
elsif @version_requirements != Requirement.default
|
@@ -271,8 +275,7 @@ module Pod
|
|
271
275
|
#
|
272
276
|
# @return [String] the description of the external source.
|
273
277
|
#
|
274
|
-
def external_source_description
|
275
|
-
source = external_source
|
278
|
+
def external_source_description(source)
|
276
279
|
if source.key?(:git)
|
277
280
|
desc = "`#{source[:git]}`"
|
278
281
|
desc << ", commit `#{source[:commit]}`" if source[:commit]
|
@@ -39,10 +39,10 @@ module Pod
|
|
39
39
|
#
|
40
40
|
def self.from_file(path)
|
41
41
|
return nil unless path.exist?
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
raise
|
42
|
+
require 'yaml'
|
43
|
+
hash = YAML.load(File.open(path))
|
44
|
+
unless hash && hash.is_a?(Hash)
|
45
|
+
raise Informative, "Invalid Lockfile in `#{path}`"
|
46
46
|
end
|
47
47
|
lockfile = Lockfile.new(hash)
|
48
48
|
lockfile.defined_in_file = path
|
@@ -59,12 +59,6 @@ module Pod
|
|
59
59
|
other && self.to_hash == other.to_hash
|
60
60
|
end
|
61
61
|
|
62
|
-
# @return [String] a string representation suitable for UI output.
|
63
|
-
#
|
64
|
-
def to_s
|
65
|
-
"Podfile.lock"
|
66
|
-
end
|
67
|
-
|
68
62
|
# @return [String] a string representation suitable for debugging.
|
69
63
|
#
|
70
64
|
def inspect
|
@@ -95,8 +89,8 @@ module Pod
|
|
95
89
|
def version(pod_name)
|
96
90
|
version = pod_versions[pod_name]
|
97
91
|
return version if version
|
98
|
-
|
99
|
-
pod_versions[
|
92
|
+
root_name = pod_versions.keys.find { |name| Specification.root_name(name) == pod_name }
|
93
|
+
pod_versions[root_name]
|
100
94
|
end
|
101
95
|
|
102
96
|
# Returns the checksum for the given Pod.
|
@@ -135,8 +129,8 @@ module Pod
|
|
135
129
|
# @param [String] name
|
136
130
|
# the name of the Pod
|
137
131
|
#
|
138
|
-
# @note The generated dependencies are by the
|
139
|
-
#
|
132
|
+
# @note The generated dependencies used are by the Resolver from
|
133
|
+
# upgrading a Pod during an installation.
|
140
134
|
#
|
141
135
|
# @raise If there is no version stored for the given name.
|
142
136
|
#
|
@@ -146,14 +140,10 @@ module Pod
|
|
146
140
|
dep = dependencies.find { |d| d.name == name || d.root_name == name }
|
147
141
|
version = version(name)
|
148
142
|
|
149
|
-
unless dep
|
143
|
+
unless dep && version
|
150
144
|
raise StandardError, "Attempt to lock the `#{name}` Pod without an known dependency."
|
151
145
|
end
|
152
146
|
|
153
|
-
unless version
|
154
|
-
raise StandardError, "Attempt to lock the `#{name}` Pod without an known version."
|
155
|
-
end
|
156
|
-
|
157
147
|
locked_dependency = dep.dup
|
158
148
|
locked_dependency.specific_version = version
|
159
149
|
locked_dependency
|
@@ -272,7 +262,7 @@ module Pod
|
|
272
262
|
self.defined_in_file = path
|
273
263
|
end
|
274
264
|
|
275
|
-
# @return [Hash{String=>Array,Hash,String}] a hash
|
265
|
+
# @return [Hash{String=>Array,Hash,String}] a hash representation of the
|
276
266
|
# Lockfile.
|
277
267
|
#
|
278
268
|
# @example Output
|
@@ -339,7 +329,7 @@ module Pod
|
|
339
329
|
#
|
340
330
|
def generate(podfile, specs)
|
341
331
|
hash = {
|
342
|
-
'PODS' => generate_pods_data(
|
332
|
+
'PODS' => generate_pods_data(specs),
|
343
333
|
'DEPENDENCIES' => generate_dependencies_data(podfile),
|
344
334
|
'EXTERNAL SOURCES' => generate_external_sources_data(podfile),
|
345
335
|
'SPEC CHECKSUMS' => generate_checksums(specs),
|
@@ -369,7 +359,7 @@ module Pod
|
|
369
359
|
# "monkey (1.0.8)" ]
|
370
360
|
#
|
371
361
|
#
|
372
|
-
def generate_pods_data(
|
362
|
+
def generate_pods_data(specs)
|
373
363
|
pod_and_deps = specs.map do |spec|
|
374
364
|
[spec.to_s, spec.all_dependencies.map(&:to_s).sort]
|
375
365
|
end.uniq
|
@@ -210,7 +210,7 @@ module Pod
|
|
210
210
|
def self.from_file(path)
|
211
211
|
path = Pathname.new(path)
|
212
212
|
unless path.exist?
|
213
|
-
raise
|
213
|
+
raise Informative, "No Podfile exists at path `#{path}`."
|
214
214
|
end
|
215
215
|
string = File.open(path, 'r:utf-8') { |f| f.read }
|
216
216
|
# Work around for Rubinius incomplete encoding in 1.9 mode
|
@@ -224,7 +224,7 @@ module Pod
|
|
224
224
|
when '.yaml', '.cocoapods'
|
225
225
|
Podfile.from_yaml(string, path)
|
226
226
|
else
|
227
|
-
raise
|
227
|
+
raise Informative, "Unsupported Podfile format `#{path}`."
|
228
228
|
end
|
229
229
|
end
|
230
230
|
|
@@ -332,15 +332,20 @@ module Pod
|
|
332
332
|
#
|
333
333
|
attr_accessor :current_target_definition
|
334
334
|
|
335
|
+
public
|
336
|
+
|
337
|
+
# @!group Deprecations
|
335
338
|
#-------------------------------------------------------------------------#
|
336
339
|
|
337
340
|
# @deprecated Deprecated in favour of the more succinct {#pod}. Remove for
|
338
341
|
# CocoaPods 1.0.
|
339
342
|
#
|
340
343
|
def dependency(name = nil, *requirements, &block)
|
341
|
-
warn "[DEPRECATED] `dependency' is deprecated (use `pod')"
|
344
|
+
CoreUI.warn "[DEPRECATED] `dependency' is deprecated (use `pod')"
|
342
345
|
pod(name, *requirements, &block)
|
343
346
|
end
|
344
347
|
|
348
|
+
#-------------------------------------------------------------------------#
|
349
|
+
|
345
350
|
end
|
346
351
|
end
|
@@ -217,7 +217,7 @@ module Pod
|
|
217
217
|
#
|
218
218
|
def target(name, options = {})
|
219
219
|
if options && !options.keys.all? { |key| [:exclusive].include?(key) }
|
220
|
-
raise
|
220
|
+
raise Informative, "Unsupported options `#{options}` for target `#{name}`"
|
221
221
|
end
|
222
222
|
|
223
223
|
parent = current_target_definition
|
@@ -264,10 +264,8 @@ module Pod
|
|
264
264
|
# @return [void]
|
265
265
|
#
|
266
266
|
def platform(name, target = nil)
|
267
|
-
|
268
267
|
# Support for deprecated options parameter
|
269
268
|
target = target[:deployment_target] if target.is_a?(Hash)
|
270
|
-
|
271
269
|
current_target_definition.set_platform(name, target)
|
272
270
|
end
|
273
271
|
|
@@ -105,11 +105,7 @@ module Pod
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
-
|
109
|
-
#
|
110
|
-
def to_s
|
111
|
-
"`#{label}` target definition"
|
112
|
-
end
|
108
|
+
alias :to_s :label
|
113
109
|
|
114
110
|
# @return [String] A string representation suitable for debug.
|
115
111
|
#
|
@@ -1,4 +1,6 @@
|
|
1
|
-
require 'cocoapods-core/source/
|
1
|
+
require 'cocoapods-core/source/acceptor'
|
2
|
+
require 'cocoapods-core/source/aggregate'
|
3
|
+
require 'cocoapods-core/source/health_reporter'
|
2
4
|
|
3
5
|
module Pod
|
4
6
|
|
@@ -18,10 +20,10 @@ module Pod
|
|
18
20
|
#
|
19
21
|
attr_reader :repo
|
20
22
|
|
21
|
-
# @param [Pathname] repo @see #repo.
|
23
|
+
# @param [Pathname, String] repo @see #repo.
|
22
24
|
#
|
23
25
|
def initialize(repo)
|
24
|
-
@repo = repo
|
26
|
+
@repo = Pathname.new(repo)
|
25
27
|
end
|
26
28
|
|
27
29
|
# @return [String] the name of the source.
|
@@ -115,7 +117,7 @@ module Pod
|
|
115
117
|
specs = pods.map do |name|
|
116
118
|
begin
|
117
119
|
versions(name).map { |version| specification(name, version) }
|
118
|
-
rescue
|
120
|
+
rescue
|
119
121
|
CoreUI.warn "Skipping `#{name}` because the podspec contains errors."
|
120
122
|
next
|
121
123
|
end
|
@@ -123,7 +125,7 @@ module Pod
|
|
123
125
|
specs.flatten.compact
|
124
126
|
end
|
125
127
|
|
126
|
-
|
128
|
+
#-------------------------------------------------------------------------#
|
127
129
|
|
128
130
|
# @!group Searching the source
|
129
131
|
|
@@ -168,7 +170,7 @@ module Pod
|
|
168
170
|
end.compact
|
169
171
|
end
|
170
172
|
|
171
|
-
|
173
|
+
#-------------------------------------------------------------------------#
|
172
174
|
|
173
175
|
# @!group Representations
|
174
176
|
|
@@ -179,7 +181,6 @@ module Pod
|
|
179
181
|
def to_hash
|
180
182
|
hash = {}
|
181
183
|
all_specs.each do |spec|
|
182
|
-
print '.'
|
183
184
|
hash[spec.name] ||= {}
|
184
185
|
hash[spec.name][spec.version.version] = spec.to_hash
|
185
186
|
end
|
@@ -193,112 +194,7 @@ module Pod
|
|
193
194
|
to_hash.to_yaml
|
194
195
|
end
|
195
196
|
|
196
|
-
# @return [String] the JSON encoded {to_hash} representation.
|
197
|
-
#
|
198
|
-
def to_json
|
199
|
-
require 'json'
|
200
|
-
to_hash.to_json
|
201
|
-
end
|
202
|
-
|
203
197
|
#-------------------------------------------------------------------------#
|
204
198
|
|
205
|
-
# The Aggregate manages a directory of sources repositories.
|
206
|
-
#
|
207
|
-
class Aggregate
|
208
|
-
|
209
|
-
# @return [Pathname] the directory were the repositories are stored.
|
210
|
-
#
|
211
|
-
attr_reader :repos_dir
|
212
|
-
|
213
|
-
# @param [Pathname] repos_dir @see repos_dir.
|
214
|
-
#
|
215
|
-
def initialize(repos_dir)
|
216
|
-
@repos_dir = repos_dir
|
217
|
-
end
|
218
|
-
|
219
|
-
# @return [Array<Source>] all the sources.
|
220
|
-
#
|
221
|
-
def all
|
222
|
-
@sources ||= dirs.map { |repo| Source.new(repo) }.sort_by(&:name)
|
223
|
-
end
|
224
|
-
|
225
|
-
# @return [Array<String>] the names of all the pods available.
|
226
|
-
#
|
227
|
-
def all_pods
|
228
|
-
all.map(&:pods).flatten.uniq
|
229
|
-
end
|
230
|
-
|
231
|
-
# @return [Array<Set>] the sets for all the pods available.
|
232
|
-
#
|
233
|
-
# @note Implementation detail: The sources don't cache their values
|
234
|
-
# because they might change in response to an update. Therefore
|
235
|
-
# this method to prevent slowness caches the values before
|
236
|
-
# processing them.
|
237
|
-
#
|
238
|
-
def all_sets
|
239
|
-
pods_by_source = {}
|
240
|
-
all.each do |source|
|
241
|
-
pods_by_source[source] = source.pods
|
242
|
-
end
|
243
|
-
sources = pods_by_source.keys
|
244
|
-
pods = pods_by_source.values.flatten.uniq
|
245
|
-
|
246
|
-
pods.map do |pod|
|
247
|
-
pod_sources = sources.select{ |s| pods_by_source[s].include?(pod) }.compact
|
248
|
-
Specification::Set.new(pod, pod_sources)
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
|
-
# @return [Set, nil] a set for a given dependency including all the
|
253
|
-
# {Source} that contain the Pod. If no sources containing the
|
254
|
-
# Pod where found it returns nil.
|
255
|
-
#
|
256
|
-
# @raise If no source including the set can be found.
|
257
|
-
#
|
258
|
-
# @see Source#search
|
259
|
-
#
|
260
|
-
def search(dependency)
|
261
|
-
sources = all.select { |s| !s.search(dependency).nil? }
|
262
|
-
Specification::Set.new(dependency.root_name, sources) unless sources.empty?
|
263
|
-
end
|
264
|
-
|
265
|
-
# @return [Array<Set>] the sets that contain the search term.
|
266
|
-
#
|
267
|
-
# @raise If no source including the set can be found.
|
268
|
-
#
|
269
|
-
# @see Source#search_by_name
|
270
|
-
#
|
271
|
-
def search_by_name(query, full_text_search = false)
|
272
|
-
pods_by_source = {}
|
273
|
-
result = []
|
274
|
-
all.each { |s| pods_by_source[s] = s.search_by_name(query, full_text_search).map(&:name) }
|
275
|
-
root_spec_names = pods_by_source.values.flatten.uniq
|
276
|
-
root_spec_names.each do |pod|
|
277
|
-
sources = []
|
278
|
-
pods_by_source.each{ |source, pods| sources << source if pods.include?(pod) }
|
279
|
-
result << Specification::Set.new(pod, sources)
|
280
|
-
end
|
281
|
-
if result.empty?
|
282
|
-
extra = ", author, summary, or description" if full_text_search
|
283
|
-
raise(Informative, "Unable to find a pod with name" \
|
284
|
-
"#{extra} matching `#{query}'")
|
285
|
-
end
|
286
|
-
result
|
287
|
-
end
|
288
|
-
|
289
|
-
# @return [Array<Pathname>] the directories where the sources are stored.
|
290
|
-
#
|
291
|
-
# @note If the repos dir doesn't exits this will return an empty array.
|
292
|
-
#
|
293
|
-
# @raise If the repos dir doesn't exits.
|
294
|
-
#
|
295
|
-
def dirs
|
296
|
-
if repos_dir.exist?
|
297
|
-
repos_dir.children.select(&:directory?)
|
298
|
-
else
|
299
|
-
[]
|
300
|
-
end
|
301
|
-
end
|
302
|
-
end
|
303
199
|
end
|
304
200
|
end
|