cocoapods-core 0.17.0.rc5 → 0.17.0.rc6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2241963abba89032cf7485e29dfd41b905792192
4
- data.tar.gz: 9ec5663e5ac556ca201c6001bd0bd03686ce532a
3
+ metadata.gz: 3f16df566bf9d03c8f0e5026dbc78ed3d2b2224b
4
+ data.tar.gz: 67af4c059d2f9ffc0cccf953e86b534027a18a43
5
5
  SHA512:
6
- metadata.gz: c6f8a59406a6a8754e0fbf93b8e0312cf2e75294e77a48ee2fcabf4d08691230de7334c3f3aa115c5b229d2019976cdcfb151e1f1ae507c3c268fa9e71eda028
7
- data.tar.gz: 0b65940403213d8ea521805ac73c1a74ae10f4848599c0a43ff26f73010c63f7f8aecd25154a58d890831b30d306e704454407b078a6d3284bbefef3f483a6c5
6
+ metadata.gz: e0ac43dc421675a3dc4f717251d150a3c981147acda279caa52f7e5f5bf3d13c0a4c19a81903f814fa221f364a3354b65583df777abc8369ffbdd19fadb70515
7
+ data.tar.gz: adb5be37a6b3d9fea4f8b9b5be0c42af1432c9c3cc9f89e1a8792033616088a19a3b8f0e9c12b1cfcb27131229995658c587a6f9b266ce367775ac09fe52a2ba
data/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # CocoaPods Core
2
2
 
3
- [![Master Build Status](https://secure.travis-ci.org/CocoaPods/Core.png?branch=master)](https://secure.travis-ci.org/CocoaPods/Core)
3
+ [![Build Status](https://travis-ci.org/CocoaPods/Core.png?branch=master)](https://travis-ci.org/CocoaPods/Core)
4
+ [![Coverage Status](https://coveralls.io/repos/CocoaPods/Core/badge.png?branch=master)](https://coveralls.io/r/CocoaPods/Core)
4
5
 
5
- __This gem has not been released yet__.
6
-
7
- The CocoaPods-Core gem provides support to work with the models of CocoaPods. It is intended to be used in place of the CocoaPods when the the installation of the dependencies is not needed. Therefore, it is suitable for web services.
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 `Pod::Specification::Set::Presenter` suitable for presetting descriptions of Pods and the `Specification::Linter`, which ensures the validity of podspec files.
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 [CocoaPods](https://github.com/CocoaPods/CocoaPods) and one for the [CocoaPods specs](https://github.com/CocoaPods/Specs). Contributing patches or Pods is really easy and gratifying. You even get push access when one of your specs or patches is accepted.
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 information about what's going on in the CocoaPods world.
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.
@@ -1,6 +1,7 @@
1
1
  # The Pod modules name-spaces all the classes of CocoaPods.
2
2
  #
3
3
  module Pod
4
+
4
5
  require 'cocoapods-core/gem_version'
5
6
 
6
7
  # Indicates a runtime error **not** caused by a bug.
@@ -4,16 +4,16 @@ module Pod
4
4
  #
5
5
  module CoreUI
6
6
 
7
- class << self
8
- def puts(message)
9
- STDOUT.puts message
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]
@@ -2,5 +2,5 @@ module Pod
2
2
 
3
3
  # The version of the cocoapods-core.
4
4
  #
5
- CORE_VERSION = '0.17.0.rc5' unless defined? Pod::CORE_VERSION
5
+ CORE_VERSION = '0.17.0.rc6' unless defined? Pod::CORE_VERSION
6
6
  end
@@ -39,10 +39,10 @@ module Pod
39
39
  #
40
40
  def self.from_file(path)
41
41
  return nil unless path.exist?
42
- begin
43
- hash = YAML.load(File.open(path))
44
- rescue Exception => e
45
- raise StandardError, "Podfile.lock syntax error: #{e.inspect}"
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
- pod_name = pod_versions.keys.find { |name| Specification.root_name(name) == pod_name }
99
- pod_versions[pod_name]
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 Installer to prevent the
139
- # Resolver from upgrading a Pod during an installation.
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 reppresentation of the
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(podfile, specs),
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(podfile, specs)
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
@@ -165,7 +165,7 @@ module Pod
165
165
  case symbolic_name
166
166
  when :ios then 'iOS'
167
167
  when :osx then 'OS X'
168
- else symbolic_name end
168
+ else symbolic_name.to_s end
169
169
  end
170
170
  end
171
171
  end
@@ -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 StandardError, "No Podfile exists at path `#{path}`."
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 StandardError, "Unsupported Podfile format `#{path}`."
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 StandardError, "Unsupported options `#{options}` for target `#{name}`"
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
- # @return [String] A string representation suitable for UI.
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/validator'
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 DSLError => e
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