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
ff995387
Commit
ff995387
authored
Apr 20, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#212] Check deployment targets at resolution time
parent
b5828a9a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
4 deletions
+50
-4
platform.rb
lib/cocoapods/platform.rb
+6
-1
resolver.rb
lib/cocoapods/resolver.rb
+3
-3
platform_spec.rb
spec/unit/platform_spec.rb
+17
-0
resolver_spec.rb
spec/unit/resolver_spec.rb
+24
-0
No files found.
lib/cocoapods/platform.rb
View file @
ff995387
...
@@ -27,12 +27,17 @@ module Pod
...
@@ -27,12 +27,17 @@ module Pod
end
end
end
end
def
support?
(
other
)
return
true
if
@symbolic_name
.
nil?
||
other
.
nil?
@symbolic_name
==
other
.
name
&&
(
deployment_target
.
nil?
||
other
.
deployment_target
.
nil?
||
deployment_target
>=
other
.
deployment_target
)
end
def
to_s
def
to_s
case
@symbolic_name
case
@symbolic_name
when
:ios
when
:ios
'iOS'
+
(
deployment_target
?
"
#{
deployment_target
}
"
:
''
)
'iOS'
+
(
deployment_target
?
"
#{
deployment_target
}
"
:
''
)
when
:osx
when
:osx
'OS X'
'OS X'
+
(
deployment_target
?
"
#{
deployment_target
}
"
:
''
)
else
else
'iOS - OS X'
'iOS - OS X'
end
end
...
...
lib/cocoapods/resolver.rb
View file @
ff995387
...
@@ -86,9 +86,9 @@ module Pod
...
@@ -86,9 +86,9 @@ module Pod
end
end
def
validate_platform!
(
spec
)
def
validate_platform!
(
spec
)
unless
spec
.
platform
.
nil?
||
spec
.
platform
=
=
@podfile
.
target_definitions
[
:default
].
platform
plaform
=
@podfile
.
target_definitions
[
:default
].
platform
raise
Informative
,
"The platform required by the Podfile (:
#{
@podfile
.
target_definitions
[
:default
].
platform
}
) "
\
unless
plaform
.
support?
(
spec
.
platform
)
"does not match that of
#{
spec
}
(:
#{
spec
.
platform
}
)
"
raise
Informative
,
"The platform required by the Podfile `
#{
plaform
}
' does not match that of
#{
spec
}
`
#{
spec
.
platform
}
'
"
end
end
end
end
end
end
...
...
spec/unit/platform_spec.rb
View file @
ff995387
...
@@ -26,6 +26,23 @@ describe Pod::Platform do
...
@@ -26,6 +26,23 @@ describe Pod::Platform do
@platform
.
to_s
.
should
==
"iOS"
@platform
.
to_s
.
should
==
"iOS"
Pod
::
Platform
.
new
(
:osx
).
to_s
.
should
==
'OS X'
Pod
::
Platform
.
new
(
:osx
).
to_s
.
should
==
'OS X'
Pod
::
Platform
.
new
(
nil
).
to_s
.
should
==
"iOS - OS X"
Pod
::
Platform
.
new
(
nil
).
to_s
.
should
==
"iOS - OS X"
Pod
::
Platform
.
new
(
:ios
,
{
:deployment_target
=>
'5.0.0'
}).
to_s
.
should
==
'iOS 5.0.0'
Pod
::
Platform
.
new
(
:osx
,
{
:deployment_target
=>
'10.7'
}).
to_s
.
should
==
'OS X 10.7'
end
it
"correctly indicates if it supports another platfrom"
do
ios4
=
Pod
::
Platform
.
new
(
:ios
,
{
:deployment_target
=>
'4.0.0'
})
ios5
=
Pod
::
Platform
.
new
(
:ios
,
{
:deployment_target
=>
'5.0.0'
})
ios5
.
should
.
support?
(
ios4
)
ios4
.
should
.
not
.
support?
(
ios5
)
osx6
=
Pod
::
Platform
.
new
(
:osx
,
{
:deployment_target
=>
'10.6'
})
osx7
=
Pod
::
Platform
.
new
(
:osx
,
{
:deployment_target
=>
'10.7'
})
osx7
.
should
.
support?
(
osx6
)
osx6
.
should
.
not
.
support?
(
osx7
)
both
=
Pod
::
Platform
.
new
(
nil
)
both
.
should
.
support?
(
ios4
)
both
.
should
.
support?
(
osx6
)
both
.
should
.
support?
(
nil
)
end
end
it
"uses it's name as it's symbold version"
do
it
"uses it's name as it's symbold version"
do
...
...
spec/unit/resolver_spec.rb
View file @
ff995387
...
@@ -59,6 +59,30 @@ describe "Pod::Resolver" do
...
@@ -59,6 +59,30 @@ describe "Pod::Resolver" do
lambda
{
@resolver
.
resolve
}.
should
.
raise
Pod
::
Informative
lambda
{
@resolver
.
resolve
}.
should
.
raise
Pod
::
Informative
end
end
it
"does not raise if all of the dependencies have a deployment target equal or lower of the root spec (Podfile)"
do
set
=
Pod
::
Spec
::
Set
.
new
(
config
.
repos_dir
+
'master/ASIHTTPRequest'
)
@resolver
.
cached_sets
[
'ASIHTTPRequest'
]
=
set
def
set
.
stub_platform
=
(
platform
);
@stubbed_platform
=
platform
;
end
def
set
.
specification
;
spec
=
super
;
spec
.
platform
=
@stubbed_platform
;
spec
;
end
@podfile
.
platform
:ios
,
{
:deployment_target
=>
"4.0.0"
}
set
.
stub_platform
=
:ios
,
{
:deployment_target
=>
"4.0.0"
}
lambda
{
@resolver
.
resolve
}.
should
.
not
.
raise
end
it
"raises once any of the dependencies requires a higher deployment target of the root spec (Podfile)"
do
set
=
Pod
::
Spec
::
Set
.
new
(
config
.
repos_dir
+
'master/ASIHTTPRequest'
)
@resolver
.
cached_sets
[
'ASIHTTPRequest'
]
=
set
def
set
.
stub_platform
=
(
platform
);
@stubbed_platform
=
platform
;
end
def
set
.
specification
;
spec
=
super
;
spec
.
platform
=
@stubbed_platform
;
spec
;
end
@podfile
.
platform
:ios
,
{
:deployment_target
=>
"4.0.0"
}
set
.
stub_platform
=
:ios
,
{
:deployment_target
=>
"5.0.0"
}
lambda
{
@resolver
.
resolve
}.
should
.
raise
Pod
::
Informative
end
it
"resolves subspecs"
do
it
"resolves subspecs"
do
@podfile
=
Pod
::
Podfile
.
new
do
@podfile
=
Pod
::
Podfile
.
new
do
platform
:ios
platform
:ios
...
...
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