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