cocoapods-core 0.38.2 → 0.39.0.beta.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3fc24da680129a3130376b3444590ac2a77b2fb
4
- data.tar.gz: 3f949758aef66e352df50571f21dbe0eff9bf7bd
3
+ metadata.gz: c783da84523246e5bc4076ef3f3713a231028d1a
4
+ data.tar.gz: bbae7cfc7b1d93c750c1162e6b0d11166db0fa80
5
5
  SHA512:
6
- metadata.gz: c8e9c2da39000cd59549884a794575a74331e774731a3641539eb366df1d333945ad7acad22e632ba7bd94e74f7f3105bd53eba06d4161fd020d586462ba9279
7
- data.tar.gz: 0d8568b52cf35e7361017fae55e9551f02d3fe56e069682db950d89054c180e86307589c1634fa165fd03cf023f902dc448d1d06f9a6d3210943e99ec7dcb62a
6
+ metadata.gz: 3c856b520fe158afc3adaa6f91e41fd913af0f58496a3068b690420149c8c5e6fdff7a1e60570a5d52cfe19057cafa06f22a1cf889b3f46cb81f65086f0f9021
7
+ data.tar.gz: 68a0026ddeb29950db30f3b834cd743361cf6e086fdcb56ba811096221f95a0ceba3a2e1b7f04e214ecc810a51392b818aeb99c5dbf805db842ce70473498c27
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  # The version of the cocoapods-core.
3
3
  #
4
- CORE_VERSION = '0.38.2' unless defined? Pod::CORE_VERSION
4
+ CORE_VERSION = '0.39.0.beta.1' unless defined? Pod::CORE_VERSION
5
5
  end
@@ -30,7 +30,7 @@ module Pod
30
30
  # end
31
31
  #
32
32
  # post_install do |installer|
33
- # installer.project.targets.each do |target|
33
+ # installer.pods_project.targets.each do |target|
34
34
  # puts "#{target.name}"
35
35
  # end
36
36
  # end
@@ -695,7 +695,13 @@ module Pod
695
695
  podfile.defined_in_file.dirname + name
696
696
  elsif options[:autodetect]
697
697
  glob_pattern = podfile.defined_in_file.dirname + '*.podspec{,.json}'
698
- Pathname.glob(glob_pattern).first
698
+ path = Pathname.glob(glob_pattern).first
699
+ unless path
700
+ raise Informative, 'Could not locate a podspec in the current directory. '\
701
+ 'You can specify the path via the path option.'
702
+ end
703
+
704
+ path
699
705
  end
700
706
  end
701
707
 
@@ -15,6 +15,8 @@ module Pod
15
15
  #
16
16
  PATTERN = /\A\s*(#{quoted_operators})?\s*(#{Version::VERSION_PATTERN})\s*\z/
17
17
 
18
+ DefaultRequirement = ['>=', Version.new(0)] # rubocop:disable Style/ConstantName
19
+
18
20
  #-------------------------------------------------------------------------#
19
21
 
20
22
  # Factory method to create a new requirement.
@@ -66,6 +68,37 @@ module Pod
66
68
  [operator, version]
67
69
  end
68
70
 
71
+ # Constructs a requirement from `requirements`.
72
+ #
73
+ # @param [String, Version, Array<String>, Array<Version>] requirements
74
+ # The set of requirements
75
+ #
76
+ # @note Duplicate requirements are ignored.
77
+ #
78
+ # @note An empty set of `requirements` is the same as `">= 0"`
79
+ #
80
+ def initialize(*requirements)
81
+ requirements = requirements.flatten
82
+ requirements.compact!
83
+ requirements.uniq!
84
+
85
+ if requirements.empty?
86
+ @requirements = [DefaultRequirement]
87
+ else
88
+ @requirements = requirements.map! { |r| self.class.parse r }
89
+ end
90
+ end
91
+
92
+ #
93
+ # @return [Bool] true if this pod has no requirements.
94
+ #
95
+ def none?
96
+ if @requirements.size == 1
97
+ @requirements[0] == DefaultRequirement
98
+ else
99
+ false
100
+ end
101
+ end
69
102
  #-------------------------------------------------------------------------#
70
103
  end
71
104
  end
@@ -91,8 +91,8 @@ module Pod
91
91
  linter = Specification::Linter.new(spec_path)
92
92
  linter.lint
93
93
  linter.results.each do |result|
94
- type = result.type == :error ? :error : :warning
95
- report.add_message(type, result.message, name, version)
94
+ next if result.public_only?
95
+ report.add_message(result.type, result.message, name, version)
96
96
  end
97
97
  linter.spec
98
98
  end
@@ -183,15 +183,10 @@ module Pod
183
183
  # @return [void]
184
184
  #
185
185
  def add_message(type, message, spec_name, spec_version = nil)
186
- if type == :error
187
- pods_by_error[message] ||= {}
188
- pods_by_error[message][spec_name] ||= []
189
- pods_by_error[message][spec_name] << spec_version
190
- else
191
- pods_by_warning[message] ||= {}
192
- pods_by_warning[message][spec_name] ||= []
193
- pods_by_warning[message][spec_name] << spec_version
194
- end
186
+ pods = send(:"pods_by_#{type}")
187
+ pods[message] ||= {}
188
+ pods[message][spec_name] ||= []
189
+ pods[message][spec_name] << spec_version
195
190
  end
196
191
  end
197
192
 
@@ -221,10 +221,14 @@ module Pod
221
221
  # LICENSE
222
222
  # }
223
223
  #
224
- # @param [String, Hash{Symbol=>String}] license
225
- # The type of the license and the text of the grant that
226
- # allows to use the library (or the relative path to the file
227
- # that contains it).
224
+ # @param [String] license
225
+ # The type of the license
226
+ #
227
+ # @overload license=(license)
228
+ # @param [String, Hash{Symbol=>String}] license
229
+ # @option license [String] :type license type
230
+ # @option license [String] :file file containing full license text. Supports txt, md, and markdown
231
+ # @option license [String] :text full license text
228
232
  #
229
233
  root_attribute :license,
230
234
  :container => Hash,
@@ -290,8 +294,36 @@ module Pod
290
294
  # spec.source = { :http => 'http://dev.wechatapp.com/download/sdk/WeChat_SDK_iOS_en.zip',
291
295
  # :sha1 => '7e21857fe11a511f472cfd7cfa2d979bd7ab7d96' }
292
296
  #
293
- # @param [Hash{Symbol=>String}] source
294
- # The location from where the library should be retrieved.
297
+ #
298
+ # @overload source=(git)
299
+ # @param [Hash] git
300
+ # @option git [String] :git git source URI
301
+ # @option git [String] :tag version tag
302
+ # @option git [Bool] :submodules Whether to checkout submodules
303
+ # @option git [String] :branch branch name
304
+ # @option git [String] :commit commit hash
305
+ #
306
+ # @overload source=(svn)
307
+ # @param [Hash] svn
308
+ # @option svn [String] :svn svn source URI
309
+ # @option svn [String] :tag version tag
310
+ # @option svn [String] :folder folder
311
+ # @option svn [String] :revision revision
312
+ #
313
+ # @overload source=(hg)
314
+ # @param [Hash] hg
315
+ # @option hg [String] :hg mercurial source URI
316
+ # @option hg [String] :revision revision
317
+ #
318
+ # @overload source=(http)
319
+ # @param [Hash] http
320
+ # @option http [String] :http compressed source URL
321
+ # @option http [String] :type file type. Supports zip, tgz, bz2, txz and tar
322
+ # @option http [String] :sha1 SHA hash. Supports SHA1 and SHA256
323
+ #
324
+ # @overload source=(path)
325
+ # @param [Hash] path
326
+ # @option path [String] :path local source path
295
327
  #
296
328
  root_attribute :source,
297
329
  :container => Hash,
@@ -244,14 +244,14 @@ module Pod
244
244
  # Performs validations related to the `description` attribute.
245
245
  #
246
246
  def _validate_description(d)
247
- if d =~ /An optional longer description of/
248
- results.add_warning('description', 'The description is not meaningful.')
249
- end
250
247
  if d == spec.summary
251
248
  results.add_warning('description', 'The description is equal to' \
252
249
  ' the summary.')
253
250
  end
254
- if d.length < spec.summary.length
251
+
252
+ if d.strip.empty?
253
+ results.add_error('description', 'The description is empty.')
254
+ elsif d.length < spec.summary.length
255
255
  results.add_warning('description', 'The description is shorter ' \
256
256
  'than the summary.')
257
257
  end
@@ -347,7 +347,7 @@ module Pod
347
347
  ' the Git tag.')
348
348
  end
349
349
  if tag.nil?
350
- results.add_warning('source', 'Git sources should specify a tag.')
350
+ results.add_warning('source', 'Git sources should specify a tag.', true)
351
351
  end
352
352
  end
353
353
 
@@ -389,7 +389,7 @@ module Pod
389
389
  end
390
390
  unless git_uri.scheme == 'https'
391
391
  results.add_warning('github_sources', 'Github repositories ' \
392
- 'should use an `https` link.')
392
+ 'should use an `https` link.', true)
393
393
  end
394
394
  end
395
395
 
@@ -400,7 +400,7 @@ module Pod
400
400
  if git =~ /\w+\@(\w|\.)+\:(\/\w+)*/
401
401
  results.add_warning('source', 'Git SSH URLs will NOT work for ' \
402
402
  'people behind firewalls configured to only allow HTTP, ' \
403
- 'therefore HTTPS is preferred.')
403
+ 'therefore HTTPS is preferred.', true)
404
404
  end
405
405
  end
406
406
  end
@@ -17,13 +17,19 @@ module Pod
17
17
  #
18
18
  attr_reader :message
19
19
 
20
+ # @return [Boolean] whether the result only applies to public specs.
21
+ #
22
+ attr_reader :public_only
23
+ alias_method :public_only?, :public_only
24
+
20
25
  # @param [Symbol] type @see type
21
26
  # @param [String] message @see message
22
27
  #
23
- def initialize(type, attribute_name, message)
28
+ def initialize(type, attribute_name, message, public_only = false)
24
29
  @type = type
25
30
  @attribute_name = attribute_name
26
31
  @message = message
32
+ @public_only = public_only
27
33
  @platforms = []
28
34
  end
29
35
 
@@ -72,8 +78,8 @@ module Pod
72
78
  #
73
79
  # @return [void]
74
80
  #
75
- def add_error(attribute_name, message)
76
- add_result(:error, attribute_name, message)
81
+ def add_error(attribute_name, message, public_only = false)
82
+ add_result(:error, attribute_name, message, public_only)
77
83
  end
78
84
 
79
85
  # Adds a warning result with the given message.
@@ -83,8 +89,8 @@ module Pod
83
89
  #
84
90
  # @return [void]
85
91
  #
86
- def add_warning(attribute_name, message)
87
- add_result(:warning, attribute_name, message)
92
+ def add_warning(attribute_name, message, public_only = false)
93
+ add_result(:warning, attribute_name, message, public_only)
88
94
  end
89
95
 
90
96
  private
@@ -106,12 +112,12 @@ module Pod
106
112
  #
107
113
  # @return [void]
108
114
  #
109
- def add_result(type, attribute_name, message)
115
+ def add_result(type, attribute_name, message, public_only)
110
116
  result = results.find do |r|
111
- r.type == type && r.attribute_name == attribute_name && r.message == message
117
+ r.type == type && r.attribute_name == attribute_name && r.message == message && r.public_only? == public_only
112
118
  end
113
119
  unless result
114
- result = Result.new(type, attribute_name, message)
120
+ result = Result.new(type, attribute_name, message, public_only)
115
121
  results << result
116
122
  end
117
123
  result.platforms << @consumer.platform_name if @consumer
@@ -140,10 +140,47 @@ module Pod
140
140
  numeric_segments[2].to_i
141
141
  end
142
142
 
143
- private
143
+ # Compares the versions for sorting.
144
+ #
145
+ # @param [Version] other
146
+ # The other version to compare.
147
+ #
148
+ # @return [Fixnum] -1, 0, or +1 depending on whether the receiver is less
149
+ # than, equal to, or greater than other.
150
+ #
151
+ # @note Attempts to compare something that's not a {Version} return nil
152
+ #
153
+ def <=>(other)
154
+ return unless other.is_a?(Pod::Version)
155
+ return 0 if @version == other.version
156
+
157
+ compare = proc do |segments, other_segments|
158
+ limit = [segments.size, other_segments.size].max
159
+
160
+ (0..limit).each do |i|
161
+ lhs, rhs = segments[i] || 0, other_segments[i] || 0
162
+
163
+ next if lhs == rhs
164
+ return lhs <=> rhs if lhs <=> rhs
165
+ return -1 if lhs.is_a?(String) && rhs.is_a?(Numeric)
166
+ return 1 if lhs.is_a?(Numeric) && rhs.is_a?(String)
167
+ end
168
+ end
169
+
170
+ compare[numeric_segments, other.numeric_segments]
171
+ compare[prerelease_segments, other.prerelease_segments]
172
+
173
+ version <=> other.version
174
+ end
175
+
176
+ protected
144
177
 
145
178
  def numeric_segments
146
- segments.take_while { |s| s.is_a?(Numeric) }
179
+ segments.take_while { |s| s.is_a?(Numeric) }.reverse_each.drop_while { |s| s == 0 }.reverse
180
+ end
181
+
182
+ def prerelease_segments
183
+ segments.drop_while { |s| s.is_a?(Numeric) }
147
184
  end
148
185
 
149
186
  #-------------------------------------------------------------------------#
@@ -94,16 +94,10 @@ module Pod
94
94
  #
95
95
  def process_according_to_class(value, hash_keys_hint = nil)
96
96
  case value
97
- when String then YAML.dump(value).sub(/^---/, '').sub(/[.]{3}\s*$/, '').strip
98
- when Symbol then ":#{value}"
99
- when TrueClass then 'true'
100
- when FalseClass then 'false'
101
97
  when Array then process_array(value)
102
98
  when Hash then process_hash(value, hash_keys_hint)
103
- else
104
- raise StandardError, 'Unsupported class for YAML conversion ' \
105
- "#{value.class}"
106
- end
99
+ else YAML.dump(value).sub(/\A---/, '').sub(/[.]{3}\s*\Z/, '').strip
100
+ end.strip
107
101
  end
108
102
 
109
103
  # Converts an array to YAML after sorting it.
@@ -114,9 +108,8 @@ module Pod
114
108
  # @return [String] the YAML representation of the given object.
115
109
  #
116
110
  def process_array(array)
117
- result = []
118
- sorted_array(array).each do |array_value|
119
- result << process_according_to_class(array_value)
111
+ result = sorted_array(array).map do |array_value|
112
+ process_according_to_class(array_value)
120
113
  end
121
114
  "- #{result * "\n- "}"
122
115
  end
@@ -138,17 +131,16 @@ module Pod
138
131
  #
139
132
  def process_hash(hash, hash_keys_hint = nil, line_separator = "\n")
140
133
  keys = sorted_array_with_hint(hash.keys, hash_keys_hint)
141
- key_lines = []
142
- keys.each do |key|
134
+ key_lines = keys.map do |key|
143
135
  key_value = hash[key]
144
136
  processed = process_according_to_class(key_value)
145
137
  processed_key = process_according_to_class(key)
146
138
  case key_value
147
139
  when Array, Hash
148
140
  key_partial_yaml = processed.lines.map { |line| " #{line}" } * ''
149
- key_lines << "#{processed_key}:\n#{key_partial_yaml}"
141
+ "#{processed_key}:\n#{key_partial_yaml}"
150
142
  else
151
- key_lines << "#{processed_key}: #{processed}"
143
+ "#{processed_key}: #{processed}"
152
144
  end
153
145
  end
154
146
  key_lines * line_separator
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.38.2
4
+ version: 0.39.0.beta.1
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: 2015-07-25 00:00:00.000000000 Z
12
+ date: 2015-08-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport