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
d20312c0
Commit
d20312c0
authored
Jun 14, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #321 from CocoaPods/platform-clean
[Platform] Require a name on initialization
parents
71d754c4
9c71d5ab
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
38 deletions
+6
-38
platform.rb
lib/cocoapods/platform.rb
+2
-18
platform_spec.rb
spec/unit/platform_spec.rb
+0
-16
specification_spec.rb
spec/unit/specification_spec.rb
+4
-4
No files found.
lib/cocoapods/platform.rb
View file @
d20312c0
module
Pod
# A platform describes an SDK name and deployment target. If no name
# is provided an instance of this class behaves like nil and represents
# all the known platforms
# A platform describes an SDK name and deployment target.
#
class
Platform
...
...
@@ -49,7 +47,7 @@ module Pod
# platform = Platform.new(:ios)
# Platform.new(platform)
#
def
initialize
(
input
=
nil
,
target
=
nil
)
def
initialize
(
input
,
target
=
nil
)
if
input
.
is_a?
Platform
@symbolic_name
=
input
.
name
@deployment_target
=
input
.
deployment_target
...
...
@@ -107,12 +105,9 @@ module Pod
# one if they have the same name and the other platform has a minor or
# equal deployment target.
#
# @note This method returns true if one of the platforms is nil.
#
# @return Whether the platform supports another platform.
#
def
supports?
(
other
)
return
true
if
@symbolic_name
.
nil?
||
other
.
nil?
other
=
Platform
.
new
(
other
)
(
other
.
name
==
name
)
&&
(
other
.
deployment_target
<=
deployment_target
)
end
...
...
@@ -125,8 +120,6 @@ module Pod
s
=
'iOS'
when
:osx
s
=
'OS X'
else
s
=
'iOS - OS X'
end
s
<<
"
#{
declared_deployment_target
}
"
if
declared_deployment_target
s
...
...
@@ -138,15 +131,6 @@ module Pod
name
end
# @return Whether the platform does not represents any SDK.
#
# @note A platform behaves as nil if doesn't specify an name and
# represents all the known platforms.
#
def
nil?
name
.
nil?
end
# @return Whether the platform requires legacy architectures for iOS.
#
def
requires_legacy_ios_archs?
...
...
spec/unit/platform_spec.rb
View file @
d20312c0
...
...
@@ -37,7 +37,6 @@ describe Pod::Platform do
it
"presents an accurate string representation"
do
@platform
.
to_s
.
should
==
"iOS"
Pod
::
Platform
.
new
(
:osx
).
to_s
.
should
==
'OS X'
Pod
::
Platform
.
new
(
nil
).
to_s
.
should
==
"iOS - OS X"
Pod
::
Platform
.
new
(
:ios
,
'5.0.0'
).
to_s
.
should
==
'iOS 5.0.0'
Pod
::
Platform
.
new
(
:osx
,
'10.7'
).
to_s
.
should
==
'OS X 10.7'
end
...
...
@@ -62,16 +61,6 @@ describe Pod::Platform do
end
end
describe
"with a nil value"
do
before
do
@platform
=
Pod
::
Platform
.
new
(
nil
)
end
it
"behaves like a nil object"
do
@platform
.
should
.
be
.
nil
end
end
describe
"regarding supporting platforms"
do
it
"supports platforms with the same operating system"
do
p1
=
Pod
::
Platform
.
new
(
:ios
)
...
...
@@ -83,11 +72,6 @@ describe Pod::Platform do
p1
.
should
.
supports?
(
p2
)
end
it
"supports a nil platform"
do
p1
=
Pod
::
Platform
.
new
(
:ios
)
p1
.
should
.
supports?
(
nil
)
end
it
"supports a platform with a lower or equal deployment_target"
do
p1
=
Pod
::
Platform
.
new
(
:ios
,
'5.0'
)
p2
=
Pod
::
Platform
.
new
(
:ios
,
'4.0'
)
...
...
spec/unit/specification_spec.rb
View file @
d20312c0
...
...
@@ -353,7 +353,7 @@ describe "A Pod::Specification subspec" do
end
it
"does not cache platform attributes and can activate another platform"
do
@spec
.
platform
=
nil
@spec
.
stubs
(
:platform
).
returns
nil
@spec
.
activate_platform
(
:ios
)
@subsubspec
.
source_files
.
map
{
|
f
|
f
.
to_s
}.
should
==
%w[ spec.m subspec_ios.m subsubspec.m ]
@spec
.
activate_platform
(
:osx
)
...
...
@@ -361,7 +361,7 @@ describe "A Pod::Specification subspec" do
end
it
"resolves correctly the available platforms"
do
@spec
.
platform
=
nil
@spec
.
stubs
(
:platform
).
returns
nil
@subspec
.
platform
=
:ios
,
'4.0'
@spec
.
available_platforms
.
map
{
|
p
|
p
.
to_sym
}.
should
==
[
:osx
,
:ios
]
@subspec
.
available_platforms
.
first
.
to_sym
.
should
==
:ios
...
...
@@ -373,7 +373,7 @@ describe "A Pod::Specification subspec" do
end
it
"resolves reports correctly the supported platforms"
do
@spec
.
platform
=
nil
@spec
.
stubs
(
:platform
).
returns
nil
@subspec
.
platform
=
:ios
,
'4.0'
@subsubspec
.
platform
=
:ios
,
'5.0'
@spec
.
supports_platform?
(
:ios
).
should
.
be
.
true
...
...
@@ -406,7 +406,7 @@ describe "A Pod::Specification subspec" do
@subspec
.
active_platform
.
should
==
:ios
@subsubspec
.
active_platform
.
should
==
:ios
@spec
.
platform
=
nil
@spec
.
stubs
(
:platform
).
returns
nil
@subsubspec
.
activate_platform
(
:osx
)
@subspec
.
active_platform
.
should
==
:osx
@spec
.
active_platform
.
should
==
:osx
...
...
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