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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cocoapods-core.rb +0 -2
  3. data/lib/cocoapods-core/core_ui.rb +0 -1
  4. data/lib/cocoapods-core/dependency.rb +20 -15
  5. data/lib/cocoapods-core/gem_version.rb +1 -1
  6. data/lib/cocoapods-core/github.rb +1 -1
  7. data/lib/cocoapods-core/lockfile.rb +15 -11
  8. data/lib/cocoapods-core/platform.rb +10 -6
  9. data/lib/cocoapods-core/podfile.rb +18 -11
  10. data/lib/cocoapods-core/podfile/dsl.rb +25 -23
  11. data/lib/cocoapods-core/podfile/target_definition.rb +60 -36
  12. data/lib/cocoapods-core/requirement.rb +2 -2
  13. data/lib/cocoapods-core/source.rb +34 -10
  14. data/lib/cocoapods-core/source/acceptor.rb +12 -8
  15. data/lib/cocoapods-core/source/aggregate.rb +22 -9
  16. data/lib/cocoapods-core/source/health_reporter.rb +2 -2
  17. data/lib/cocoapods-core/specification.rb +14 -12
  18. data/lib/cocoapods-core/specification/consumer.rb +8 -6
  19. data/lib/cocoapods-core/specification/dsl.rb +66 -18
  20. data/lib/cocoapods-core/specification/dsl/attribute.rb +5 -4
  21. data/lib/cocoapods-core/specification/dsl/deprecations.rb +35 -23
  22. data/lib/cocoapods-core/specification/dsl/platform_proxy.rb +16 -11
  23. data/lib/cocoapods-core/specification/linter.rb +107 -36
  24. data/lib/cocoapods-core/specification/root_attribute_accessors.rb +16 -4
  25. data/lib/cocoapods-core/specification/set.rb +41 -24
  26. data/lib/cocoapods-core/specification/set/presenter.rb +7 -5
  27. data/lib/cocoapods-core/specification/yaml.rb +6 -2
  28. data/lib/cocoapods-core/standard_error.rb +3 -3
  29. data/lib/cocoapods-core/vendor.rb +0 -1
  30. data/lib/cocoapods-core/vendor/requirement.rb +9 -9
  31. data/lib/cocoapods-core/vendor/version.rb +143 -140
  32. data/lib/cocoapods-core/version.rb +5 -6
  33. data/lib/cocoapods-core/yaml_converter.rb +3 -2
  34. metadata +17 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af31824facc02d25a56d57de96dbc18b7689456f
4
- data.tar.gz: 9bf7a512add7a278d436298a05d1ac5f7d363dca
3
+ metadata.gz: 59ebc8caae99ff0b103a68db5da56f145260a701
4
+ data.tar.gz: eb4956ae204fe1e15a008927bc56ab09c5c0ca57
5
5
  SHA512:
6
- metadata.gz: fc07397515bdc6b0c8ac06402763c283bf5710f058c9062bd4513d8977a58b06601b7052a1ac4c4300ca9f182637e63c96962e7919667ba52b05602ea895ecb5
7
- data.tar.gz: 591980cb02962d1e296d876599920a5632c1a602238cc944c89fecfdff66c99a4ee4f5daf6eaabe66c332c32050ea4969aa07b0c2600c48697f62d86197f7615
6
+ metadata.gz: 59cdc3c942852b9143f88b3218c378071e4266a6f197cfa86ad7ca84bef718cd26fe4418792b0e65a4951481e06304d2054a3d541cf9ca6847f238ec0d6ce829
7
+ data.tar.gz: 3a090a0ab43fc39016d6a079571b66834b8ca04dd3a4cff462aa31883afee60cba36dc3e79af1b1bd4087bc9ddf651b094fee85e531f0f7d2565f8a04d06f166
@@ -35,5 +35,3 @@ module Pod
35
35
  Spec = Specification
36
36
 
37
37
  end
38
-
39
-
@@ -16,4 +16,3 @@ module Pod
16
16
 
17
17
  end
18
18
  end
19
-
@@ -73,14 +73,16 @@ module Pod
73
73
  if requirements.last.is_a?(Hash)
74
74
  @external_source = requirements.pop
75
75
  unless requirements.empty?
76
- raise Informative, "A dependency with an external source may not specify version requirements (#{name})."
76
+ raise Informative, "A dependency with an external source may not " \
77
+ "specify version requirements (#{name})."
77
78
  end
78
79
 
79
80
  elsif requirements.last == :head
80
81
  @head = true
81
82
  requirements.pop
82
83
  unless requirements.empty?
83
- raise Informative, "A `:head` dependency may not specify version requirements (#{name})."
84
+ raise Informative, "A `:head` dependency may not specify version " \
85
+ "requirements (#{name})."
84
86
  end
85
87
  end
86
88
 
@@ -103,8 +105,11 @@ module Pod
103
105
  # be better to add something like Version#display_string.
104
106
  #
105
107
  def requirement
106
- return Requirement.new(Version.new(specific_version.version)) if specific_version
107
- @requirement
108
+ if specific_version
109
+ Requirement.new(Version.new(specific_version.version))
110
+ else
111
+ @requirement
112
+ end
108
113
  end
109
114
 
110
115
  # @return [Bool] whether the dependency points to a subspec.
@@ -175,7 +180,7 @@ module Pod
175
180
  return false unless external_source == other.external_source
176
181
 
177
182
  other.requirement.requirements.all? do | operator, version |
178
- self.requirement.satisfied_by? Version.new(version)
183
+ requirement.satisfied_by? Version.new(version)
179
184
  end
180
185
  end
181
186
 
@@ -184,13 +189,13 @@ module Pod
184
189
  # external source.
185
190
  #
186
191
  def ==(other)
187
- Dependency === other &&
192
+ self.class == other.class &&
188
193
  name == other.name &&
189
194
  requirement == other.requirement &&
190
195
  head? == other.head? &&
191
196
  external_source == other.external_source
192
197
  end
193
- alias :eql? :==
198
+ alias_method :eql?, :==
194
199
 
195
200
  # @return [Fixnum] The hash value based on the name and on the
196
201
  # requirements.
@@ -202,8 +207,8 @@ module Pod
202
207
  # @return [Fixnum] How the dependency should be sorted respect to another
203
208
  # one according to its name.
204
209
  #
205
- def <=> other
206
- self.name <=> other.name
210
+ def <=>(other)
211
+ name <=> other.name
207
212
  end
208
213
 
209
214
  # Merges the version requirements of the dependency with another one.
@@ -218,11 +223,11 @@ module Pod
218
223
  # includes also the version requirements of the given one.
219
224
  #
220
225
  def merge(other)
221
- unless name == other.name then
226
+ unless name == other.name
222
227
  raise ArgumentError, "#{self} and #{other} have different names"
223
228
  end
224
229
  default = Requirement.default
225
- self_req = self.requirement
230
+ self_req = requirement
226
231
  other_req = other.requirement
227
232
 
228
233
  if other_req == default
@@ -254,7 +259,7 @@ module Pod
254
259
  # @return [Bool] Whether the dependency is satisfied.
255
260
  #
256
261
  def match?(name, version)
257
- return false unless self.name === name
262
+ return false unless self.name == name
258
263
  return true if requirement.none?
259
264
  requirement.satisfied_by?(Version.new(version))
260
265
  end
@@ -313,7 +318,7 @@ module Pod
313
318
  match_data = string.match(/(\S*)( (.*))?/)
314
319
  name = match_data[1]
315
320
  version = match_data[2]
316
- version = version.gsub(/[()]/,'') if version
321
+ version = version.gsub(/[()]/, '') if version
317
322
  case version
318
323
  when nil || /from `(.*)(`|')/
319
324
  Dependency.new(name)
@@ -328,8 +333,8 @@ module Pod
328
333
  # @return [String] a string representation suitable for debugging.
329
334
  #
330
335
  def inspect
331
- "<#{self.class} name=#{self.name} requirements=#{requirement.to_s} " \
332
- "external_source=#{external_source||'nil'}>"
336
+ "<#{self.class} name=#{name} requirements=#{requirement.to_s} " \
337
+ "external_source=#{external_source || 'nil'}>"
333
338
  end
334
339
 
335
340
  #--------------------------------------#
@@ -2,5 +2,5 @@ module Pod
2
2
 
3
3
  # The version of the cocoapods-core.
4
4
  #
5
- CORE_VERSION = '0.27.1' unless defined? Pod::CORE_VERSION
5
+ CORE_VERSION = '0.28.0' unless defined? Pod::CORE_VERSION
6
6
  end
@@ -80,7 +80,7 @@ module Pod
80
80
  # @return [Nil] if the given url is not a valid github repo url.
81
81
  #
82
82
  def self.repo_id_from_url(url)
83
- url[/github.com\/([^\/\.]*\/[^\/\.]*)\.*/, 1]
83
+ url[%r[github.com/([^/\.]*/[^/\.]*)\.*], 1]
84
84
  end
85
85
 
86
86
  # Performs a get request with the given URL.
@@ -12,7 +12,7 @@ module Pod
12
12
  #
13
13
  class Lockfile
14
14
 
15
- # TODO The symbols should be converted to a String and back to symbol
15
+ # @todo The symbols should be converted to a String and back to symbol
16
16
  # when reading (EXTERNAL SOURCES Download options)
17
17
 
18
18
  # @return [String] the hash used to initialize the Lockfile.
@@ -56,7 +56,7 @@ module Pod
56
56
  # @return [Bool] Whether the Podfiles are equal.
57
57
  #
58
58
  def ==(other)
59
- other && self.to_hash == other.to_hash
59
+ other && to_hash == other.to_hash
60
60
  end
61
61
 
62
62
  # @return [String] a string representation suitable for debugging.
@@ -89,7 +89,9 @@ module Pod
89
89
  def version(pod_name)
90
90
  version = pod_versions[pod_name]
91
91
  return version if version
92
- root_name = pod_versions.keys.find { |name| Specification.root_name(name) == pod_name }
92
+ root_name = pod_versions.keys.find do |name|
93
+ Specification.root_name(name) == pod_name
94
+ end
93
95
  pod_versions[root_name]
94
96
  end
95
97
 
@@ -140,7 +142,8 @@ module Pod
140
142
  version = version(name)
141
143
 
142
144
  unless dep && version
143
- raise StandardError, "Attempt to lock the `#{name}` Pod without an known dependency."
145
+ raise StandardError, "Attempt to lock the `#{name}` Pod without an " \
146
+ "known dependency."
144
147
  end
145
148
 
146
149
  locked_dependency = dep.dup
@@ -229,9 +232,11 @@ module Pod
229
232
  #
230
233
  def detect_changes_with_podfile(podfile)
231
234
  result = {}
232
- [ :added, :changed, :removed, :unchanged ].each { |k| result[k] = [] }
235
+ [:added, :changed, :removed, :unchanged].each { |k| result[k] = [] }
233
236
 
234
- installed_deps = dependencies.map { |d| dependency_to_lock_pod_named(d.name) }
237
+ installed_deps = dependencies.map do |dep|
238
+ dependency_to_lock_pod_named(dep.name)
239
+ end
235
240
  all_dep_names = (dependencies + podfile.dependencies).map(&:name).uniq
236
241
  all_dep_names.each do |name|
237
242
  installed_dep = installed_deps.find { |d| d.name == name }
@@ -239,7 +244,7 @@ module Pod
239
244
 
240
245
  if installed_dep.nil? then key = :added
241
246
  elsif podfile_dep.nil? then key = :removed
242
- elsif podfile_dep.compatible?(installed_dep ) then key = :unchanged
247
+ elsif podfile_dep.compatible?(installed_dep) then key = :unchanged
243
248
  else key = :changed
244
249
  end
245
250
  result[key] << name
@@ -262,7 +267,7 @@ module Pod
262
267
  #
263
268
  def write_to_disk(path)
264
269
  path.dirname.mkpath unless path.dirname.exist?
265
- File.open(path, 'w') {|f| f.write(to_yaml) }
270
+ File.open(path, 'w') { |f| f.write(to_yaml) }
266
271
  self.defined_in_file = path
267
272
  end
268
273
 
@@ -391,7 +396,7 @@ module Pod
391
396
  # @return [Array] the generated data.
392
397
  #
393
398
  def generate_dependencies_data(podfile)
394
- podfile.dependencies.map{ |d| d.to_s }.sort
399
+ podfile.dependencies.map { |d| d.to_s }.sort
395
400
  end
396
401
 
397
402
  # Generates the information of the external sources.
@@ -409,7 +414,7 @@ module Pod
409
414
  #
410
415
  def generate_external_sources_data(podfile)
411
416
  deps = podfile.dependencies.select(&:external?)
412
- deps = deps.sort { |d, other| d.name <=> other.name}
417
+ deps = deps.sort { |d, other| d.name <=> other.name }
413
418
  sources = {}
414
419
  deps.each { |d| sources[d.root_name] = d.external_source }
415
420
  sources
@@ -437,4 +442,3 @@ module Pod
437
442
  end
438
443
  end
439
444
  end
440
-
@@ -100,7 +100,7 @@ module Pod
100
100
  def supports?(other)
101
101
  other = Platform.new(other)
102
102
  if other.deployment_target && deployment_target
103
- (other.name == name) && (other.deployment_target <= deployment_target)
103
+ (other.name == name) && (other.deployment_target <= deployment_target)
104
104
  else
105
105
  other.name == name
106
106
  end
@@ -119,7 +119,7 @@ module Pod
119
119
  #
120
120
  def inspect
121
121
  "#<#{self.class.name} name=#{name.inspect} " \
122
- "deployment_target=#{deployment_target.inspect}>"
122
+ "deployment_target=#{deployment_target.inspect}>"
123
123
  end
124
124
 
125
125
  # @return [Symbol] a symbol representing the name of the platform.
@@ -137,10 +137,10 @@ module Pod
137
137
  # @return [Fixnum] -1, 0, or +1 depending on whether the receiver is less
138
138
  # than, equal to, or greater than other.
139
139
  #
140
- def <=> other
141
- name_sort = self.name.to_s <=> other.name.to_s
140
+ def <=>(other)
141
+ name_sort = name.to_s <=> other.name.to_s
142
142
  if name_sort.zero?
143
- self.deployment_target <=> other.deployment_target
143
+ deployment_target <=> other.deployment_target
144
144
  else
145
145
  name_sort
146
146
  end
@@ -150,7 +150,11 @@ module Pod
150
150
  # iOS.
151
151
  #
152
152
  def requires_legacy_ios_archs?
153
- (name == :ios) && deployment_target && (deployment_target < Version.new("4.3"))
153
+ if name == :ios
154
+ deployment_target && (deployment_target < Version.new("4.3"))
155
+ else
156
+ false
157
+ end
154
158
  end
155
159
 
156
160
  # Converts the symbolic name of a platform to a string name suitable to be
@@ -172,11 +172,11 @@ module Pod
172
172
 
173
173
  # @return [Array] The keys used by the hash representation of the Podfile.
174
174
  #
175
- HASH_KEYS = [
176
- 'target_definitions',
177
- 'workspace',
178
- 'generate_bridge_support',
179
- 'set_arc_compatibility_flag',
175
+ HASH_KEYS = %w[
176
+ target_definitions
177
+ workspace
178
+ generate_bridge_support
179
+ set_arc_compatibility_flag
180
180
  ].freeze
181
181
 
182
182
  # @return [Hash] The hash representation of the Podfile.
@@ -234,16 +234,19 @@ module Pod
234
234
  # @return [Podfile] the new Podfile
235
235
  #
236
236
  def self.from_ruby(path)
237
- string = File.open(path, 'r:utf-8') { |f| f.read }
237
+ string = File.open(path, 'r:utf-8') { |f| f.read }
238
238
  # Work around for Rubinius incomplete encoding in 1.9 mode
239
239
  if string.respond_to?(:encoding) && string.encoding.name != "UTF-8"
240
240
  string.encode!('UTF-8')
241
241
  end
242
242
  podfile = Podfile.new(path) do
243
243
  begin
244
+ # rubocop:disable Eval
244
245
  eval(string, nil, path.to_s)
246
+ # rubocop:enable Eval
245
247
  rescue Exception => e
246
- raise DSLError.new("Invalid `#{path.basename}` file: #{e.message}", path, e.backtrace)
248
+ message = "Invalid `#{path.basename}` file: #{e.message}"
249
+ raise DSLError.new(message, path, e.backtrace)
247
250
  end
248
251
  end
249
252
  podfile
@@ -261,7 +264,7 @@ module Pod
261
264
  # @return [Podfile] the new Podfile
262
265
  #
263
266
  def self.from_yaml(path)
264
- string = File.open(path, 'r:utf-8') { |f| f.read }
267
+ string = File.open(path, 'r:utf-8') { |f| f.read }
265
268
  # Work around for Rubinius incomplete encoding in 1.9 mode
266
269
  if string.respond_to?(:encoding) && string.encoding.name != "UTF-8"
267
270
  string.encode!('UTF-8')
@@ -283,7 +286,7 @@ module Pod
283
286
  def self.from_hash(hash, path = nil)
284
287
  internal_hash = hash.dup
285
288
  target_definitions = internal_hash.delete('target_definitions') || []
286
- podfile = Podfile.new(path,internal_hash)
289
+ podfile = Podfile.new(path, internal_hash)
287
290
  target_definitions.each do |definition_hash|
288
291
  definition = TargetDefinition.from_hash(definition_hash, podfile)
289
292
  podfile.root_target_definitions << definition
@@ -314,7 +317,9 @@ module Pod
314
317
  # @return [void]
315
318
  #
316
319
  def set_hash_value(key, value)
317
- raise StandardError, "Unsupported hash key `#{key}`" unless HASH_KEYS.include?(key)
320
+ unless HASH_KEYS.include?(key)
321
+ raise StandardError, "Unsupported hash key `#{key}`"
322
+ end
318
323
  internal_hash[key] = value
319
324
  end
320
325
 
@@ -328,7 +333,9 @@ module Pod
328
333
  # @return [Object] The value for the key.
329
334
  #
330
335
  def get_hash_value(key)
331
- raise StandardError, "Unsupported hash key `#{key}`" unless HASH_KEYS.include?(key)
336
+ unless HASH_KEYS.include?(key)
337
+ raise StandardError, "Unsupported hash key `#{key}`"
338
+ end
332
339
  internal_hash[key]
333
340
  end
334
341
 
@@ -36,13 +36,13 @@ module Pod
36
36
  module DSL
37
37
 
38
38
  # @!group Dependencies
39
- # The Podfile specifies the dependencies of each user target.
39
+ # The Podfile specifies the dependencies of each user target.
40
40
  #
41
41
  # * `pod` is the way to declare a specific dependency.
42
42
  # * `podspec` provides an easy creation API for local podspecs.
43
- # * `target` allows you to scope your dependencies to specific
43
+ # * `target` allows you to scope your dependencies to specific
44
44
  # targets in your Xcode projects.
45
-
45
+
46
46
  #-----------------------------------------------------------------------#
47
47
 
48
48
  # Specifies a dependency of the project.
@@ -149,7 +149,8 @@ module Pod
149
149
  #
150
150
  def pod(name = nil, *requirements, &block)
151
151
  if block
152
- raise StandardError, "Inline specifications are deprecated. Please store the specification in a `podspec` file."
152
+ raise StandardError, "Inline specifications are deprecated. " \
153
+ "Please store the specification in a `podspec` file."
153
154
  end
154
155
 
155
156
  unless name
@@ -173,8 +174,8 @@ module Pod
173
174
  # podspec :path => '/Documents/PrettyKit/PrettyKit.podspec'
174
175
  #
175
176
  # @param [Hash {Symbol=>String}] options
176
- # the path where to load the {Specification}. If not provided the
177
- # first podspec in the directory of the podfile is used.
177
+ # the path where to load the {Specification}. If not provided
178
+ # the first podspec in the directory of the podfile is used.
178
179
  #
179
180
  # @option options [String] :path
180
181
  # the path of the podspec file
@@ -195,9 +196,10 @@ module Pod
195
196
  current_target_definition.store_podspec(options)
196
197
  end
197
198
 
198
- # Defines a new static library target and scopes dependencies defined from
199
- # the given block. The target will by default include the dependencies
200
- # defined outside of the block, unless the `:exclusive => true` option is
199
+ # Defines a new static library target and scopes dependencies defined
200
+ # from the given block. The target will by default include the
201
+ # dependencies defined outside of the block, unless the `:exclusive =>
202
+ # true` option is
201
203
  # given.
202
204
  #
203
205
  # ---
@@ -232,7 +234,8 @@ module Pod
232
234
  #
233
235
  def target(name, options = {})
234
236
  if options && !options.keys.all? { |key| [:exclusive].include?(key) }
235
- raise Informative, "Unsupported options `#{options}` for target `#{name}`"
237
+ raise Informative, "Unsupported options `#{options}` for " \
238
+ "target `#{name}`"
236
239
  end
237
240
 
238
241
  parent = current_target_definition
@@ -250,9 +253,9 @@ module Pod
250
253
  # These settings are used to control the CocoaPods generated project.
251
254
  #
252
255
  # This starts out simply with stating what `platform` you are working
253
- # on. `xcodeproj` allows you to state specifically which project to
254
- # link with.
255
-
256
+ # on. `xcodeproj` allows you to state specifically which project to
257
+ # link with.
258
+
256
259
  #-----------------------------------------------------------------------#
257
260
 
258
261
  # Specifies the platform for which a static library should be build.
@@ -284,8 +287,8 @@ module Pod
284
287
  current_target_definition.set_platform(name, target)
285
288
  end
286
289
 
287
- # Specifies the Xcode project that contains the target that the Pods library
288
- # should be linked with.
290
+ # Specifies the Xcode project that contains the target that the Pods
291
+ # library should be linked with.
289
292
  #
290
293
  # -----
291
294
  #
@@ -304,12 +307,12 @@ module Pod
304
307
  # the path of the project to link with
305
308
  #
306
309
  # @param [Hash{String => symbol}] build_configurations
307
- # a hash where the keys are the name of the build configurations
308
- # in your Xcode project and the values are Symbols that specify
309
- # if the configuration should be based on the `:debug` or
310
- # `:release` configuration. If no explicit mapping is specified
311
- # for a configuration in your project, it will default to
312
- # `:release`.
310
+ # a hash where the keys are the name of the build
311
+ # configurations in your Xcode project and the values are
312
+ # Symbols that specify if the configuration should be based on
313
+ # the `:debug` or `:release` configuration. If no explicit
314
+ # mapping is specified for a configuration in your project, it
315
+ # will default to `:release`.
313
316
  #
314
317
  # @example Specifying the user project
315
318
  #
@@ -366,7 +369,7 @@ module Pod
366
369
  #
367
370
  # This attribute is inherited by child target definitions.
368
371
  #
369
- # If you would like to inhibit warnings per Pod you can use the
372
+ # If you would like to inhibit warnings per Pod you can use the
370
373
  # following syntax:
371
374
  #
372
375
  # pod 'SSZipArchive', :inhibit_warnings => true
@@ -493,4 +496,3 @@ module Pod
493
496
  end
494
497
  end
495
498
  end
496
-