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
cf662d16
Commit
cf662d16
authored
Nov 12, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disambiguate the use of the word ‘target’.
parent
30c8a1e5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
25 deletions
+25
-25
installer.rb
lib/cocoapods/installer.rb
+9
-9
podfile.rb
lib/cocoapods/podfile.rb
+8
-8
integration_spec.rb
spec/integration_spec.rb
+2
-2
installer_spec.rb
spec/unit/installer_spec.rb
+2
-2
podfile_spec.rb
spec/unit/podfile_spec.rb
+3
-3
xcodeproj_ext_spec.rb
spec/unit/xcodeproj_ext_spec.rb
+1
-1
No files found.
lib/cocoapods/installer.rb
View file @
cf662d16
...
...
@@ -46,7 +46,7 @@ EOS
end
end
class
Target
class
Target
Installer
include
Config
::
Mixin
include
Shared
...
...
@@ -187,9 +187,9 @@ EOS
@project
end
def
targets
@target
s
||=
@podfile
.
targets
.
values
.
map
do
|
target_
definition
|
Target
.
new
(
@podfile
,
project
,
target_
definition
)
def
target
_installer
s
@target
_installers
||=
@podfile
.
target_definitions
.
values
.
map
do
|
definition
|
Target
Installer
.
new
(
@podfile
,
project
,
definition
)
end
end
...
...
@@ -199,9 +199,9 @@ EOS
root
=
config
.
project_pods_root
puts
"==> Generating Xcode project and xcconfig"
unless
config
.
silent?
target
s
.
each
do
|
target
|
target
.
install!
target
.
create_files_in
(
root
)
target
_installers
.
each
do
|
target_installer
|
target
_installer
.
install!
target
_installer
.
create_files_in
(
root
)
end
projpath
=
File
.
join
(
root
,
'Pods.xcodeproj'
)
puts
" * Writing Xcode project file to `
#{
projpath
}
'"
if
config
.
verbose?
...
...
@@ -210,8 +210,8 @@ EOS
generate_lock_file!
# Post install hooks run last!
target
s
.
each
do
|
target
|
target
.
build_specifications
.
each
{
|
spec
|
spec
.
post_install
(
target
)
}
target
_installers
.
each
do
|
target_installer
|
target
_installer
.
build_specifications
.
each
{
|
spec
|
spec
.
post_install
(
target_installer
)
}
end
end
...
...
lib/cocoapods/podfile.rb
View file @
cf662d16
module
Pod
class
Podfile
class
Target
class
Target
Definition
attr_reader
:name
,
:parent
,
:target_dependencies
def
initialize
(
name
,
parent
=
nil
)
...
...
@@ -30,7 +30,7 @@ module Pod
include
Config
::
Mixin
def
initialize
(
&
block
)
@target
s
=
{
:default
=>
(
@target
=
Target
.
new
(
:default
))
}
@target
_definitions
=
{
:default
=>
(
@target_definition
=
TargetDefinition
.
new
(
:default
))
}
instance_eval
(
&
block
)
end
...
...
@@ -138,11 +138,11 @@ module Pod
#
#
def
dependency
(
*
name_and_version_requirements
,
&
block
)
@target
.
target_dependencies
<<
Dependency
.
new
(
*
name_and_version_requirements
,
&
block
)
@target
_definition
.
target_dependencies
<<
Dependency
.
new
(
*
name_and_version_requirements
,
&
block
)
end
def
dependencies
@targets
.
values
.
map
(
&
:target_dependencies
).
flatten
@target
_definition
s
.
values
.
map
(
&
:target_dependencies
).
flatten
end
# Specifies that a BridgeSupport metadata should be generated from the
...
...
@@ -154,7 +154,7 @@ module Pod
@generate_bridge_support
=
true
end
attr_reader
:targets
attr_reader
:target
_definition
s
# Defines a new static library target and scopes dependencies defined from
# the given block. The target will by default include the dependencies
...
...
@@ -183,11 +183,11 @@ module Pod
# however, is an exclusive target which means it will only have one
# dependency (JSONKit).
def
target
(
name
,
options
=
{})
parent
=
@target
@target
s
[
name
]
=
@target
=
Target
.
new
(
name
,
options
[
:exclusive
]
?
nil
:
parent
)
parent
=
@target
_definition
@target
_definitions
[
name
]
=
@target_definition
=
TargetDefinition
.
new
(
name
,
options
[
:exclusive
]
?
nil
:
parent
)
yield
ensure
@target
=
parent
@target
_definition
=
parent
end
# This is to be compatible with a Specification for use in the Installer and
...
...
spec/integration_spec.rb
View file @
cf662d16
...
...
@@ -158,7 +158,7 @@ else
YAML
.
load
(
installer
.
lock_file
.
read
).
should
==
lock_file_contents
root
=
config
.
project_pods_root
(
root
+
'Pods.xcconfig'
).
read
.
should
==
installer
.
targets
.
first
.
xcconfig
.
to_s
(
root
+
'Pods.xcconfig'
).
read
.
should
==
installer
.
target
_installer
s
.
first
.
xcconfig
.
to_s
project_file
=
(
root
+
'Pods.xcodeproj/project.pbxproj'
).
to_s
NSDictionary
.
dictionaryWithContentsOfFile
(
project_file
).
should
==
installer
.
project
.
to_hash
...
...
@@ -197,7 +197,7 @@ else
end
installer
=
SpecHelper
::
Installer
.
new
(
spec
)
installer
.
targets
.
first
.
build_specifications
.
first
.
resources
=
'LICEN*'
,
'Readme.*'
installer
.
target
_installer
s
.
first
.
build_specifications
.
first
.
resources
=
'LICEN*'
,
'Readme.*'
installer
.
install!
contents
=
(
config
.
project_pods_root
+
'Pods-resources.sh'
).
read
...
...
spec/unit/installer_spec.rb
View file @
cf662d16
...
...
@@ -3,7 +3,7 @@ require File.expand_path('../../spec_helper', __FILE__)
describe
"Pod::Installer"
do
describe
", by default,"
do
before
do
@xcconfig
=
Pod
::
Installer
.
new
(
Pod
::
Podfile
.
new
{
platform
:ios
}).
targets
.
first
.
xcconfig
.
to_hash
@xcconfig
=
Pod
::
Installer
.
new
(
Pod
::
Podfile
.
new
{
platform
:ios
}).
target
_installer
s
.
first
.
xcconfig
.
to_hash
end
it
"sets the header search paths where installed Pod headers can be found"
do
...
...
@@ -44,6 +44,6 @@ describe "Pod::Installer" do
expected
<<
config
.
project_pods_root
+
header
end
end
installer
.
targets
.
first
.
bridge_support_generator
.
headers
.
should
==
expected
installer
.
target
_installer
s
.
first
.
bridge_support_generator
.
headers
.
should
==
expected
end
end
spec/unit/podfile_spec.rb
View file @
cf662d16
...
...
@@ -69,13 +69,13 @@ describe "Pod::Podfile" do
end
it
"adds dependencies outside of any explicit target block to the default target"
do
target
=
@podfile
.
targets
[
:default
]
target
=
@podfile
.
target
_definition
s
[
:default
]
target
.
lib_name
.
should
==
'Pods'
target
.
dependencies
.
should
==
[
Pod
::
Dependency
.
new
(
'ASIHTTPRequest'
)]
end
it
"adds dependencies of the outer target to non-exclusive targets"
do
target
=
@podfile
.
targets
[
:debug
]
target
=
@podfile
.
target
_definition
s
[
:debug
]
target
.
lib_name
.
should
==
'Pods-debug'
target
.
dependencies
.
sort_by
(
&
:name
).
should
==
[
Pod
::
Dependency
.
new
(
'ASIHTTPRequest'
),
...
...
@@ -84,7 +84,7 @@ describe "Pod::Podfile" do
end
it
"does not add dependencies of the outer target to exclusive targets"
do
target
=
@podfile
.
targets
[
:test
]
target
=
@podfile
.
target
_definition
s
[
:test
]
target
.
lib_name
.
should
==
'Pods-test'
target
.
dependencies
.
should
==
[
Pod
::
Dependency
.
new
(
'JSONKit'
)]
end
...
...
spec/unit/xcodeproj_ext_spec.rb
View file @
cf662d16
...
...
@@ -27,7 +27,7 @@ describe 'Xcodeproj::Project' do
phase
=
@project
.
targets
.
first
.
copy_files_build_phases
.
new_pod_dir
(
"SomePod"
,
"Path/To/Source"
)
find_object
({
'isa'
=>
'PBXCopyFilesBuildPhase'
,
'dstPath'
=>
'$(P
UBLIC_HEADERS_FOLDER_PATH
)/Path/To/Source'
,
'dstPath'
=>
'$(P
RODUCT_NAME
)/Path/To/Source'
,
'name'
=>
'Copy SomePod Public Headers'
}).
should
.
not
==
nil
@project
.
targets
.
first
.
buildPhases
.
should
.
include
phase
...
...
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