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
8d1430a8
Commit
8d1430a8
authored
Jun 07, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Platform] Support initialization from another platform.
parent
6bbdfa3a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
5 deletions
+32
-5
platform.rb
lib/cocoapods/platform.rb
+26
-5
platform_spec.rb
spec/unit/platform_spec.rb
+6
-0
No files found.
lib/cocoapods/platform.rb
View file @
8d1430a8
...
@@ -10,11 +10,32 @@ module Pod
...
@@ -10,11 +10,32 @@ module Pod
attr_reader
:deployment_target
attr_reader
:deployment_target
def
initialize
(
symbolic_name
=
nil
,
deployment_target
=
nil
)
##
@symbolic_name
=
symbolic_name
# Public: Constructs a platform from either another platform or by
if
deployment_target
# specifying the symbolic name and optionally the deployment target.
version
=
deployment_target
.
is_a?
(
Hash
)
?
deployment_target
[:
deployment_target
]
:
deployment_target
# backwards compatibility from 0.6
#
@deployment_target
=
Pod
::
Version
.
create
(
version
)
# input - Another platform or the symbolic name of the platform.
# deployment_target - The optional deployment target if initalized by
# symbolic name
#
# Examples
#
# Platform.new(:ios)
# Platform.new(:ios, '4.3')
# Platform.new(Platform.new(:ios))
#
# Returns nothing.
def
initialize
(
input
=
nil
,
deployment_target
=
nil
)
if
input
.
is_a?
Platform
@symbolic_name
=
input
.
name
@deployment_target
=
input
.
deployment_target
else
@symbolic_name
=
input
if
deployment_target
version
=
deployment_target
.
is_a?
(
Hash
)
?
deployment_target
[:
deployment_target
]
:
deployment_target
# backwards compatibility from 0.6
@deployment_target
=
Pod
::
Version
.
create
(
version
)
end
end
end
end
end
...
...
spec/unit/platform_spec.rb
View file @
8d1430a8
...
@@ -7,6 +7,12 @@ describe Pod::Platform do
...
@@ -7,6 +7,12 @@ describe Pod::Platform do
Pod
::
Platform
.
osx
.
should
==
Pod
::
Platform
.
new
(
:osx
)
Pod
::
Platform
.
osx
.
should
==
Pod
::
Platform
.
new
(
:osx
)
end
end
it
"can be initialized from another platform"
do
platform
=
Pod
::
Platform
.
new
(
:ios
)
new
=
Pod
::
Platform
.
new
(
platform
)
new
.
should
==
platform
end
before
do
before
do
@platform
=
Pod
::
Platform
.
ios
@platform
=
Pod
::
Platform
.
ios
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