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
b0df36df
Commit
b0df36df
authored
Jun 10, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Installer] Rename #targets to #aggregate_targets
parent
d7f9903d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
33 deletions
+34
-33
installer_representation.rb
lib/cocoapods/hooks/installer_representation.rb
+1
-1
installer.rb
lib/cocoapods/installer.rb
+17
-16
validator.rb
lib/cocoapods/validator.rb
+1
-1
installer_representation_spec.rb
spec/unit/hooks/installer_representation_spec.rb
+2
-2
installer_spec.rb
spec/unit/installer_spec.rb
+13
-13
No files found.
lib/cocoapods/hooks/installer_representation.rb
View file @
b0df36df
...
...
@@ -70,7 +70,7 @@ module Pod
#
def
pods_by_lib
result
=
{}
installer
.
targets
.
map
(
&
:pod_targets
).
flatten
.
each
do
|
lib
|
installer
.
aggregate_
targets
.
map
(
&
:pod_targets
).
flatten
.
each
do
|
lib
|
pod_names
=
[
lib
.
root_spec
.
name
]
pod_reps
=
pods
.
select
{
|
rep
|
pod_names
.
include?
(
rep
.
name
)
}
result
[
lib
.
target_definition
]
=
pod_reps
...
...
lib/cocoapods/installer.rb
View file @
b0df36df
...
...
@@ -111,7 +111,7 @@ module Pod
prepare_pods_project
install_file_references
install_libraries
link_
integration_libraries
link_
aggregate_target
run_post_install_hooks
write_pod_project
write_lockfiles
...
...
@@ -140,7 +140,7 @@ module Pod
# @return [Array<AggregateTarget>] The Podfile targets containing library
# dependencies.
#
attr_reader
:targets
attr_reader
:
aggregate_
targets
# @return [Array<Specification>] The specifications that where installed.
#
...
...
@@ -168,7 +168,7 @@ module Pod
analyzer
=
Analyzer
.
new
(
sandbox
,
podfile
,
lockfile
)
analyzer
.
update_mode
=
update_mode
@analysis_result
=
analyzer
.
analyze
@targets
=
analyzer
.
result
.
targets
@
aggregate_
targets
=
analyzer
.
result
.
targets
end
# Prepares the Pods folder in order to be compatible with the most recent
...
...
@@ -208,7 +208,7 @@ module Pod
# created by the Pod source installer as well.
#
def
create_file_accessors
targets
.
each
do
|
target
|
aggregate_
targets
.
each
do
|
target
|
target
.
pod_targets
.
each
do
|
pod_target
|
pod_root
=
sandbox
.
pod_dir
(
pod_target
.
root_spec
.
name
)
path_list
=
Sandbox
::
PathList
.
new
(
pod_root
)
...
...
@@ -289,7 +289,7 @@ module Pod
@pods_project
.
add_podfile
(
config
.
podfile_path
)
end
sandbox
.
project
=
@pods_project
platforms
=
targets
.
map
(
&
:platform
)
platforms
=
aggregate_
targets
.
map
(
&
:platform
)
osx_deployment_target
=
platforms
.
select
{
|
p
|
p
.
name
==
:osx
}.
map
(
&
:deployment_target
).
min
ios_deployment_target
=
platforms
.
select
{
|
p
|
p
.
name
==
:ios
}.
map
(
&
:deployment_target
).
min
@pods_project
.
build_configurations
.
each
do
|
build_configuration
|
...
...
@@ -301,7 +301,8 @@ module Pod
# Installs the file references in the Pods project. This is done once per
# Pod as the same file reference might be shared by multiple targets.
# Pod as the same file reference might be shared by multiple aggregate
# targets.
#
# @return [void]
#
...
...
@@ -310,7 +311,7 @@ module Pod
installer
.
install!
end
# Installs the
library
targets of the Pods projects and generates their
# Installs the
aggregate
targets of the Pods projects and generates their
# support files.
#
# @return [void]
...
...
@@ -323,7 +324,7 @@ module Pod
target_installer
.
install!
end
targets
.
sort_by
(
&
:name
).
each
do
|
target
|
aggregate_
targets
.
sort_by
(
&
:name
).
each
do
|
target
|
next
if
target
.
target_definition
.
empty?
target_installer
=
AggregateTargetInstaller
.
new
(
sandbox
,
target
)
target_installer
.
install!
...
...
@@ -331,16 +332,16 @@ module Pod
end
end
# Links the
integration library targets with all the dependent libraries
# Links the
aggregate targets with all the dependent libraries.
#
# @note This is run in the integration step to ensure that targets
# have been created for all per spec libraries.
#
def
link_
integration_libraries
targets
.
each
do
|
target
|
native_target
=
pods_project
.
targets
.
select
{
|
t
|
t
.
name
==
target
.
name
}.
first
def
link_
aggregate_target
aggregate_targets
.
each
do
|
aggregate_
target
|
native_target
=
pods_project
.
targets
.
select
{
|
t
|
t
.
name
==
aggregate_
target
.
name
}.
first
products
=
pods_project
.
products_group
target
.
pod_targets
.
each
do
|
pod_target
|
aggregate_
target
.
pod_targets
.
each
do
|
pod_target
|
product
=
products
.
files
.
select
{
|
f
|
f
.
path
==
pod_target
.
product_name
}.
first
native_target
.
frameworks_build_phase
.
add_file_reference
(
product
)
end
...
...
@@ -391,9 +392,9 @@ module Pod
# information in the lockfile.
#
def
integrate_user_project
UI
.
section
"Integrating client
#{
'project'
.
pluralize
(
targets
.
map
(
&
:user_project_path
).
uniq
.
count
)
}
"
do
UI
.
section
"Integrating client
#{
'project'
.
pluralize
(
aggregate_
targets
.
map
(
&
:user_project_path
).
uniq
.
count
)
}
"
do
installation_root
=
config
.
installation_root
integrator
=
UserProjectIntegrator
.
new
(
podfile
,
sandbox
,
installation_root
,
targets
)
integrator
=
UserProjectIntegrator
.
new
(
podfile
,
sandbox
,
installation_root
,
aggregate_
targets
)
integrator
.
integrate!
end
end
...
...
@@ -577,7 +578,7 @@ module Pod
# process.
#
def
pod_targets
targets
.
map
(
&
:pod_targets
).
flatten
aggregate_
targets
.
map
(
&
:pod_targets
).
flatten
end
#-------------------------------------------------------------------------#
...
...
lib/cocoapods/validator.rb
View file @
b0df36df
...
...
@@ -208,7 +208,7 @@ module Pod
installer
=
Installer
.
new
(
sandbox
,
podfile
)
installer
.
install!
file_accessors
=
installer
.
targets
.
first
.
pod_targets
.
first
.
file_accessors
file_accessors
=
installer
.
aggregate_
targets
.
first
.
pod_targets
.
first
.
file_accessors
@file_accessor
=
file_accessors
.
find
{
|
accessor
|
accessor
.
spec
==
spec
}
config
.
silent
end
...
...
spec/unit/hooks/installer_representation_spec.rb
View file @
b0df36df
...
...
@@ -16,7 +16,7 @@ module Pod
config
.
integrate_targets
=
false
@installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
@installer
.
send
(
:analyze
)
@specs
=
@installer
.
targets
.
first
.
pod_targets
.
first
.
specs
@specs
=
@installer
.
aggregate_
targets
.
first
.
pod_targets
.
first
.
specs
@installer
.
stubs
(
:installed_specs
).
returns
(
@specs
)
@rep
=
Hooks
::
InstallerRepresentation
.
new
(
@installer
)
end
...
...
@@ -52,7 +52,7 @@ module Pod
it
"returns the pods representation by library representation"
do
pods_by_lib
=
@rep
.
pods_by_lib
target_definition
=
@installer
.
targets
.
first
.
pod_targets
.
first
.
target_definition
target_definition
=
@installer
.
aggregate_
targets
.
first
.
pod_targets
.
first
.
target_definition
pods_by_lib
[
target_definition
].
map
(
&
:name
).
should
==
[
'JSONKit'
]
end
...
...
spec/unit/installer_spec.rb
View file @
b0df36df
...
...
@@ -62,7 +62,7 @@ module Pod
@installer
.
stubs
(
:run_pre_install_hooks
)
@installer
.
stubs
(
:install_file_references
)
@installer
.
stubs
(
:install_libraries
)
@installer
.
stubs
(
:link_
integration_libraries
)
@installer
.
stubs
(
:link_
aggregate_target
)
@installer
.
stubs
(
:write_lockfiles
)
@installer
.
unstub
(
:generate_pods_project
)
def
@installer
.
run_post_install_hooks
...
...
@@ -107,7 +107,7 @@ module Pod
it
"stores the targets created by the analyzer"
do
@installer
.
send
(
:analyze
)
@installer
.
targets
.
map
(
&
:name
).
sort
.
should
==
[
'Pods'
]
@installer
.
aggregate_
targets
.
map
(
&
:name
).
sort
.
should
==
[
'Pods'
]
@installer
.
pod_targets
.
map
(
&
:name
).
sort
.
should
==
[
'Pods-JSONKit'
]
end
...
...
@@ -115,7 +115,7 @@ module Pod
@installer
.
update_mode
=
true
Installer
::
Analyzer
.
any_instance
.
expects
(
:update_mode
=
).
with
(
true
)
@installer
.
send
(
:analyze
)
@installer
.
targets
.
map
(
&
:name
).
sort
.
should
==
[
'Pods'
]
@installer
.
aggregate_
targets
.
map
(
&
:name
).
sort
.
should
==
[
'Pods'
]
@installer
.
pod_targets
.
map
(
&
:name
).
sort
.
should
==
[
'Pods-JSONKit'
]
end
...
...
@@ -217,13 +217,13 @@ module Pod
describe
"#prepare_pods_project"
do
it
"creates the Pods project"
do
@installer
.
stubs
(
:targets
).
returns
([])
@installer
.
stubs
(
:
aggregate_
targets
).
returns
([])
@installer
.
send
(
:prepare_pods_project
)
@installer
.
pods_project
.
class
.
should
==
Pod
::
Project
end
it
"adds the Podfile to the Pods project"
do
@installer
.
stubs
(
:targets
).
returns
([])
@installer
.
stubs
(
:
aggregate_
targets
).
returns
([])
config
.
stubs
(
:podfile_path
).
returns
(
Pathname
.
new
(
'/Podfile'
))
@installer
.
send
(
:prepare_pods_project
)
f
=
@installer
.
pods_project
[
'Podfile'
]
...
...
@@ -235,7 +235,7 @@ module Pod
pod_target_osx
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target_ios
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
))
pod_target_osx
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:osx
,
'10.8'
))
@installer
.
stubs
(
:targets
).
returns
([
pod_target_ios
,
pod_target_osx
])
@installer
.
stubs
(
:
aggregate_
targets
).
returns
([
pod_target_ios
,
pod_target_osx
])
@installer
.
send
(
:prepare_pods_project
)
build_settings
=
@installer
.
pods_project
.
build_configurations
.
map
(
&
:build_settings
)
build_settings
.
should
==
[
...
...
@@ -266,7 +266,7 @@ module Pod
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
nil
)
target_definition
.
store_pod
(
'BananaLib'
)
pod_target
=
PodTarget
.
new
([
spec
],
target_definition
,
config
.
sandbox
)
@installer
.
stubs
(
:targets
).
returns
([])
@installer
.
stubs
(
:
aggregate_
targets
).
returns
([])
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
Installer
::
PodTargetInstaller
.
any_instance
.
expects
(
:install!
)
@installer
.
send
(
:install_libraries
)
...
...
@@ -276,7 +276,7 @@ module Pod
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
nil
)
pod_target
=
PodTarget
.
new
([
spec
],
target_definition
,
config
.
sandbox
)
@installer
.
stubs
(
:targets
).
returns
([])
@installer
.
stubs
(
:
aggregate_
targets
).
returns
([])
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
Installer
::
PodTargetInstaller
.
any_instance
.
expects
(
:install!
).
never
@installer
.
send
(
:install_libraries
)
...
...
@@ -289,7 +289,7 @@ module Pod
describe
"#write_pod_project"
do
before
do
@installer
.
stubs
(
:targets
).
returns
([])
@installer
.
stubs
(
:
aggregate_
targets
).
returns
([])
@installer
.
send
(
:prepare_pods_project
)
end
...
...
@@ -359,15 +359,15 @@ module Pod
pods_target
=
project
.
new_target
(
:static_library
,
target
.
name
,
:ios
)
native_target
=
project
.
new_target
(
:static_library
,
pod_target
.
name
,
:ios
)
@installer
.
stubs
(
:pods_project
).
returns
(
project
)
@installer
.
stubs
(
:targets
).
returns
([
target
])
@installer
.
stubs
(
:
aggregate_
targets
).
returns
([
target
])
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
@installer
.
send
(
:link_
integration_libraries
)
@installer
.
send
(
:link_
aggregate_target
)
pods_target
.
frameworks_build_phase
.
files
.
map
(
&
:display_name
).
should
.
include?
(
pod_target
.
product_name
)
end
it
"integrates the client projects"
do
@installer
.
stubs
(
:targets
).
returns
([
AggregateTarget
.
new
(
nil
,
config
.
sandbox
)])
@installer
.
stubs
(
:
aggregate_
targets
).
returns
([
AggregateTarget
.
new
(
nil
,
config
.
sandbox
)])
Installer
::
UserProjectIntegrator
.
any_instance
.
expects
(
:integrate!
)
@installer
.
send
(
:integrate_user_project
)
end
...
...
@@ -383,7 +383,7 @@ module Pod
@specs
=
@installer
.
pod_targets
.
map
(
&
:specs
).
flatten
@spec
=
@specs
.
find
{
|
spec
|
spec
&&
spec
.
name
==
'JSONKit'
}
@installer
.
stubs
(
:installed_specs
).
returns
(
@specs
)
@lib
=
@installer
.
targets
.
first
.
pod_targets
.
first
@lib
=
@installer
.
aggregate_
targets
.
first
.
pod_targets
.
first
end
it
"runs the pre install hooks"
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