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
26641970
Commit
26641970
authored
Oct 12, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check if dependencies match the platform specified in the Podfile.
parent
0c8d53a4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
1 deletion
+61
-1
resolver.rb
lib/cocoapods/resolver.rb
+14
-1
resolver_spec.rb
spec/unit/resolver_spec.rb
+47
-0
No files found.
lib/cocoapods/resolver.rb
View file @
26641970
...
...
@@ -12,13 +12,26 @@ module Pod
def
find_dependency_sets
(
specification
)
specification
.
dependencies
.
each
do
|
dependency
|
set
=
Source
.
search
(
dependency
)
set
=
find_dependency_set
(
dependency
)
set
.
required_by
(
specification
)
unless
@sets
.
include?
(
set
)
validate_platform!
(
set
)
@sets
<<
set
find_dependency_sets
(
set
.
specification
)
end
end
end
def
find_dependency_set
(
dependency
)
Source
.
search
(
dependency
)
end
def
validate_platform!
(
set
)
spec
=
set
.
specification
unless
spec
.
any_platform?
||
spec
.
platform
==
@specification
.
platform
raise
Informative
,
"The platform required by the Podfile (:
#{
@specification
.
platform
}
) "
\
"does not match that of
#{
spec
}
(:
#{
spec
.
platform
}
)"
end
end
end
end
spec/unit/resolver_spec.rb
View file @
26641970
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
class
StubbedSet
<
Pod
::
Specification
::
Set
attr_accessor
:stub_platform
def
specification
spec
=
super
spec
.
platform
=
@stub_platform
spec
end
end
class
StubbedResolver
<
Pod
::
Resolver
attr_accessor
:stub_platform
def
find_dependency_set
(
dependency
)
set
=
StubbedSet
.
new
(
super
.
pod_dir
)
set
.
stub_platform
=
@stub_platform
set
end
end
describe
"Pod::Resolver"
do
before
do
fixture
(
'spec-repos/master'
)
# ensure the archive is unpacked
...
...
@@ -18,5 +38,32 @@ describe "Pod::Resolver" do
resolver
=
Pod
::
Resolver
.
new
(
Pod
::
Spec
.
new
{
|
s
|
s
.
dependency
'ASIWebPageRequest'
})
resolver
.
resolve
.
sort_by
(
&
:name
).
should
==
sets
.
sort_by
(
&
:name
)
end
it
"does not raise if all dependencies match the platform of the root spec (Podfile)"
do
spec
=
Pod
::
Spec
.
new
{
|
s
|
s
.
dependency
'ASIWebPageRequest'
}
resolver
=
Pod
::
Resolver
.
new
(
spec
)
spec
.
platform
=
:ios
lambda
{
resolver
.
resolve
}.
should
.
not
.
raise
spec
.
platform
=
:osx
lambda
{
resolver
.
resolve
}.
should
.
not
.
raise
end
it
"raises once any of the dependencies does not match the platform of the root spec (Podfile)"
do
spec
=
Pod
::
Spec
.
new
{
|
s
|
s
.
dependency
'ASIWebPageRequest'
}
resolver
=
StubbedResolver
.
new
(
spec
)
spec
.
platform
=
:ios
resolver
.
stub_platform
=
:ios
lambda
{
resolver
.
resolve
}.
should
.
not
.
raise
resolver
.
stub_platform
=
:osx
lambda
{
resolver
.
resolve
}.
should
.
raise
Pod
::
Informative
spec
.
platform
=
:osx
resolver
.
stub_platform
=
:osx
lambda
{
resolver
.
resolve
}.
should
.
not
.
raise
resolver
.
stub_platform
=
:ios
lambda
{
resolver
.
resolve
}.
should
.
raise
Pod
::
Informative
end
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