Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
43ba62b8
Unverified
Commit
43ba62b8
authored
Mar 16, 2017
by
Alfredo Delli Bovi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Resolver] Improve error message when specs not found
parent
4e6b852f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
7 deletions
+44
-7
CHANGELOG.md
CHANGELOG.md
+4
-0
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+7
-0
resolver.rb
lib/cocoapods/resolver.rb
+10
-3
resolver_spec.rb
spec/unit/resolver_spec.rb
+23
-4
No files found.
CHANGELOG.md
View file @
43ba62b8
...
...
@@ -28,6 +28,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Alfredo Delli Bovi
](
https://github.com/adellibovi
)
[
#6033
](
https://github.com/CocoaPods/CocoaPods/issues/6033
)
*
Provide better error message when spec not found
[
Alfredo Delli Bovi
](
https://github.com/adellibovi
)
[
#6033
](
https://github.com/CocoaPods/CocoaPods/issues/6033
)
## 1.2.1.beta.1 (2017-03-08)
...
...
lib/cocoapods/installer/analyzer.rb
View file @
43ba62b8
...
...
@@ -156,6 +156,11 @@ module Pod
private
# @return [Bool] Whether the analysis has updated sources repositories.
#
attr_accessor
:specs_updated
alias_method
:specs_updated?
,
:specs_updated
def
validate_podfile!
validator
=
Installer
::
PodfileValidator
.
new
(
podfile
)
validator
.
validate
...
...
@@ -222,6 +227,7 @@ module Pod
UI
.
message
"Skipping `
#{
source
.
name
}
` update because the repository is not a git source repository."
end
end
@specs_updated
=
true
end
private
...
...
@@ -716,6 +722,7 @@ module Pod
specs_by_target
=
nil
UI
.
section
"Resolving dependencies of
#{
UI
.
path
(
podfile
.
defined_in_file
)
||
'Podfile'
}
"
do
resolver
=
Resolver
.
new
(
sandbox
,
podfile
,
locked_dependencies
,
sources
)
resolver
.
specs_updated
=
specs_updated?
specs_by_target
=
resolver
.
resolve
specs_by_target
.
values
.
flatten
(
1
).
each
(
&
:validate_cocoapods_version
)
end
...
...
lib/cocoapods/resolver.rb
View file @
43ba62b8
...
...
@@ -35,6 +35,11 @@ module Pod
#
attr_accessor
:sources
# @return [Bool] Whether the resolver has sources repositories up-to-date.
#
attr_accessor
:specs_updated
alias
specs_updated?
specs_updated
# Init a new Resolver
#
# @param [Sandbox] sandbox @see sandbox
...
...
@@ -438,9 +443,11 @@ module Pod
dependencies
=
conflicts
.
count
==
1
?
'dependency'
:
'dependencies'
message
<<
"
\n\n
None of your spec sources contain a spec satisfying "
\
"the
#{
dependencies
}
: `
#{
conflicts
.
join
(
', '
)
}
`."
\
"
\n\n
You have either:"
\
"
\n
* out-of-date source repos which you can update with `pod repo update`."
\
"
\n
* mistyped the name or version."
\
"
\n\n
You have either:"
unless
specs_updated?
message
<<
"
\n
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`."
end
message
<<
"
\n
* mistyped the name or version."
\
"
\n
* not added the source repo that hosts the Podspec to your Podfile."
\
"
\n\n
Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default."
...
...
spec/unit/resolver_spec.rb
View file @
43ba62b8
...
...
@@ -378,9 +378,28 @@ module Pod
e
.
message
.
should
.
match
(
/`AFNetworking \(= 999\.999\.999\)` required by `Podfile`/
)
e
.
message
.
should
.
match
(
/None of your spec sources contain a spec satisfying the dependency: `AFNetworking \(= 999\.999\.999\)`./
)
e
.
message
.
should
.
match
(
/You have either:/
)
e
.
message
.
should
.
match
(
/ * out-of-date source repos which you can update with `pod repo update`/
)
e
.
message
.
should
.
match
(
/ * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`./
)
e
.
message
.
should
.
match
(
/ * mistyped the name or version./
)
e
.
message
.
should
.
match
(
/ * not added the source repo that hosts the Podspec to your Podfile./
)
e
.
message
.
should
.
match
(
/Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default./
)
e
.
exit_status
.
should
.
equal
(
31
)
end
it
'raises if repo are updated and no such version of a dependency exists'
do
podfile
=
Podfile
.
new
do
platform
:ios
pod
'AFNetworking'
,
'999.999.999'
end
resolver
=
Resolver
.
new
(
config
.
sandbox
,
podfile
,
empty_graph
,
config
.
sources_manager
.
all
)
resolver
.
specs_updated
=
true
e
=
lambda
{
resolver
.
resolve
}.
should
.
raise
NoSpecFoundError
e
.
message
.
should
.
match
(
/Unable to satisfy the following requirements/
)
e
.
message
.
should
.
match
(
/`AFNetworking \(= 999\.999\.999\)` required by `Podfile`/
)
e
.
message
.
should
.
match
(
/None of your spec sources contain a spec satisfying the dependency: `AFNetworking \(= 999\.999\.999\)`./
)
e
.
message
.
should
.
match
(
/You have either:/
)
e
.
message
.
should
.
not
.
match
(
/ * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`./
)
e
.
message
.
should
.
match
(
/ * mistyped the name or version./
)
e
.
message
.
should
.
match
(
/ * not added the source repo that hosts the Podspec to your Podfile./
)
e
.
message
.
should
.
match
(
/ * out-of-date source repos which you can update with `pod repo update`/
)
e
.
message
.
should
.
match
(
/Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default./
)
e
.
exit_status
.
should
.
equal
(
31
)
end
...
...
@@ -400,9 +419,9 @@ module Pod
e
.
message
.
should
.
match
(
/None of your spec sources contain a spec satisfying the dependencies:/
)
e
.
message
.
should
.
match
(
/`AFNetworking \(= 3.0.1\), AFNetworking \(= 1.4\)`/
)
e
.
message
.
should
.
match
(
/You have either:/
)
e
.
message
.
should
.
match
(
/ * out-of-date source repos which you can update with `pod repo update`/
)
e
.
message
.
should
.
match
(
/ * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`./
)
e
.
message
.
should
.
match
(
/ * mistyped the name or version./
)
e
.
message
.
should
.
match
(
/ * not added the source repo that hosts the Podspec to your Podfile./
)
e
.
message
.
should
.
match
(
/ * out-of-date source repos which you can update with `pod repo update`/
)
e
.
message
.
should
.
match
(
/Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default./
)
e
.
exit_status
.
should
.
equal
(
31
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment