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,17 +1,15 @@
1
1
  module Pod
2
2
  class Specification
3
3
  module DSL
4
-
5
4
  # Provides the accessors methods for the root attributes. Root attributes
6
5
  # do not support multi-platform values and inheritance.
7
6
  #
8
7
  module RootAttributesAccessors
9
-
10
8
  # @return [String] The name of the specification *not* including the
11
9
  # names of the parents, in case of ‘sub-specifications’.
12
10
  #
13
11
  def base_name
14
- attributes_hash["name"]
12
+ attributes_hash['name']
15
13
  end
16
14
 
17
15
  # @return [String] The name of the specification including the names of
@@ -30,7 +28,7 @@ module Pod
30
28
  #
31
29
  def version
32
30
  if root?
33
- @version ||= Version.new(attributes_hash["version"])
31
+ @version ||= Version.new(attributes_hash['version'])
34
32
  else
35
33
  @version ||= root.version
36
34
  end
@@ -49,7 +47,7 @@ module Pod
49
47
  # 'Author'
50
48
  #
51
49
  def authors
52
- authors = attributes_hash["authors"]
50
+ authors = attributes_hash['authors']
53
51
  if authors.is_a?(Hash)
54
52
  authors
55
53
  elsif authors.is_a?(Array)
@@ -70,13 +68,13 @@ module Pod
70
68
  # @return [String] The social media URL.
71
69
  #
72
70
  def social_media_url
73
- attributes_hash["social_media_url"]
71
+ attributes_hash['social_media_url']
74
72
  end
75
73
 
76
74
  # @return [String] The docset URL.
77
75
  #
78
76
  def docset_url
79
- attributes_hash["docset_url"]
77
+ attributes_hash['docset_url']
80
78
  end
81
79
 
82
80
  # @return [Hash] A hash containing the license information of the Pod.
@@ -84,7 +82,7 @@ module Pod
84
82
  # @note The indentation is stripped from the license text.
85
83
  #
86
84
  def license
87
- license = attributes_hash["license"]
85
+ license = attributes_hash['license']
88
86
  if license.is_a?(String)
89
87
  { :type => license }
90
88
  elsif license.is_a?(Hash)
@@ -99,20 +97,20 @@ module Pod
99
97
  # @return [String] The URL of the homepage of the Pod.
100
98
  #
101
99
  def homepage
102
- attributes_hash["homepage"]
100
+ attributes_hash['homepage']
103
101
  end
104
102
 
105
103
  # @return [Hash{Symbol=>String}] The location from where the library
106
104
  # should be retrieved.
107
105
  #
108
106
  def source
109
- convert_keys_to_symbol(attributes_hash["source"])
107
+ convert_keys_to_symbol(attributes_hash['source'])
110
108
  end
111
109
 
112
110
  # @return [String] A short description of the Pod.
113
111
  #
114
112
  def summary
115
- attributes_hash["summary"]
113
+ attributes_hash['summary']
116
114
  end
117
115
 
118
116
  # @return [String] A longer description of the Pod.
@@ -120,7 +118,7 @@ module Pod
120
118
  # @note The indentation is stripped from the description.
121
119
  #
122
120
  def description
123
- description = attributes_hash["description"]
121
+ description = attributes_hash['description']
124
122
  description.strip_heredoc.chomp if description
125
123
  end
126
124
 
@@ -130,23 +128,36 @@ module Pod
130
128
  # @note The value is coerced to an array.
131
129
  #
132
130
  def screenshots
133
- value = attributes_hash["screenshots"]
131
+ value = attributes_hash['screenshots']
134
132
  [*value]
135
133
  end
136
134
 
137
135
  # @return [String, Nil] The documentation URL of the Pod if specified.
138
136
  #
139
137
  def documentation_url
140
- attributes_hash["documentation_url"]
138
+ attributes_hash['documentation_url']
141
139
  end
142
140
 
143
141
  # @return [String, Nil] The prepare command of the Pod if specified.
144
142
  #
145
143
  def prepare_command
146
- command = attributes_hash["prepare_command"]
144
+ command = attributes_hash['prepare_command']
147
145
  command.strip_heredoc.chomp if command
148
146
  end
149
147
 
148
+ # @return [Bool] Whether the Pod has been deprecated.
149
+ #
150
+ def deprecated
151
+ attributes_hash['deprecated']
152
+ end
153
+
154
+ # @return [String] The name of the Pod that this one has been
155
+ # deprecated in favor of.
156
+ #
157
+ def deprecated_in_favor_of
158
+ attributes_hash['deprecated_in_favor_of']
159
+ end
160
+
150
161
  #---------------------------------------------------------------------#
151
162
 
152
163
  private
@@ -169,7 +180,6 @@ module Pod
169
180
  end
170
181
 
171
182
  #---------------------------------------------------------------------#
172
-
173
183
  end
174
184
  end
175
185
  end
@@ -3,12 +3,10 @@ require 'active_support/core_ext/array/conversions'
3
3
  module Pod
4
4
  class Specification
5
5
  class Set
6
-
7
6
  # Provides support for presenting a Pod described by a {Set} in a
8
7
  # consistent way across clients of CocoaPods-Core.
9
8
  #
10
9
  class Presenter
11
-
12
10
  # @return [Set] the set that should be presented.
13
11
  #
14
12
  attr_reader :set
@@ -44,7 +42,7 @@ module Pod
44
42
  # order.
45
43
  #
46
44
  def versions
47
- @set.versions.sort.reverse
45
+ @set.versions
48
46
  end
49
47
 
50
48
  # @return [String] all the versions available sorted from the highest
@@ -219,20 +217,19 @@ module Pod
219
217
 
220
218
  case distance_in_days
221
219
  when 0..7
222
- "less than a week ago"
220
+ 'less than a week ago'
223
221
  when 8..29
224
222
  "#{distance_in_days} days ago"
225
223
  when 30..45
226
- "1 month ago"
224
+ '1 month ago'
227
225
  when 46..365
228
226
  "#{(distance_in_days.to_f / 30).round} months ago"
229
227
  else
230
- "more than a year ago"
228
+ 'more than a year ago'
231
229
  end
232
230
  end
233
231
 
234
232
  #---------------------------------------------------------------------#
235
-
236
233
  end
237
234
  end
238
235
  end
@@ -1,7 +1,6 @@
1
1
  module Pod
2
2
  class Specification
3
3
  class Set
4
-
5
4
  # The statistics class provides information about one or more {Set} that
6
5
  # is not readily available because expensive to compute or provided by a
7
6
  # remote source.
@@ -15,7 +14,6 @@ module Pod
15
14
  # cache file a shared instance is also available.
16
15
  #
17
16
  class Statistics
18
-
19
17
  # @return [Statistics] the shared statistics instance.
20
18
  #
21
19
  def self.instance
@@ -155,7 +153,7 @@ module Pod
155
153
  def cache
156
154
  unless @cache
157
155
  if cache_file && cache_file.exist?
158
- @cache = YAML.load(cache_file.read)
156
+ @cache = YAMLHelper.load(cache_file.read)
159
157
  else
160
158
  @cache = {}
161
159
  end
@@ -259,7 +257,6 @@ module Pod
259
257
  end
260
258
 
261
259
  #---------------------------------------------------------------------#
262
-
263
260
  end
264
261
  end
265
262
  end
@@ -4,7 +4,6 @@ require 'cocoapods-core/specification/set/statistics'
4
4
 
5
5
  module Pod
6
6
  class Specification
7
-
8
7
  # A Specification::Set is responsible of handling all the specifications of
9
8
  # a Pod. This class stores the information of the dependencies that required
10
9
  # a Pod in the resolution process.
@@ -16,7 +15,6 @@ module Pod
16
15
  # of a Source.
17
16
  #
18
17
  class Set
19
-
20
18
  # @return [String] the name of the Pod.
21
19
  #
22
20
  attr_reader :name
@@ -206,7 +204,6 @@ module Pod
206
204
  # @note External sources *don't* support subspecs.
207
205
  #
208
206
  class External < Set
209
-
210
207
  attr_reader :specification
211
208
 
212
209
  def initialize(spec)
@@ -219,7 +216,7 @@ module Pod
219
216
  end
220
217
 
221
218
  def specification_path
222
- raise StandardError, "specification_path"
219
+ raise StandardError, 'specification_path'
223
220
  end
224
221
 
225
222
  def versions
@@ -6,7 +6,6 @@ require 'cocoapods-core/specification/set'
6
6
  require 'cocoapods-core/specification/json'
7
7
 
8
8
  module Pod
9
-
10
9
  # The Specification provides a DSL to describe a Pod. A pod is defined as a
11
10
  # library originating from a source. A specification can support detailed
12
11
  # attributes for modules of code through subspecs.
@@ -14,7 +13,6 @@ module Pod
14
13
  # Usually it is stored in files with `podspec` extension.
15
14
  #
16
15
  class Specification
17
-
18
16
  include Pod::Specification::DSL
19
17
  include Pod::Specification::DSL::Deprecations
20
18
  include Pod::Specification::RootAttributesAccessors
@@ -100,7 +98,7 @@ module Pod
100
98
  elsif name
101
99
  name
102
100
  else
103
- "No-name"
101
+ 'No-name'
104
102
  end
105
103
  end
106
104
 
@@ -207,7 +205,7 @@ module Pod
207
205
  else
208
206
  remainder = relative_name[base_name.size + 1..-1]
209
207
  subspec_name = remainder.split('/').shift
210
- subspec = subspecs.find { |s| s.name == "#{name}/#{subspec_name}" }
208
+ subspec = subspecs.find { |s| s.base_name == subspec_name }
211
209
  unless subspec
212
210
  raise Informative, "Unable to find a specification named " \
213
211
  "`#{relative_name}` in `#{name} (#{version})`."
@@ -219,7 +217,7 @@ module Pod
219
217
  # @return [String] the name of the default subspec if provided.
220
218
  #
221
219
  def default_subspec
222
- attributes_hash["default_subspec"]
220
+ attributes_hash['default_subspec']
223
221
  end
224
222
 
225
223
  # Returns the dependencies on subspecs.
@@ -232,7 +230,7 @@ module Pod
232
230
  #
233
231
  def subspec_dependencies(platform = nil)
234
232
  if default_subspec
235
- specs = [subspec_by_name("#{name}/#{default_subspec}")]
233
+ specs = [root.subspec_by_name("#{name}/#{default_subspec}")]
236
234
  else
237
235
  specs = subspecs.compact
238
236
  end
@@ -290,7 +288,9 @@ module Pod
290
288
  # source.
291
289
  #
292
290
  def local?
293
- !(source[:path] || source[:local]).nil? rescue false
291
+ return true if source[:path]
292
+ return true if source[:local]
293
+ false
294
294
  end
295
295
 
296
296
  # @return [Bool] whether the specification is supported in the given
@@ -359,7 +359,7 @@ module Pod
359
359
  # information.
360
360
  #
361
361
  def platform_hash
362
- case value = attributes_hash["platforms"]
362
+ case value = attributes_hash['platforms']
363
363
  when String
364
364
  { value => nil }
365
365
  when Array
@@ -536,7 +536,7 @@ module Pod
536
536
 
537
537
  string = File.open(path, 'r:utf-8') { |f| f.read }
538
538
  # Work around for Rubinius incomplete encoding in 1.9 mode
539
- if string.respond_to?(:encoding) && string.encoding.name != "UTF-8"
539
+ if string.respond_to?(:encoding) && string.encoding.name != 'UTF-8'
540
540
  string.encode!('UTF-8')
541
541
  end
542
542
 
@@ -582,7 +582,7 @@ module Pod
582
582
  #
583
583
  def defined_in_file=(file)
584
584
  unless root?
585
- raise StandardError, "Defined in file can be set only for root specs."
585
+ raise StandardError, 'Defined in file can be set only for root specs.'
586
586
  end
587
587
  @defined_in_file = file
588
588
  end
@@ -1,5 +1,4 @@
1
1
  module Pod
2
-
3
2
  # Namespaces all the errors raised by CocoaPods.
4
3
  #
5
4
  class StandardError < ::StandardError; end
@@ -10,7 +9,6 @@ module Pod
10
9
  # contents of the line that raised the exception.
11
10
  #
12
11
  class DSLError < Informative
13
-
14
12
  # @return [String] the description that should be presented to the user.
15
13
  #
16
14
  attr_reader :description
@@ -65,8 +63,8 @@ module Pod
65
63
  line_numer = trace_line.split(':')[1].to_i - 1
66
64
  return m unless line_numer
67
65
  lines = File.readlines(dsl_path.to_s)
68
- indent = " # "
69
- indicator = indent.dup.gsub("#", ">")
66
+ indent = ' # '
67
+ indicator = indent.dup.gsub('#', '>')
70
68
  first_line = (line_numer.zero?)
71
69
  last_line = (line_numer == (lines.count - 1))
72
70
 
@@ -78,7 +76,7 @@ module Pod
78
76
  m << "#{indent}#{ lines[line_numer + 1] }" unless last_line
79
77
  m << "\n" unless m.end_with?("\n")
80
78
  m << "#{indent}-------------------------------------------\n"
81
- m << ""
79
+ m << ''
82
80
  @message = m
83
81
  end
84
82
  @message
@@ -1,9 +1,7 @@
1
1
  module Pod
2
-
3
2
  # Namespaces the vendored modules.
4
3
  #
5
4
  module Vendor
6
-
7
5
  # Namespaces the classes of RubyGems used by CocoaPods.
8
6
  #
9
7
  # CocoaPods needs to vendor RubyGems because OS X ships with `v1.3.6` which
@@ -19,7 +17,6 @@ module Pod
19
17
  # - replaced `::Gem` with `Pod::Vendor::Gem`
20
18
  #
21
19
  module Gem
22
-
23
20
  require 'cocoapods-core/vendor/version'
24
21
  require 'cocoapods-core/vendor/requirement'
25
22
 
@@ -48,7 +45,6 @@ module Pod
48
45
  # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
49
46
  # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
50
47
  # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
51
-
52
48
  end
53
49
  end
54
50
  end
@@ -1,5 +1,4 @@
1
1
  module Pod
2
-
3
2
  # The Version class stores information about the version of a
4
3
  # {Specification}.
5
4
  #
@@ -31,7 +30,6 @@ module Pod
31
30
  # 4. 0.9
32
31
  #
33
32
  class Version < Pod::Vendor::Gem::Version
34
-
35
33
  # Override the constants defined by the superclass to add Semantic
36
34
  # Versioning prerelease support (with a dash). E.g.: 1.0.0-alpha1
37
35
  #
@@ -43,7 +41,7 @@ module Pod
43
41
  # @return [Bool] whether the version represents the `head` of repository.
44
42
  #
45
43
  attr_accessor :head
46
- alias_method :head?, :head
44
+ alias_method :head?, :head
47
45
 
48
46
  # @param [String,Version] version
49
47
  # A string representing a version, or another version.
@@ -139,6 +137,5 @@ module Pod
139
137
  end
140
138
 
141
139
  #-------------------------------------------------------------------------#
142
-
143
140
  end
144
141
  end
@@ -1,5 +1,4 @@
1
1
  module Pod
2
-
3
2
  # Converts objects to their YAML representation.
4
3
  #
5
4
  # This class was created for the need having control on how the YAML is
@@ -15,10 +14,8 @@ module Pod
15
14
  # The missing features include:
16
15
  # - Strings are never quoted even when ambiguous.
17
16
  #
18
- class YAMLConverter
19
-
17
+ class YAMLHelper
20
18
  class << self
21
-
22
19
  # Returns the YAML representation of the given object. If the given object
23
20
  # is an Hash it accepts an optional hint for sorting the keys.
24
21
  #
@@ -41,6 +38,18 @@ module Pod
41
38
  result << "\n"
42
39
  end
43
40
 
41
+ # Load a YAML file and provide more informative error messages in special cases like merge conflict.
42
+ # @param A YAML string.
43
+ def load(yaml_string)
44
+ YAML.load(yaml_string)
45
+ rescue Exception => exception
46
+ if yaml_has_merge_error(yaml_string)
47
+ raise Informative, 'Merge conflict(s) detected'
48
+ else
49
+ raise exception
50
+ end
51
+ end
52
+
44
53
  #-----------------------------------------------------------------------#
45
54
 
46
55
  private
@@ -111,7 +120,7 @@ module Pod
111
120
  processed_key = process_according_to_class(key)
112
121
  case key_value
113
122
  when Array, Hash
114
- key_partial_yaml = processed.lines.map { |line| " #{line}" } * ""
123
+ key_partial_yaml = processed.lines.map { |line| " #{line}" } * ''
115
124
  key_lines << "#{processed_key}:\n#{key_partial_yaml}"
116
125
  else
117
126
  key_lines << "#{processed_key}: #{processed}"
@@ -120,6 +129,13 @@ module Pod
120
129
  key_lines * line_separator
121
130
  end
122
131
 
132
+ # Check for merge errors in a YAML string.
133
+ # @param A YAML string.
134
+ # @return If a merge error was detected or not.
135
+ def yaml_has_merge_error(yaml_string)
136
+ yaml_string.include?('<<<<<<< HEAD')
137
+ end
138
+
123
139
  #-----------------------------------------------------------------------#
124
140
 
125
141
  private
@@ -179,7 +195,7 @@ module Pod
179
195
  # @return [String] A string useful to compare the value with other ones.
180
196
  #
181
197
  def sorting_string(value)
182
- return "" unless value
198
+ return '' unless value
183
199
  case value
184
200
  when String then value.downcase
185
201
  when Symbol then sorting_string(value.to_s)
@@ -1,7 +1,6 @@
1
1
  # The Pod modules name-spaces all the classes of CocoaPods.
2
2
  #
3
3
  module Pod
4
-
5
4
  require 'cocoapods-core/gem_version'
6
5
 
7
6
  # Indicates a runtime error **not** caused by a bug.
@@ -28,10 +27,9 @@ module Pod
28
27
  autoload :Source, 'cocoapods-core/source'
29
28
  autoload :Specification, 'cocoapods-core/specification'
30
29
  autoload :StandardError, 'cocoapods-core/standard_error'
31
- autoload :YAMLConverter, 'cocoapods-core/yaml_converter'
30
+ autoload :YAMLHelper, 'cocoapods-core/yaml_helper'
32
31
 
33
32
  # TODO: Fix
34
33
  #
35
34
  Spec = Specification
36
-
37
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.1
4
+ version: 0.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-01 00:00:00.000000000 Z
12
+ date: 2014-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -127,6 +127,8 @@ files:
127
127
  - lib/cocoapods-core/specification/dsl/platform_proxy.rb
128
128
  - lib/cocoapods-core/specification/json.rb
129
129
  - lib/cocoapods-core/specification/linter.rb
130
+ - lib/cocoapods-core/specification/linter/analyzer.rb
131
+ - lib/cocoapods-core/specification/linter/result.rb
130
132
  - lib/cocoapods-core/specification/root_attribute_accessors.rb
131
133
  - lib/cocoapods-core/specification/set.rb
132
134
  - lib/cocoapods-core/specification/set/presenter.rb
@@ -136,7 +138,7 @@ files:
136
138
  - lib/cocoapods-core/vendor/requirement.rb
137
139
  - lib/cocoapods-core/vendor/version.rb
138
140
  - lib/cocoapods-core/version.rb
139
- - lib/cocoapods-core/yaml_converter.rb
141
+ - lib/cocoapods-core/yaml_helper.rb
140
142
  homepage: https://github.com/CocoaPods/CocoaPods
141
143
  licenses:
142
144
  - MIT