Commit 811f98c7 authored by Fabio Pelosin's avatar Fabio Pelosin

[Specification] Provide a meaningful error message if a subspec can't be found.

parent 8a61d2db
...@@ -11,8 +11,10 @@ ...@@ -11,8 +11,10 @@
- Added `pod update` that installs the dependencies of the Podfile ignoring the contents of the `Podfile.lock`. [#131](https://github.com/CocoaPods/CocoaPods/issues/131) - Added `pod update` that installs the dependencies of the Podfile ignoring the contents of the `Podfile.lock`. [#131](https://github.com/CocoaPods/CocoaPods/issues/131)
- Added `pod outdated` that show the pods that would be installed by `pod update`. - Added `pod outdated` that show the pods that would be installed by `pod update`.
- Added `:local` option for dependencies. [#458](https://github.com/CocoaPods/CocoaPods/issues/458) [#415](https://github.com/CocoaPods/CocoaPods/issues/415) [#156](https://github.com/CocoaPods/CocoaPods/issues/156) - Added `:local` option for dependencies. [#458](https://github.com/CocoaPods/CocoaPods/issues/458) [#415](https://github.com/CocoaPods/CocoaPods/issues/415) [#156](https://github.com/CocoaPods/CocoaPods/issues/156)
- Added a meaningful error message if a podspec can’t be found in the root of an external source. [#385](https://github.com/CocoaPods/CocoaPods/issues/385) [#338](https://github.com/CocoaPods/CocoaPods/issues/338) [#337](https://github.com/CocoaPods/CocoaPods/issues/337) - Added a meaningful error messages:
- Added a meaningful error message for unrecognized commands/arguments. - in case a podspec couldn’t be found in the root of an external source. [#385](https://github.com/CocoaPods/CocoaPods/issues/385) [#338](https://github.com/CocoaPods/CocoaPods/issues/338) [#337](https://github.com/CocoaPods/CocoaPods/issues/337)
- in case a unrecognized commands/argument is provided.
- in case a subspec name is misspelled.
###### Bug fixes ###### Bug fixes
......
...@@ -393,14 +393,14 @@ module Pod ...@@ -393,14 +393,14 @@ module Pod
# Remove this spec's name from the beginning of the name we’re looking for # Remove this spec's name from the beginning of the name we’re looking for
# and take the first component from the remainder, which is the spec we need # and take the first component from the remainder, which is the spec we need
# to find now. # to find now.
remainder = name[self.name.size+1..-1].split('/') remainder = name[self.name.size+1..-1]
subspec_name = remainder.shift raise Informative, "Unable to find a specification named `#{name}' in `#{pod_name}'." unless remainder
subspec_name = remainder.split('/').shift
subspec = subspecs.find { |s| s.name == "#{self.name}/#{subspec_name}" } subspec = subspecs.find { |s| s.name == "#{self.name}/#{subspec_name}" }
raise Informative, "Unable to find a specification named `#{name}' in `#{pod_name}'." unless subspec
# If this was the last component in the name, then return the subspec, # If this was the last component in the name, then return the subspec,
# otherwise we recursively keep calling subspec_by_name until we reach the # otherwise we recursively keep calling subspec_by_name until we reach the
# last one and return that # last one and return that
raise Informative, "Unable to find a subspec named `#{name}'." unless subspec
remainder.empty? ? subspec : subspec.subspec_by_name(name) remainder.empty? ? subspec : subspec.subspec_by_name(name)
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment