cocoapods-core 0.32.1 → 0.33.0

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: 3e65de23fab7eda8ee9fcb101341196de5efd0ab
4
- data.tar.gz: 4b0380f9e82363c6837aa7c8b307ea4d1ff40c3b
3
+ metadata.gz: 3027dc0811cd3a77bff386f6d4588b713ef62fa4
4
+ data.tar.gz: 018a952724e184ff563060d930a652f6afd269d6
5
5
  SHA512:
6
- metadata.gz: a6a8aba3bbba2e3d08965c77b03bc4c09984d411055f3928fe2f0e098f7692f60c9ccd26bb193c601bd33a57adf3b31971a3a76979a85c2bba3b106ebdbce9a8
7
- data.tar.gz: bead4903cc06f2a8652bd0deeef587f3ec5228e5f2d247965857ff3116931d3e3551153bf9e2de41aa8a9b7d5fee37ec63db1d45990d8e9c77b1c255eb5e79ae
6
+ metadata.gz: 3e0758fa6d998b89ec79a5be08cef619183d069df347e4dca359b4469b63ece30b4a53c9ce19ccf77bc01442d8f8e6de0e17b781f622ef7f462c448c633f66e1
7
+ data.tar.gz: e153cf162558e21c9ab134e0476bfc666c6e85798d228fdd0942a6a6c6a0e38acef489f4e2b17218440832ba95e382ea4a2f96a0717980b3d7f32a8e0927e3d2
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # CocoaPods Core
2
2
 
3
- [![Build Status](https://travis-ci.org/CocoaPods/Core.svg?branch=master)](https://travis-ci.org/CocoaPods/Core)
4
- [![Coverage Status](https://img.shields.io/coveralls/CocoaPods/Core.svg)](https://coveralls.io/r/CocoaPods/Core)
5
- [![Code Climate](https://img.shields.io/codeclimate/github/CocoaPods/Core.svg)](https://codeclimate.com/github/CocoaPods/Core)
3
+ [![Build Status](https://img.shields.io/travis/CocoaPods/Core/master.svg?style=flat)](https://travis-ci.org/CocoaPods/Core)
4
+ [![Coverage](https://img.shields.io/codeclimate/coverage/github/CocoaPods/Core.svg?style=flat)](https://codeclimate.com/github/CocoaPods/Core)
5
+ [![Code Climate](https://img.shields.io/codeclimate/github/CocoaPods/Core.svg?style=flat)](https://codeclimate.com/github/CocoaPods/Core)
6
6
 
7
7
  The CocoaPods-Core gem provides support to work with the models of CocoaPods.
8
8
  It is intended to be used in place of the CocoaPods when the installation
@@ -21,6 +21,7 @@ module Pod
21
21
  autoload :CoreUI, 'cocoapods-core/core_ui'
22
22
  autoload :DSLError, 'cocoapods-core/standard_error'
23
23
  autoload :GitHub, 'cocoapods-core/github'
24
+ autoload :HTTP, 'cocoapods-core/http'
24
25
  autoload :Lockfile, 'cocoapods-core/lockfile'
25
26
  autoload :Platform, 'cocoapods-core/platform'
26
27
  autoload :Podfile, 'cocoapods-core/podfile'
@@ -71,7 +71,7 @@ module Pod
71
71
  if requirements.last.is_a?(Hash)
72
72
  @external_source = requirements.pop
73
73
  unless requirements.empty?
74
- raise Informative, "A dependency with an external source may not " \
74
+ raise Informative, 'A dependency with an external source may not ' \
75
75
  "specify version requirements (#{name})."
76
76
  end
77
77
 
@@ -79,7 +79,7 @@ module Pod
79
79
  @head = true
80
80
  requirements.pop
81
81
  unless requirements.empty?
82
- raise Informative, "A `:head` dependency may not specify version " \
82
+ raise Informative, 'A `:head` dependency may not specify version ' \
83
83
  "requirements (#{name})."
84
84
  end
85
85
  end
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  # The version of the cocoapods-core.
3
3
  #
4
- CORE_VERSION = '0.32.1' unless defined? Pod::CORE_VERSION
4
+ CORE_VERSION = '0.33.0' unless defined? Pod::CORE_VERSION
5
5
  end
@@ -0,0 +1,76 @@
1
+ module Pod
2
+ # Handles HTTP requests
3
+ #
4
+ module HTTP
5
+ # Resolve potential redirects and return the final URL.
6
+ #
7
+ # @return [string]
8
+ #
9
+ def self.get_actual_url(url)
10
+ redirects = 0
11
+
12
+ loop do
13
+ response = perform_head_request(url)
14
+
15
+ if [301, 302, 303, 307, 308].include? response.status_code
16
+ location = response.headers['location'].first
17
+
18
+ if location =~ /:\/\//
19
+ url = location
20
+ else
21
+ url = URI.join(url, location).to_s
22
+ end
23
+
24
+ redirects += 1
25
+ else
26
+ break
27
+ end
28
+
29
+ break unless redirects < MAX_HTTP_REDIRECTS
30
+ end
31
+
32
+ url
33
+ end
34
+
35
+ # Performs validation of a URL
36
+ #
37
+ # @return [REST::response]
38
+ #
39
+ def self.validate_url(url)
40
+ return nil unless url =~ /^#{URI.regexp}$/
41
+
42
+ begin
43
+ url = get_actual_url(url)
44
+ resp = perform_head_request(url)
45
+ rescue SocketError
46
+ resp = nil
47
+ end
48
+
49
+ resp
50
+ end
51
+
52
+ #-------------------------------------------------------------------------#
53
+
54
+ private
55
+
56
+ # Does a HEAD request and in case of any errors a GET request
57
+ #
58
+ # @return [REST::response]
59
+ #
60
+ def self.perform_head_request(url)
61
+ require 'rest'
62
+
63
+ resp = ::REST.head(url)
64
+
65
+ if resp.status_code >= 400
66
+ resp = ::REST.get(url)
67
+ end
68
+
69
+ resp
70
+ end
71
+
72
+ MAX_HTTP_REDIRECTS = 3
73
+
74
+ #-------------------------------------------------------------------------#
75
+ end
76
+ end
@@ -141,7 +141,7 @@ module Pod
141
141
 
142
142
  unless dep && version
143
143
  raise StandardError, "Attempt to lock the `#{name}` Pod without an " \
144
- "known dependency."
144
+ 'known dependency.'
145
145
  end
146
146
 
147
147
  locked_dependency = dep.dup
@@ -37,7 +37,7 @@ module Pod
37
37
  # The Podfile specifies the dependencies of each user target.
38
38
  #
39
39
  # * `pod` is the way to declare a specific dependency.
40
- # * `podspec` provides an easy creation API for local podspecs.
40
+ # * `podspec` provides an easy API for the creation of podspecs.
41
41
  # * `target` allows you to scope your dependencies to specific
42
42
  # targets in your Xcode projects.
43
43
 
@@ -151,8 +151,8 @@ module Pod
151
151
  #
152
152
  def pod(name = nil, *requirements, &block)
153
153
  if block
154
- raise StandardError, "Inline specifications are deprecated. " \
155
- "Please store the specification in a `podspec` file."
154
+ raise StandardError, 'Inline specifications are deprecated. ' \
155
+ 'Please store the specification in a `podspec` file.'
156
156
  end
157
157
 
158
158
  unless name
@@ -164,7 +164,9 @@ module Pod
164
164
 
165
165
  # Use the dependencies of a Pod defined in the given podspec file. If no
166
166
  # arguments are passed the first podspec in the root of the Podfile is
167
- # used. It is intended to be used by the project of a library.
167
+ # used. It is intended to be used by the project of a library. Note:
168
+ # this does not include the sources derived from the podspec just the
169
+ # CocoaPods infrastructure.
168
170
  #
169
171
  # @example
170
172
  # podspec
@@ -352,7 +352,7 @@ module Pod
352
352
  def set_platform(name, target = nil)
353
353
  unless [:ios, :osx].include?(name)
354
354
  raise StandardError, "Unsupported platform `#{name}`. Platform " \
355
- "must be `:ios` or `:osx`."
355
+ 'must be `:ios` or `:osx`.'
356
356
  end
357
357
 
358
358
  if target
@@ -414,7 +414,7 @@ module Pod
414
414
  def store_podspec(options = nil)
415
415
  if options
416
416
  unless options.keys.all? { |key| [:name, :path].include?(key) }
417
- raise StandardError, "Unrecognized options for the podspec " \
417
+ raise StandardError, 'Unrecognized options for the podspec ' \
418
418
  "method `#{options}`"
419
419
  end
420
420
  get_hash_value('podspecs', []) << options
@@ -219,7 +219,7 @@ module Pod
219
219
  texts << s.description
220
220
  rescue
221
221
  CoreUI.warn "Skipping `#{set.name}` because the podspec " \
222
- "contains errors."
222
+ 'contains errors.'
223
223
  end
224
224
  texts.grep(regexp_query).empty?
225
225
  end
@@ -293,7 +293,7 @@ module Pod
293
293
  specification(name, version) if version
294
294
  rescue Informative
295
295
  Pod::CoreUI.warn "Skipping `#{name}` because the podspec " \
296
- "contains errors."
296
+ 'contains errors.'
297
297
  nil
298
298
  end
299
299
 
@@ -51,31 +51,6 @@ module Pod
51
51
  # @!group Private helpers
52
52
  #-----------------------------------------------------------------------#
53
53
 
54
- MAX_HTTP_REDIRECTS = 3
55
-
56
- # Resolve potential redirects and return the final URL.
57
- #
58
- # @return [string]
59
- #
60
- def get_actual_url(url)
61
- redirects = 0
62
- loop do
63
- require 'rest'
64
- response = REST.head(url)
65
-
66
- if [301, 302, 303, 307, 308].include? response.status_code
67
- url = response.headers['location'].first
68
- redirects += 1
69
- else
70
- break
71
- end
72
-
73
- break unless redirects < MAX_HTTP_REDIRECTS
74
- end
75
-
76
- url
77
- end
78
-
79
54
  # Checks whether the source of the proposed specification is different
80
55
  # from the one of the reference specification.
81
56
  #
@@ -84,6 +59,8 @@ module Pod
84
59
  # @return [void]
85
60
  #
86
61
  def check_spec_source_change(spec, errors)
62
+ require 'cocoapods-core/http'
63
+
87
64
  return unless spec
88
65
  return if spec.source[:http]
89
66
  return unless reference_spec(spec)
@@ -91,12 +68,12 @@ module Pod
91
68
  source = spec.source.values_at(*keys).compact.first
92
69
  old_source = reference_spec(spec).source.values_at(*keys).compact.first
93
70
  unless source == old_source
94
- source = get_actual_url(source)
95
- old_source = get_actual_url(old_source)
71
+ source = HTTP.get_actual_url(source)
72
+ old_source = HTTP.get_actual_url(old_source)
96
73
  unless source == old_source
97
74
  message = "The source of the spec doesn't match with the recorded "
98
75
  message << "ones. Source: `#{source}`. Previous: `#{old_source}`.\n "
99
- message << 'Please contact the specs repo maintainers if the'
76
+ message << 'Please contact the specs repo maintainers if the '
100
77
  message << 'library changed location.'
101
78
  errors << message
102
79
  end
@@ -117,8 +94,8 @@ module Pod
117
94
  s.version != '0.0.1'
118
95
  end
119
96
  if has_tagged_spec
120
- errors << "There is already at least one versioned specification " \
121
- "so untagged versions cannot be accepted."
97
+ errors << 'There is already at least one versioned specification ' \
98
+ 'so untagged versions cannot be accepted.'
122
99
  end
123
100
  end
124
101
 
@@ -145,7 +122,7 @@ module Pod
145
122
  set = source.search(dep)
146
123
  unless set && set.specification
147
124
  errors << "Unable to find a specification for the `#{dep}` " \
148
- "dependency."
125
+ 'dependency.'
149
126
  end
150
127
  end
151
128
  end
@@ -131,7 +131,7 @@ module Pod
131
131
  end
132
132
  if result.empty?
133
133
  extra = ', author, summary, or description' if full_text_search
134
- raise Informative, "Unable to find a pod with name" \
134
+ raise Informative, 'Unable to find a pod with name' \
135
135
  "#{extra} matching `#{query}'"
136
136
  end
137
137
  result
@@ -229,7 +229,7 @@ module Pod
229
229
  result
230
230
  rescue
231
231
  CoreUI.warn "Skipping `#{set.name}` because the podspec contains " \
232
- "errors."
232
+ 'errors.'
233
233
  result
234
234
  end
235
235
 
@@ -58,7 +58,13 @@ module Pod
58
58
  return unless pod_dir.exist?
59
59
  pod_dir.children.map do |v|
60
60
  basename = v.basename.to_s
61
- Version.new(basename) if v.directory? && basename[0, 1] != '.'
61
+ begin
62
+ Version.new(basename) if v.directory? && basename[0, 1] != '.'
63
+ rescue ArgumentError => e
64
+ raise Informative, 'An unexpected version directory ' \
65
+ "`#{basename}` was encountered for the " \
66
+ "`#{pod_dir}` Pod in the `#{name}` repository."
67
+ end
62
68
  end.compact.sort.reverse.map(&:to_s)
63
69
  end
64
70
 
@@ -64,8 +64,6 @@ module Pod
64
64
  # self.class === other &&
65
65
  # attributes_hash == other.attributes_hash &&
66
66
  # subspecs == other.subspecs &&
67
- # pre_install_callback == other.pre_install_callback &&
68
- # post_install_callback == other.post_install_callback
69
67
  to_s == other.to_s
70
68
  end
71
69
 
@@ -124,10 +122,10 @@ module Pod
124
122
  def self.name_and_version_from_string(string_representation)
125
123
  match_data = string_representation.match(/(\S*) \((.*)\)/)
126
124
  unless match_data
127
- raise Informative, "Invalid string representation for a " \
125
+ raise Informative, 'Invalid string representation for a ' \
128
126
  "Specification: `#{string_representation}`." \
129
- "String representation should include the name and " \
130
- "the version of a pod."
127
+ 'String representation should include the name and ' \
128
+ 'the version of a pod.'
131
129
  end
132
130
  name = match_data[1]
133
131
  vers = Version.new(match_data[2])
@@ -207,32 +205,35 @@ module Pod
207
205
  subspec_name = remainder.split('/').shift
208
206
  subspec = subspecs.find { |s| s.base_name == subspec_name }
209
207
  unless subspec
210
- raise Informative, "Unable to find a specification named " \
208
+ raise Informative, 'Unable to find a specification named ' \
211
209
  "`#{relative_name}` in `#{name} (#{version})`."
212
210
  end
213
211
  subspec.subspec_by_name(remainder)
214
212
  end
215
213
  end
216
214
 
217
- # @return [String] the name of the default subspec if provided.
215
+ # @return [Array] the name of the default subspecs if provided.
218
216
  #
219
- def default_subspec
220
- attributes_hash['default_subspec']
217
+ def default_subspecs
218
+ # TODO: remove singular form and update the JSON specs.
219
+ Array(attributes_hash['default_subspecs'] || attributes_hash['default_subspec'])
221
220
  end
222
221
 
223
222
  # Returns the dependencies on subspecs.
224
223
  #
225
224
  # @note A specification has a dependency on either the
226
- # {#default_subspec} or each of its children subspecs that are
225
+ # {#default_subspecs} or each of its children subspecs that are
227
226
  # compatible with its platform.
228
227
  #
229
228
  # @return [Array<Dependency>] the dependencies on subspecs.
230
229
  #
231
230
  def subspec_dependencies(platform = nil)
232
- if default_subspec
233
- specs = [root.subspec_by_name("#{name}/#{default_subspec}")]
234
- else
231
+ if default_subspecs.empty?
235
232
  specs = subspecs.compact
233
+ else
234
+ specs = default_subspecs.map do |subspec_name|
235
+ root.subspec_by_name("#{name}/#{subspec_name}")
236
+ end
236
237
  end
237
238
  if platform
238
239
  specs = specs.select { |s| s.supported_on_platform?(platform) }
@@ -377,55 +378,8 @@ module Pod
377
378
 
378
379
  public
379
380
 
380
- # @!group Deprecated Hooks support
381
- #-------------------------------------------------------------------------#
382
-
383
- # @return [Proc] the pre install callback if defined.
384
- #
385
- attr_reader :pre_install_callback
386
-
387
- # @return [Proc] the post install callback if defined.
388
- #
389
- attr_reader :post_install_callback
390
-
391
- # Calls the pre install callback if defined.
392
- #
393
- # @param [Pod::LocalPod] pod
394
- # the local pod instance that manages the files described by this
395
- # specification.
396
- #
397
- # @param [Podfile::TargetDefinition] target_definition
398
- # the target definition that required this specification as a
399
- # dependency.
400
- #
401
- # @return [Bool] whether a pre install callback was specified and it was
402
- # called.
403
- #
404
- def pre_install!(pod, target_definition)
405
- return false unless @pre_install_callback
406
- @pre_install_callback.call(pod, target_definition)
407
- true
408
- end
409
-
410
- # Calls the post install callback if defined.
411
- #
412
- # @param [Pod::TargetInstaller] target_installer
413
- # the target installer that is performing the installation of the
414
- # pod.
415
- #
416
- # @return [Bool] whether a post install callback was specified and it was
417
- # called.
418
- #
419
- def post_install!(target_installer)
420
- return false unless @post_install_callback
421
- @post_install_callback.call(target_installer)
422
- true
423
- end
424
-
425
381
  #-------------------------------------------------------------------------#
426
382
 
427
- public
428
-
429
383
  # @!group DSL attribute writers
430
384
 
431
385
  # Sets the value for the attribute with the given name.
@@ -526,8 +526,8 @@ module Pod
526
526
  # The deployment target of the platform.
527
527
  #
528
528
  def deployment_target=(*args)
529
- raise Informative, "The deployment target can be declared only per " \
530
- "platform."
529
+ raise Informative, 'The deployment target can be declared only per ' \
530
+ 'platform.'
531
531
  end
532
532
 
533
533
  #-----------------------------------------------------------------------#
@@ -574,7 +574,7 @@ module Pod
574
574
  name, *version_requirements = args
575
575
  if name == self.name
576
576
  raise Informative, "A specification can't require itself as a " \
577
- "subspec"
577
+ 'subspec'
578
578
  end
579
579
  if @parent
580
580
  composed_name = ''
@@ -582,7 +582,7 @@ module Pod
582
582
  composed_name << component
583
583
  if name == composed_name
584
584
  raise Informative, "A subspec can't require one of its " \
585
- "parents specifications"
585
+ 'parents specifications'
586
586
  else
587
587
  composed_name << '/'
588
588
  end
@@ -1192,9 +1192,9 @@ module Pod
1192
1192
 
1193
1193
  #------------------#
1194
1194
 
1195
- # @!method default_subspec=(subspec_name)
1195
+ # @!method default_subspecs=(subspec_array)
1196
1196
  #
1197
- # The name of the subspec that should be used as preferred dependency.
1197
+ # An array of subspecs names that should be used as preferred dependency.
1198
1198
  # If not specified a specifications requires all its subspecs as
1199
1199
  # dependencies.
1200
1200
  #
@@ -1209,13 +1209,19 @@ module Pod
1209
1209
  # they trigger dependencies on other libraries).
1210
1210
  #
1211
1211
  # @example
1212
- # spec.default_subspec = 'Pod/Core'
1213
1212
  #
1214
- # @param [String] subspec_name
1215
- # the name of the subspec that should be inherited as
1213
+ # spec.default_subspec = 'Core'
1214
+ #
1215
+ # @example
1216
+ # spec.default_subspecs = 'Core', 'UI'
1217
+ #
1218
+ # @param [Array<String>] subspec_names
1219
+ # An array of subspec names that should be inherited as
1216
1220
  # dependency.
1217
1221
  #
1218
- attribute :default_subspec,
1222
+ attribute :default_subspecs,
1223
+ :container => Array,
1224
+ :singularize => true,
1219
1225
  :multi_platform => false
1220
1226
 
1221
1227
  #-----------------------------------------------------------------------#
@@ -5,47 +5,33 @@ module Pod
5
5
  #
6
6
  module Deprecations
7
7
  def preferred_dependency=(name)
8
- self.default_subspec = name
8
+ self.default_subspecs = [name]
9
9
  CoreUI.warn "[#{self}] `preferred_dependency` has been renamed "\
10
- "to `default_subspec`."
10
+ 'to `default_subspecs`.'
11
11
  end
12
12
 
13
13
  def singleton_method_added(method)
14
- if method == :pre_install
15
- CoreUI.warn "[#{self}] The use of `#{method}` by overriding " \
16
- "the method is deprecated."
17
- @pre_install_callback = proc do |pod, target_definition|
18
- pre_install(pod, target_definition)
19
- end
20
-
21
- elsif method == :post_install
22
- CoreUI.warn "[#{self}] The use of `#{method}` by overriding the " \
23
- "method is deprecated."
24
- @post_install_callback = proc do |target_installer|
25
- post_install(target_installer)
26
- end
27
-
28
- elsif method == :header_mappings
14
+ if method == :header_mappings
29
15
  raise Informative, "[#{self}] The use of the `header_mappings` " \
30
16
  "hook has been deprecated.\n Use the `header_dir` and the " \
31
- "`header_mappings_dir` attributes."
17
+ '`header_mappings_dir` attributes.'
32
18
 
33
19
  elsif method == :copy_header_mapping
34
20
  raise Informative, "[#{self}] The use of the " \
35
21
  "`copy_header_mapping` hook has been deprecated.\nUse" \
36
- "the `header_dir` and the `header_mappings_dir` attributes."
22
+ 'the `header_dir` and the `header_mappings_dir` attributes.'
37
23
  end
38
24
  end
39
25
 
40
26
  def documentation=(value)
41
27
  CoreUI.warn "[#{self}] The `documentation` DSL directive of the " \
42
- "podspec format has been deprecated."
28
+ 'podspec format has been deprecated.'
43
29
  end
44
30
 
45
31
  def clean_paths=(value)
46
32
  raise Informative, "[#{self}] Clean paths are deprecated. " \
47
- "CocoaPods now cleans unused files by default. Use the " \
48
- "`preserve_paths` attribute if needed."
33
+ 'CocoaPods now cleans unused files by default. Use the ' \
34
+ '`preserve_paths` attribute if needed.'
49
35
  end
50
36
 
51
37
  DEPRECATED_METHODS = [
@@ -60,78 +46,6 @@ module Pod
60
46
  "`#{method.to_s[0..-2]}` has been deprecated."
61
47
  end
62
48
  end
63
-
64
- # @!group Hooks
65
- #
66
- # The specification class provides hooks which are called by
67
- # CocoaPods when a Pod is installed.
68
-
69
- #-----------------------------------------------------------------------#
70
-
71
- # This is a convenience method which gets called after all pods have
72
- # been downloaded but before they have been installed, and the Xcode
73
- # project and related files have been generated. Note that this hook is
74
- # called for each Pods library and only for installations where the Pod
75
- # is installed.
76
- #
77
- # This hook should be used to generate and modify the files of the Pod.
78
- #
79
- # It receives the
80
- # [`Pod::Hooks::PodRepresentation`](http://docs.cocoapods.org/cocoapods/pod/hooks/podrepresentation/)
81
- # and the
82
- # [`Pod::Hooks::LibraryRepresentation`](http://docs.cocoapods.org/cocoapods/pod/hooks/libraryrepresentation/)
83
- # instances.
84
- #
85
- # Override this to, for instance, to run any build script.
86
- #
87
- # @example
88
- #
89
- # spec.pre_install do |pod, target_definition|
90
- # Dir.chdir(pod.root){ `sh make.sh` }
91
- # end
92
- #
93
- def pre_install(&block)
94
- CoreUI.warn "[#{self}] The pre install hook of the specification " \
95
- "DSL has been deprecated, use the `resource_bundles` or the " \
96
- "`prepare_command` attributes."
97
- CoreUI.warn "[#{self}] The pre_install hook will be removed in " \
98
- "the next release"
99
- @pre_install_callback = block
100
- end
101
-
102
- # This is a convenience method which gets called after all pods have been
103
- # downloaded, installed, and the Xcode project and related files have
104
- # been generated. Note that this hook is called for each Pods library and
105
- # only for installations where the Pod is installed.
106
- #
107
- # To modify and generate files for the Pod the pre install hook should be
108
- # used instead of this one.
109
- #
110
- # It receives a
111
- # [`Pod::Hooks::LibraryRepresentation`](http://docs.cocoapods.org/cocoapods/pod/hooks/libraryrepresentation/)
112
- # instance for the current target.
113
- #
114
- # Override this to, for instance, add to the prefix header.
115
- #
116
- # @example
117
- #
118
- # spec.post_install do |library_representation|
119
- # prefix_header = library_representation.prefix_header_path
120
- # prefix_header.open('a') do |file|
121
- # file.puts('#ifdef __OBJC__\n#import "SSToolkitDefines.h"\n#endif')
122
- # end
123
- # end
124
- #
125
- def post_install(&block)
126
- CoreUI.warn "[#{self}] The post install hook of the specification " \
127
- "DSL has been deprecated, use the `resource_bundles` or the " \
128
- "`prepare_command` attributes."
129
- CoreUI.warn "[#{self}] The post_install hook will be removed in " \
130
- "the next release"
131
- @post_install_callback = block
132
- end
133
-
134
- #-----------------------------------------------------------------------#
135
49
  end
136
50
  end
137
51
  end
@@ -24,8 +24,10 @@ module Pod
24
24
  # @return [Bool] Whether the specification can be converted to a hash
25
25
  # without loss of information.
26
26
  #
27
+ # TODO: remove
28
+ #
27
29
  def safe_to_hash?
28
- pre_install_callback.nil? && post_install_callback.nil?
30
+ true
29
31
  end
30
32
  end
31
33
 
@@ -50,7 +50,8 @@ module Pod
50
50
  run_root_validation_hooks
51
51
  perform_all_specs_analysis
52
52
  else
53
- error "The specification defined in `#{file}` could not be loaded." \
53
+ error "[spec] The specification defined in `#{file}` could not be" \
54
+ ' loaded.' \
54
55
  "\n\n#{@raise_message}"
55
56
  end
56
57
  results.empty?
@@ -91,9 +92,9 @@ module Pod
91
92
  next unless attr.required?
92
93
  unless value && (!value.respond_to?(:empty?) || !value.empty?)
93
94
  if attr.name == :license
94
- warning("Missing required attribute `#{attr.name}`.")
95
+ warning("[attributes] Missing required attribute `#{attr.name}`.")
95
96
  else
96
- error("Missing required attribute `#{attr.name}`.")
97
+ error("[attributes] Missing required attribute `#{attr.name}`.")
97
98
  end
98
99
  end
99
100
  end
@@ -173,24 +174,25 @@ module Pod
173
174
  ]
174
175
  names_match = acceptable_names.include?(file.basename.to_s)
175
176
  unless names_match
176
- error 'The name of the spec should match the name of the file.'
177
+ error '[name] The name of the spec should match the name of the \
178
+ file.'
177
179
  end
178
180
 
179
181
  if spec.root.name =~ /\s/
180
- error 'The name of a spec should not contain whitespace.'
182
+ error '[name] The name of a spec should not contain whitespace.'
181
183
  end
182
184
 
183
185
  if spec.root.name[0, 1] == '.'
184
- error 'The name of a spec should not begin with a period.'
186
+ error '[name] The name of a spec should not begin with a period.'
185
187
  end
186
188
  end
187
189
  end
188
190
 
189
191
  def _validate_version(v)
190
192
  if v.to_s.empty?
191
- error 'A version is required.'
193
+ error '[version] A version is required.'
192
194
  elsif v <= Version::ZERO
193
- error 'The version of the spec should be higher than 0.'
195
+ error '[version] The version of the spec should be higher than 0.'
194
196
  end
195
197
  end
196
198
 
@@ -198,11 +200,11 @@ module Pod
198
200
  #
199
201
  def _validate_summary(s)
200
202
  if s.length > 140
201
- warning "The summary should be a short version of `description` " \
202
- "(max 140 characters)."
203
+ warning '[summary] The summary should be a short version of' \
204
+ '`description` (max 140 characters).'
203
205
  end
204
206
  if s =~ /A short description of/
205
- warning 'The summary is not meaningful.'
207
+ warning '[summary] The summary is not meaningful.'
206
208
  end
207
209
  end
208
210
 
@@ -210,13 +212,13 @@ module Pod
210
212
  #
211
213
  def _validate_description(d)
212
214
  if d =~ /An optional longer description of/
213
- warning 'The description is not meaningful.'
215
+ warning '[description] The description is not meaningful.'
214
216
  end
215
217
  if d == spec.summary
216
- warning 'The description is equal to the summary.'
218
+ warning '[description] The description is equal to the summary.'
217
219
  end
218
220
  if d.length < spec.summary.length
219
- warning 'The description is shorter than the summary.'
221
+ warning '[description] The description is shorter than the summary.'
220
222
  end
221
223
  end
222
224
 
@@ -224,7 +226,7 @@ module Pod
224
226
  #
225
227
  def _validate_homepage(h)
226
228
  if h =~ %r{http://EXAMPLE}
227
- warning 'The homepage has not been updated from default'
229
+ warning '[homepage] The homepage has not been updated from default'
228
230
  end
229
231
  end
230
232
 
@@ -232,7 +234,7 @@ module Pod
232
234
  #
233
235
  def _validate_frameworks(frameworks)
234
236
  if frameworks_invalid?(frameworks)
235
- error 'A framework should only be specified by its name'
237
+ error '[frameworks] A framework should only be specified by its name'
236
238
  end
237
239
  end
238
240
 
@@ -240,7 +242,8 @@ module Pod
240
242
  #
241
243
  def _validate_weak_frameworks(frameworks)
242
244
  if frameworks_invalid?(frameworks)
243
- error 'A weak framework should only be specified by its name'
245
+ error '[weak_frameworks] A weak framework should only be specified' \
246
+ 'by its name'
244
247
  end
245
248
  end
246
249
 
@@ -250,15 +253,18 @@ module Pod
250
253
  libs.each do |lib|
251
254
  lib = lib.downcase
252
255
  if lib.end_with?('.a') || lib.end_with?('.dylib')
253
- error "Libraries should not include the extension (`#{lib}`)"
256
+ error '[libraries] Libraries should not include the extension ' \
257
+ "(`#{lib}`)"
254
258
  end
255
259
 
256
260
  if lib.start_with?('lib')
257
- error "Libraries should omit the `lib` prefix (`#{lib}`)"
261
+ error '[libraries] Libraries should omit the `lib` prefix' \
262
+ " (`#{lib}`)"
258
263
  end
259
264
 
260
265
  if lib.include?(',')
261
- error "Libraries should not include comas (`#{lib}`)"
266
+ error '[libraries] Libraries should not include comas' \
267
+ "(`#{lib}`)"
262
268
  end
263
269
  end
264
270
  end
@@ -268,13 +274,13 @@ module Pod
268
274
  def _validate_license(l)
269
275
  type = l[:type]
270
276
  if type.nil?
271
- warning 'Missing license type.'
277
+ warning '[license] Missing license type.'
272
278
  end
273
279
  if type && type.gsub(' ', '').gsub("\n", '').empty?
274
- warning 'Invalid license type.'
280
+ warning '[license] Invalid license type.'
275
281
  end
276
282
  if type && type =~ /\(example\)/
277
- error 'Sample license type.'
283
+ error '[license] Sample license type.'
278
284
  end
279
285
  end
280
286
 
@@ -286,20 +292,21 @@ module Pod
286
292
  version = spec.version.to_s
287
293
 
288
294
  if git =~ %r{http://EXAMPLE}
289
- error 'The Git source still contains the example URL.'
295
+ error '[source] The Git source still contains the example URL.'
290
296
  end
291
297
  if commit && commit.downcase =~ /head/
292
- error 'The commit of a Git source cannot be `HEAD`.'
298
+ error '[source] The commit of a Git source cannot be `HEAD`.'
293
299
  end
294
300
  if tag && !tag.to_s.include?(version)
295
- warning 'The version should be included in the Git tag.'
301
+ warning '[source] The version should be included in the Git tag.'
296
302
  end
297
303
  if version == '0.0.1'
298
304
  if commit.nil? && tag.nil?
299
- error 'Git sources should specify either a commit or a tag.'
305
+ error '[source] Git sources should specify either a commit or' \
306
+ 'a tag.'
300
307
  end
301
308
  else
302
- warning 'Git sources should specify a tag.' if tag.nil?
309
+ warning '[source] Git sources should specify a tag.' if tag.nil?
303
310
  end
304
311
  end
305
312
 
@@ -314,12 +321,18 @@ module Pod
314
321
  if git = s[:git]
315
322
  return unless git =~ /^#{URI.regexp}$/
316
323
  git_uri = URI.parse(git)
324
+ if git_uri.host == 'www.github.com'
325
+ warning '[github_sources] Github repositories should not use' \
326
+ '`www` in URL.'
327
+ end
317
328
  if git_uri.host == 'github.com' || git_uri.host == 'gist.github.com'
318
329
  unless git.end_with?('.git')
319
- warning 'Github repositories should end in `.git`.'
330
+ warning '[github_sources] Github repositories should end in' \
331
+ '`.git`.'
320
332
  end
321
333
  unless git_uri.scheme == 'https'
322
- warning 'Github repositories should use `https` link.'
334
+ warning '[github_sources] Github repositories should use' \
335
+ '`https` link.'
323
336
  end
324
337
  end
325
338
  end
@@ -329,7 +342,8 @@ module Pod
329
342
  #
330
343
  def _validate_social_media_url(s)
331
344
  if s =~ %r{https://twitter.com/EXAMPLE}
332
- warning 'The social media URL has not been updated from default'
345
+ warning '[social_media_url] The social media URL has not been' \
346
+ 'updated from default'
333
347
  end
334
348
  end
335
349
 
@@ -343,7 +357,8 @@ module Pod
343
357
  #
344
358
  def _validate_compiler_flags(flags)
345
359
  if flags.join(' ').split(' ').any? { |flag| flag.start_with?('-Wno') }
346
- warning "Warnings must not be disabled (`-Wno' compiler flags)."
360
+ warning '[compiler_flags] Warnings must not be disabled' \
361
+ '(`-Wno compiler` flags).'
347
362
  end
348
363
  end
349
364
 
@@ -15,7 +15,6 @@ module Pod
15
15
  validate_file_patterns
16
16
  check_tmp_arc_not_nil
17
17
  check_if_spec_is_empty
18
- check_install_hooks
19
18
  end
20
19
 
21
20
  private
@@ -35,8 +34,8 @@ module Pod
35
34
  end
36
35
  patterns.each do |pattern|
37
36
  if pattern.start_with?('/')
38
- error "File patterns must be relative and cannot start with a " \
39
- "slash (#{attrb.name})."
37
+ error '[File Patterns] File patterns must be relative ' \
38
+ "and cannot start with a slash (#{attrb.name})."
40
39
  end
41
40
  end
42
41
  end
@@ -55,8 +54,9 @@ module Pod
55
54
  end
56
55
 
57
56
  unless declared
58
- warning "A value for `requires_arc` should be specified until the " \
59
- "migration to a `true` default."
57
+ warning '[requires_arc] A value for `requires_arc` should be' \
58
+ ' specified until the ' \
59
+ 'migration to a `true` default.'
60
60
  end
61
61
  end
62
62
 
@@ -68,23 +68,11 @@ module Pod
68
68
  empty_patterns = methods.all? { |m| consumer.send(m).empty? }
69
69
  empty = empty_patterns && consumer.spec.subspecs.empty?
70
70
  if empty
71
- error "The #{consumer.spec} spec is empty (no source files, " \
72
- "resources, resource_bundles, preserve paths, vendored_libraries, " \
73
- "vendored_frameworks dependencies or subspecs)."
74
- end
75
- end
76
-
77
- # Check the hooks
78
- #
79
- def check_install_hooks
80
- unless consumer.spec.pre_install_callback.nil?
81
- warning "The pre install hook has been deprecated, " \
82
- "use the `resource_bundles` or the `prepare_command` attributes."
83
- end
84
-
85
- unless consumer.spec.post_install_callback.nil?
86
- warning "The post install hook has been deprecated, " \
87
- "use the `resource_bundles` or the `prepare_command` attributes."
71
+ error "[File Patterns] The #{consumer.spec} spec is empty"
72
+ '(no source files, ' \
73
+ 'resources, resource_bundles, preserve paths,' \
74
+ 'vendored_libraries, vendored_frameworks dependencies' \
75
+ 'or subspecs).'
88
76
  end
89
77
  end
90
78
  end
@@ -61,10 +61,10 @@ module Pod
61
61
  dependencies << dependency
62
62
 
63
63
  if acceptable_versions.empty?
64
- message = "Unable to satisfy the following requirements:\n"
64
+ message = "Unable to satisfy the following requirements:\n\n"
65
65
  dependencies_by_requirer_name.each do |name, dependencies|
66
66
  dependencies.each do |dep|
67
- message << "- `#{dep}` required by `#{name}`"
67
+ message << "- `#{dep}` required by `#{name}`\n"
68
68
  end
69
69
  end
70
70
  raise Informative, message
@@ -76,7 +76,7 @@ module Pod
76
76
  when Array then process_array(value)
77
77
  when Hash then process_hash(value, hash_keys_hint)
78
78
  else
79
- raise StandardError, "Unsupported class for YAML conversion " \
79
+ raise StandardError, 'Unsupported class for YAML conversion ' \
80
80
  "#{value.class}"
81
81
  end
82
82
  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.32.1
4
+ version: 0.33.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-15 00:00:00.000000000 Z
12
+ date: 2014-05-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -18,9 +18,6 @@ dependencies:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: 3.2.15
21
- - - "<"
22
- - !ruby/object:Gem::Version
23
- version: '4'
24
21
  type: :runtime
25
22
  prerelease: false
26
23
  version_requirements: !ruby/object:Gem::Requirement
@@ -28,9 +25,6 @@ dependencies:
28
25
  - - ">="
29
26
  - !ruby/object:Gem::Version
30
27
  version: 3.2.15
31
- - - "<"
32
- - !ruby/object:Gem::Version
33
- version: '4'
34
28
  - !ruby/object:Gem::Dependency
35
29
  name: nap
36
30
  requirement: !ruby/object:Gem::Requirement
@@ -105,6 +99,7 @@ files:
105
99
  - lib/cocoapods-core/dependency.rb
106
100
  - lib/cocoapods-core/gem_version.rb
107
101
  - lib/cocoapods-core/github.rb
102
+ - lib/cocoapods-core/http.rb
108
103
  - lib/cocoapods-core/lockfile.rb
109
104
  - lib/cocoapods-core/platform.rb
110
105
  - lib/cocoapods-core/podfile.rb