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
b446d8c9
Commit
b446d8c9
authored
Mar 26, 2012
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Podfile#link_with which takes a target (or an array of targets) to link the library with.
parent
07fad458
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
7 deletions
+29
-7
podfile.rb
lib/cocoapods/podfile.rb
+18
-6
podfile_spec.rb
spec/unit/podfile_spec.rb
+11
-1
No files found.
lib/cocoapods/podfile.rb
View file @
b446d8c9
module
Pod
class
Podfile
class
TargetDefinition
attr_reader
:name
,
:
parent
,
:
target_dependencies
attr_reader
:name
,
:target_dependencies
def
initialize
(
name
,
parent
=
nil
)
@name
,
@parent
,
@target_dependencies
=
name
,
parent
,
[]
attr_accessor
:link_with
,
:parent
def
initialize
(
name
,
options
=
{})
@name
,
@target_dependencies
=
name
,
[]
options
.
each
{
|
k
,
v
|
send
(
"
#{
k
}
="
,
v
)
}
end
def
link_with
=
(
targets
)
@link_with
=
targets
.
is_a?
(
Array
)
?
targets
:
[
targets
]
end
def
lib_name
...
...
@@ -59,6 +66,10 @@ module Pod
platform
?
@platform
=
Platform
.
new
(
platform
,
options
)
:
@platform
end
def
link_with
(
targets
=
nil
)
targets
?
@target_definition
.
link_with
=
targets
:
@target_definition
.
link_with
end
# Specifies a dependency of the project.
#
# A dependency requirement is defined by the name of the Pod and _optionally_
...
...
@@ -156,8 +167,8 @@ module Pod
@target_definition
.
target_dependencies
<<
Dependency
.
new
(
*
name_and_version_requirements
,
&
block
)
end
# Specifies that a BridgeSupport metadata
should be generated from the
# headers of all installed Pods.
# Specifies that a BridgeSupport metadata
document should be generated from
#
the
headers of all installed Pods.
#
# This is for scripting languages such as MacRuby, Nu, and JSCocoa, which use
# it to bridge types, functions, etc better.
...
...
@@ -193,7 +204,8 @@ module Pod
# dependency (JSONKit).
def
target
(
name
,
options
=
{})
parent
=
@target_definition
@target_definitions
[
name
]
=
@target_definition
=
TargetDefinition
.
new
(
name
,
options
[
:exclusive
]
?
nil
:
parent
)
options
[
:parent
]
=
parent
unless
options
.
delete
(
:exclusive
)
@target_definitions
[
name
]
=
@target_definition
=
TargetDefinition
.
new
(
name
,
options
)
yield
ensure
@target_definition
=
parent
...
...
spec/unit/podfile_spec.rb
View file @
b446d8c9
...
...
@@ -74,7 +74,7 @@ describe "Pod::Podfile" do
dependency
'SSZipArchive'
end
target
:test
,
:exclusive
=>
true
do
target
:test
,
:exclusive
=>
true
,
:link_with
=>
'TestRunner'
do
dependency
'JSONKit'
target
:subtarget
do
dependency
'Reachability'
...
...
@@ -115,6 +115,16 @@ describe "Pod::Podfile" do
target
.
lib_name
.
should
==
'Pods-test-subtarget'
target
.
dependencies
.
should
==
[
Pod
::
Dependency
.
new
(
'Reachability'
),
Pod
::
Dependency
.
new
(
'JSONKit'
)]
end
it
"leaves the name of the target, to link with, to be automatically resolved"
do
target
=
@podfile
.
target_definitions
[
:default
]
target
.
link_with
.
should
==
nil
end
it
"returns the name of the explicit target to link with"
do
target
=
@podfile
.
target_definitions
[
:test
]
target
.
link_with
.
should
==
[
'TestRunner'
]
end
end
describe
"concerning validations"
do
...
...
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