cocoapods-core 0.31.1 → 0.32.0

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cocoapods-core/core_ui.rb +0 -3
  3. data/lib/cocoapods-core/dependency.rb +2 -5
  4. data/lib/cocoapods-core/gem_version.rb +1 -2
  5. data/lib/cocoapods-core/github.rb +2 -5
  6. data/lib/cocoapods-core/lockfile.rb +9 -12
  7. data/lib/cocoapods-core/platform.rb +15 -6
  8. data/lib/cocoapods-core/podfile/dsl.rb +3 -5
  9. data/lib/cocoapods-core/podfile/target_definition.rb +2 -5
  10. data/lib/cocoapods-core/podfile.rb +6 -12
  11. data/lib/cocoapods-core/requirement.rb +3 -7
  12. data/lib/cocoapods-core/source/abstract_data_provider.rb +6 -9
  13. data/lib/cocoapods-core/source/acceptor.rb +36 -10
  14. data/lib/cocoapods-core/source/aggregate.rb +2 -5
  15. data/lib/cocoapods-core/source/file_system_data_provider.rb +7 -10
  16. data/lib/cocoapods-core/source/github_data_provider.rb +13 -12
  17. data/lib/cocoapods-core/source/health_reporter.rb +1 -5
  18. data/lib/cocoapods-core/source.rb +0 -3
  19. data/lib/cocoapods-core/specification/consumer.rb +3 -37
  20. data/lib/cocoapods-core/specification/dsl/attribute.rb +15 -8
  21. data/lib/cocoapods-core/specification/dsl/attribute_support.rb +0 -2
  22. data/lib/cocoapods-core/specification/dsl/deprecations.rb +8 -7
  23. data/lib/cocoapods-core/specification/dsl/platform_proxy.rb +4 -6
  24. data/lib/cocoapods-core/specification/dsl.rb +146 -144
  25. data/lib/cocoapods-core/specification/json.rb +1 -3
  26. data/lib/cocoapods-core/specification/linter/analyzer.rb +93 -0
  27. data/lib/cocoapods-core/specification/linter/result.rb +113 -0
  28. data/lib/cocoapods-core/specification/linter.rb +66 -278
  29. data/lib/cocoapods-core/specification/root_attribute_accessors.rb +26 -16
  30. data/lib/cocoapods-core/specification/set/presenter.rb +4 -7
  31. data/lib/cocoapods-core/specification/set/statistics.rb +1 -4
  32. data/lib/cocoapods-core/specification/set.rb +1 -4
  33. data/lib/cocoapods-core/specification.rb +10 -10
  34. data/lib/cocoapods-core/standard_error.rb +3 -5
  35. data/lib/cocoapods-core/vendor.rb +0 -4
  36. data/lib/cocoapods-core/version.rb +1 -4
  37. data/lib/cocoapods-core/{yaml_converter.rb → yaml_helper.rb} +22 -6
  38. data/lib/cocoapods-core.rb +1 -3
  39. metadata +5 -3
@@ -1,12 +1,10 @@
1
1
  module Pod
2
2
  class Source
3
-
4
3
  # Data provider for a `Pod::Source` backed by a repository hosted on GitHub
5
4
  # and accessed via the HTTP API. Only pure JSON repos using the `Specs`
6
5
  # subdir to store the specifications are supported.
7
6
  #
8
7
  class GitHubDataProvider < AbstractDataProvider
9
-
10
8
  # @return [String] The identifier of the repository (user name and repo
11
9
  # name) or the full URL of the repo.
12
10
  #
@@ -39,14 +37,14 @@ module Pod
39
37
  # @return [String] The user friendly type of the source.
40
38
  #
41
39
  def type
42
- "GitHub API"
40
+ 'GitHub API'
43
41
  end
44
42
 
45
43
  # @return [Array<String>] The list of the name of all the Pods known to
46
44
  # the Source.
47
45
  #
48
46
  def pods
49
- root_contents = get_github_contents("Specs")
47
+ root_contents = get_github_contents('Specs')
50
48
  pods = dir_names(root_contents)
51
49
  pods.sort if pods
52
50
  end
@@ -58,9 +56,13 @@ module Pod
58
56
  # The name of the Pod.
59
57
  #
60
58
  def versions(name)
61
- raise ArgumentError, "No name" unless name
59
+ raise ArgumentError, 'No name' unless name
62
60
  contents = get_github_contents("Specs/#{name}")
63
- dir_names(contents)
61
+ pre_vers = dir_names(contents)
62
+ return nil if pre_vers.nil?
63
+ pre_vers.each do |v|
64
+ Version.new(v)
65
+ end.sort.reverse.map(&:to_s)
64
66
  end
65
67
 
66
68
  # @return [Specification] The specification for a given version of a Pod.
@@ -72,8 +74,8 @@ module Pod
72
74
  # The version of the Pod.
73
75
  #
74
76
  def specification(name, version)
75
- raise ArgumentError, "No name" unless name
76
- raise ArgumentError, "No version" unless version
77
+ raise ArgumentError, 'No name' unless name
78
+ raise ArgumentError, 'No version' unless version
77
79
  spec_content = specification_contents(name, version)
78
80
  if spec_content
79
81
  Pod::Specification.from_json(spec_content)
@@ -90,13 +92,13 @@ module Pod
90
92
  # the version of the Pod.
91
93
  #
92
94
  def specification_contents(name, version)
93
- raise ArgumentError, "No name" unless name
94
- raise ArgumentError, "No version" unless version
95
+ raise ArgumentError, 'No name' unless name
96
+ raise ArgumentError, 'No version' unless version
95
97
  path = "Specs/#{name}/#{version}/#{name}.podspec.json"
96
98
  file_contents = get_github_contents(path)
97
99
  if file_contents
98
100
  if file_contents['encoding'] == 'base64'
99
- require "base64"
101
+ require 'base64'
100
102
  Base64.decode64(file_contents['content'])
101
103
  end
102
104
  end
@@ -137,7 +139,6 @@ module Pod
137
139
  end
138
140
 
139
141
  #-----------------------------------------------------------------------#
140
-
141
142
  end
142
143
  end
143
144
  end
@@ -1,10 +1,8 @@
1
1
  module Pod
2
2
  class Source
3
-
4
3
  # Checks a source for errors and warnings.
5
4
  #
6
5
  class HealthReporter
7
-
8
6
  # @return [Source] the source to check.
9
7
  #
10
8
  attr_reader :source
@@ -127,7 +125,7 @@ module Pod
127
125
  all_paths = Pathname.glob(source.data_provider.repo + '**/*.podspec{,.json}')
128
126
  stray_specs = all_paths - report.analyzed_paths
129
127
  stray_specs.each do |path|
130
- report.add_message(:error, "Stray spec", path)
128
+ report.add_message(:error, 'Stray spec', path)
131
129
  end
132
130
  end
133
131
 
@@ -136,7 +134,6 @@ module Pod
136
134
  # Encapsulates the information about the state of a repo.
137
135
  #
138
136
  class HealthReport
139
-
140
137
  # @return [Source] the source analyzed.
141
138
  #
142
139
  attr_reader :source
@@ -195,7 +192,6 @@ module Pod
195
192
  end
196
193
 
197
194
  #-----------------------------------------------------------------------#
198
-
199
195
  end
200
196
  end
201
197
  end
@@ -6,7 +6,6 @@ require 'cocoapods-core/source/file_system_data_provider'
6
6
  require 'cocoapods-core/source/github_data_provider'
7
7
 
8
8
  module Pod
9
-
10
9
  # The Source class is responsible to manage a collection of podspecs.
11
10
  #
12
11
  # The backing store of the podspecs collection is an implementation detail
@@ -18,7 +17,6 @@ module Pod
18
17
  # "#{SPEC_NAME}/#{VERSION}/#{SPEC_NAME}.podspec"
19
18
  #
20
19
  class Source
21
-
22
20
  # @return [AbstractDataProvider] the data provider for this source.
23
21
  #
24
22
  attr_accessor :data_provider
@@ -300,6 +298,5 @@ module Pod
300
298
  end
301
299
 
302
300
  #-------------------------------------------------------------------------#
303
-
304
301
  end
305
302
  end
@@ -2,7 +2,6 @@ require 'active_support/core_ext/string/strip.rb'
2
2
 
3
3
  module Pod
4
4
  class Specification
5
-
6
5
  # Allows to conveniently access a Specification programmatically.
7
6
  #
8
7
  # It takes care of:
@@ -18,7 +17,6 @@ module Pod
18
17
  # serializing a specification back exactly as defined in a file.
19
18
  #
20
19
  class Consumer
21
-
22
20
  # @return [Specification] The specification to consume.
23
21
  #
24
22
  attr_reader :spec
@@ -157,8 +155,6 @@ module Pod
157
155
 
158
156
  #-----------------------------------------------------------------------#
159
157
 
160
- # @!group Dependencies
161
-
162
158
  # @return [Array<Dependency>] the dependencies on other Pods.
163
159
  #
164
160
  def dependencies
@@ -168,10 +164,10 @@ module Pod
168
164
  end
169
165
  end
170
166
 
167
+ # Raw values need to be prepared as soon as they are read so they can be
168
+ # safely merged to support multi platform attributes and inheritance
171
169
  #-----------------------------------------------------------------------#
172
170
 
173
- private
174
-
175
171
  # Returns the value for the attribute with the given name for the
176
172
  # specification. It takes into account inheritance, multi-platform
177
173
  # attributes and default values.
@@ -297,37 +293,8 @@ module Pod
297
293
  end
298
294
  end
299
295
 
300
- #-----------------------------------------------------------------------#
301
-
302
- private
303
-
304
- # Converts the keys of the given hash to a string.
305
- #
306
- # @todo Removed if not used by `resources_bundle`
307
- #
308
- # @param [Object] value
309
- # the value that needs to be stripped from the Symbols.
310
- #
311
- # @return [Hash] the hash with the strings instead of the keys.
312
- #
313
- # def convert_keys_to_symbol(value)
314
- # return unless value
315
- # result = {}
316
- # value.each do |key, subvalue|
317
- # subvalue = convert_keys_to_symbol(subvalue) if subvalue.is_a?(Hash)
318
- # result[key.to_sym] = subvalue
319
- # end
320
- # result
321
- # end
322
-
323
- #-----------------------------------------------------------------------#
324
-
325
- private
326
-
327
296
  # @!group Preparing Values
328
- #
329
- # Raw values need to be prepared as soon as they are read so they can be
330
- # safely merged to support multi platform attributes and inheritance
297
+ #-----------------------------------------------------------------------#
331
298
 
332
299
  # @return [String] the name of the prepare hook for this attribute.
333
300
  #
@@ -372,7 +339,6 @@ module Pod
372
339
  end
373
340
 
374
341
  #-----------------------------------------------------------------------#
375
-
376
342
  end
377
343
  end
378
344
  end
@@ -1,12 +1,10 @@
1
1
  module Pod
2
2
  class Specification
3
3
  module DSL
4
-
5
4
  # A Specification attribute stores the information of an attribute. It
6
5
  # also provides logic to implement any required logic.
7
6
  #
8
7
  class Attribute
9
-
10
8
  require 'active_support/inflector/inflections'
11
9
 
12
10
  # @return [Symbol] the name of the attribute.
@@ -112,28 +110,38 @@ module Pod
112
110
  # @return [Bool] whether the specification should be considered invalid
113
111
  # if a value for the attribute is not specified.
114
112
  #
115
- def required?; @required; end
113
+ def required?
114
+ @required
115
+ end
116
116
 
117
117
  # @return [Bool] whether the attribute should be specified only on the
118
118
  # root specification.
119
119
  #
120
- def root_only?; @root_only; end
120
+ def root_only?
121
+ @root_only
122
+ end
121
123
 
122
124
  # @return [Bool] whether the attribute is multi-platform and should
123
125
  # work in conjunction with #{PlatformProxy}.
124
126
  #
125
- def multi_platform?; @multi_platform; end
127
+ def multi_platform?
128
+ @multi_platform
129
+ end
126
130
 
127
131
  # @return [Bool] whether there should be a singular alias for the
128
132
  # attribute writer.
129
133
  #
130
- def singularize?; @singularize; end
134
+ def singularize?
135
+ @singularize
136
+ end
131
137
 
132
138
  # @return [Bool] whether the attribute describes file patterns.
133
139
  #
134
140
  # @note This is mostly used by the linter.
135
141
  #
136
- def file_patterns?; @file_patterns; end
142
+ def file_patterns?
143
+ @file_patterns
144
+ end
137
145
 
138
146
  # @return [Bool] defines whether the attribute reader should join the
139
147
  # values with the parent.
@@ -236,7 +244,6 @@ module Pod
236
244
  end
237
245
 
238
246
  #-----------------------------------------------------------------------#
239
-
240
247
  end
241
248
  end
242
249
  end
@@ -1,7 +1,6 @@
1
1
  module Pod
2
2
  class Specification
3
3
  module DSL
4
-
5
4
  # @return [Array<Attribute>] The attributes of the class.
6
5
  #
7
6
  def self.attributes
@@ -12,7 +11,6 @@ module Pod
12
11
  # {Specification} DSL.
13
12
  #
14
13
  module AttributeSupport
15
-
16
14
  # Defines a root attribute for the extended class.
17
15
  #
18
16
  # Root attributes make sense only in root specification, they never are
@@ -1,11 +1,9 @@
1
1
  module Pod
2
2
  class Specification
3
3
  module DSL
4
-
5
4
  # Provides warning and errors for the deprecated attributes of the DSL.
6
5
  #
7
6
  module Deprecations
8
-
9
7
  def preferred_dependency=(name)
10
8
  self.default_subspec = name
11
9
  CoreUI.warn "[#{self}] `preferred_dependency` has been renamed "\
@@ -16,14 +14,14 @@ module Pod
16
14
  if method == :pre_install
17
15
  CoreUI.warn "[#{self}] The use of `#{method}` by overriding " \
18
16
  "the method is deprecated."
19
- @pre_install_callback = Proc.new do |pod, target_definition|
17
+ @pre_install_callback = proc do |pod, target_definition|
20
18
  pre_install(pod, target_definition)
21
19
  end
22
20
 
23
21
  elsif method == :post_install
24
22
  CoreUI.warn "[#{self}] The use of `#{method}` by overriding the " \
25
23
  "method is deprecated."
26
- @post_install_callback = Proc.new do |target_installer|
24
+ @post_install_callback = proc do |target_installer|
27
25
  post_install(target_installer)
28
26
  end
29
27
 
@@ -95,7 +93,9 @@ module Pod
95
93
  def pre_install(&block)
96
94
  CoreUI.warn "[#{self}] The pre install hook of the specification " \
97
95
  "DSL has been deprecated, use the `resource_bundles` or the " \
98
- "`prepare_command` attributes."
96
+ "`prepare_command` attributes."
97
+ CoreUI.warn "[#{self}] The pre_install hook will be removed in " \
98
+ "the next release"
99
99
  @pre_install_callback = block
100
100
  end
101
101
 
@@ -125,12 +125,13 @@ module Pod
125
125
  def post_install(&block)
126
126
  CoreUI.warn "[#{self}] The post install hook of the specification " \
127
127
  "DSL has been deprecated, use the `resource_bundles` or the " \
128
- "`prepare_command` attributes."
128
+ "`prepare_command` attributes."
129
+ CoreUI.warn "[#{self}] The post_install hook will be removed in " \
130
+ "the next release"
129
131
  @post_install_callback = block
130
132
  end
131
133
 
132
134
  #-----------------------------------------------------------------------#
133
-
134
135
  end
135
136
  end
136
137
  end
@@ -1,12 +1,10 @@
1
1
  module Pod
2
2
  class Specification
3
3
  module DSL
4
-
5
4
  # The PlatformProxy works in conjunction with Specification#_on_platform.
6
5
  # It provides support for a syntax like `spec.ios.source_files = 'file'`.
7
6
  #
8
7
  class PlatformProxy
9
-
10
8
  # @return [Specification] the specification for this platform proxy.
11
9
  #
12
10
  attr_accessor :spec
@@ -52,8 +50,8 @@ module Pod
52
50
  name, *version_requirements = args
53
51
  platform_name = platform.to_s
54
52
  platform_hash = spec.attributes_hash[platform_name] || {}
55
- platform_hash["dependencies"] ||= {}
56
- platform_hash["dependencies"][name] = version_requirements
53
+ platform_hash['dependencies'] ||= {}
54
+ platform_hash['dependencies'][name] = version_requirements
57
55
  spec.attributes_hash[platform_name] = platform_hash
58
56
  end
59
57
 
@@ -63,8 +61,8 @@ module Pod
63
61
  #
64
62
  def deployment_target=(value)
65
63
  platform_name = platform.to_s
66
- spec.attributes_hash["platforms"] ||= {}
67
- spec.attributes_hash["platforms"][platform_name] = value
64
+ spec.attributes_hash['platforms'] ||= {}
65
+ spec.attributes_hash['platforms'][platform_name] = value
68
66
  end
69
67
  end
70
68
  end