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
b8160f92
Commit
b8160f92
authored
Sep 08, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PodsProjectGenerator] Improve sync logic
parent
8c401549
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
40 deletions
+15
-40
pods_project_generator.rb
lib/cocoapods/installer/pods_project_generator.rb
+0
-0
pods_project_generator_spec.rb
spec/unit/installer/pods_project_generator_spec.rb
+15
-40
No files found.
lib/cocoapods/installer/pods_project_generator.rb
View file @
b8160f92
This diff is collapsed.
Click to expand it.
spec/unit/installer/pods_project_generator_spec.rb
View file @
b8160f92
...
@@ -17,10 +17,11 @@ module Pod
...
@@ -17,10 +17,11 @@ module Pod
@sut
.
project
.
should
.
not
.
be
.
nil
@sut
.
project
.
should
.
not
.
be
.
nil
end
end
it
"
can write
the pods project"
do
it
"
writes
the pods project"
do
@sut
.
send
(
:install
)
@sut
.
send
(
:install
)
@sut
.
project
.
expects
(
:prepare_for_serialization
)
@sut
.
project
.
expects
(
:save
)
@sut
.
project
.
expects
(
:save
)
@sut
.
send
(
:write_p
od_p
roject
)
@sut
.
send
(
:write_project
)
end
end
end
end
...
@@ -39,7 +40,7 @@ module Pod
...
@@ -39,7 +40,7 @@ module Pod
@sut
.
project
.
class
.
should
==
Pod
::
Project
@sut
.
project
.
class
.
should
==
Pod
::
Project
end
end
it
"creates a group for each Pod"
do
x
it
"creates a group for each Pod"
do
pod_target
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target
.
stubs
(
:pod_name
).
returns
(
'BananaLib'
)
pod_target
.
stubs
(
:pod_name
).
returns
(
'BananaLib'
)
@sut
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
@sut
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
...
@@ -47,7 +48,7 @@ module Pod
...
@@ -47,7 +48,7 @@ module Pod
@sut
.
project
[
'Pods/BananaLib'
].
should
.
not
.
be
.
nil
@sut
.
project
[
'Pods/BananaLib'
].
should
.
not
.
be
.
nil
end
end
it
"creates a group for each development Pod"
do
x
it
"creates a group for each development Pod"
do
pod_target
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target
.
stubs
(
:pod_name
).
returns
(
'BananaLib'
)
pod_target
.
stubs
(
:pod_name
).
returns
(
'BananaLib'
)
@sut
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
@sut
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
...
@@ -99,7 +100,7 @@ module Pod
...
@@ -99,7 +100,7 @@ module Pod
@sut
=
PodsProjectGenerator
.
new
(
config
.
sandbox
,
[])
@sut
=
PodsProjectGenerator
.
new
(
config
.
sandbox
,
[])
end
end
it
"installs the file references"
do
x
it
"installs the file references"
do
Installer
::
PodsProjectGenerator
::
FileReferencesInstaller
.
any_instance
.
expects
(
:install!
)
Installer
::
PodsProjectGenerator
::
FileReferencesInstaller
.
any_instance
.
expects
(
:install!
)
@sut
.
send
(
:install_file_references
)
@sut
.
send
(
:install_file_references
)
end
end
...
@@ -119,21 +120,21 @@ module Pod
...
@@ -119,21 +120,21 @@ module Pod
@sut
=
PodsProjectGenerator
.
new
(
config
.
sandbox
,
[
aggregate_target
])
@sut
=
PodsProjectGenerator
.
new
(
config
.
sandbox
,
[
aggregate_target
])
end
end
it
"install the aggregate targets"
do
x
it
"install the aggregate targets"
do
@target_definition
.
store_pod
(
'BananaLib'
)
@target_definition
.
store_pod
(
'BananaLib'
)
Installer
::
PodsProjectGenerator
::
PodTargetInstaller
.
any_instance
.
stubs
(
:install!
)
Installer
::
PodsProjectGenerator
::
PodTargetInstaller
.
any_instance
.
stubs
(
:install!
)
Installer
::
PodsProjectGenerator
::
AggregateTargetInstaller
.
any_instance
.
expects
(
:install!
)
Installer
::
PodsProjectGenerator
::
AggregateTargetInstaller
.
any_instance
.
expects
(
:install!
)
@sut
.
send
(
:install_targets
)
@sut
.
send
(
:install_targets
)
end
end
it
"install the Pod targets"
do
x
it
"install the Pod targets"
do
@target_definition
.
store_pod
(
'BananaLib'
)
@target_definition
.
store_pod
(
'BananaLib'
)
Installer
::
PodsProjectGenerator
::
AggregateTargetInstaller
.
any_instance
.
stubs
(
:install!
)
Installer
::
PodsProjectGenerator
::
AggregateTargetInstaller
.
any_instance
.
stubs
(
:install!
)
Installer
::
PodsProjectGenerator
::
PodTargetInstaller
.
any_instance
.
expects
(
:install!
)
Installer
::
PodsProjectGenerator
::
PodTargetInstaller
.
any_instance
.
expects
(
:install!
)
@sut
.
send
(
:install_targets
)
@sut
.
send
(
:install_targets
)
end
end
it
"skips empty targets"
do
x
it
"skips empty targets"
do
Installer
::
PodsProjectGenerator
::
PodTargetInstaller
.
any_instance
.
expects
(
:install!
).
never
Installer
::
PodsProjectGenerator
::
PodTargetInstaller
.
any_instance
.
expects
(
:install!
).
never
Installer
::
PodsProjectGenerator
::
PodTargetInstaller
.
any_instance
.
expects
(
:install!
).
never
Installer
::
PodsProjectGenerator
::
PodTargetInstaller
.
any_instance
.
expects
(
:install!
).
never
@sut
.
send
(
:install_targets
)
@sut
.
send
(
:install_targets
)
...
@@ -158,7 +159,7 @@ module Pod
...
@@ -158,7 +159,7 @@ module Pod
@sut
.
send
(
:prepare_project
)
@sut
.
send
(
:prepare_project
)
end
end
it
'adds the frameworks required by to the pod to the project for informative purposes'
do
x
it
'adds the frameworks required by to the pod to the project for informative purposes'
do
Project
.
any_instance
.
expects
(
:add_system_framework
).
with
(
'QuartzCore'
,
@pod_native_target
)
Project
.
any_instance
.
expects
(
:add_system_framework
).
with
(
'QuartzCore'
,
@pod_native_target
)
@sut
.
send
(
:install_system_frameworks
)
@sut
.
send
(
:install_system_frameworks
)
end
end
...
@@ -166,7 +167,7 @@ module Pod
...
@@ -166,7 +167,7 @@ module Pod
#-----------------------------------------------------------------------#
#-----------------------------------------------------------------------#
describe
"#s
et
_target_dependencies"
do
describe
"#s
ync
_target_dependencies"
do
before
do
before
do
project
=
Pod
::
Project
.
new
(
config
.
sandbox
.
project_path
)
project
=
Pod
::
Project
.
new
(
config
.
sandbox
.
project_path
)
...
@@ -187,14 +188,14 @@ module Pod
...
@@ -187,14 +188,14 @@ module Pod
it
"sets the pod targets as dependencies of the aggregate target"
do
it
"sets the pod targets as dependencies of the aggregate target"
do
@sut
.
send
(
:s
et
_target_dependencies
)
@sut
.
send
(
:s
ync
_target_dependencies
)
dependencies
=
@aggregate_target
.
target
.
dependencies
dependencies
=
@aggregate_target
.
target
.
dependencies
dependencies
.
map
{
|
d
|
d
.
target
.
name
}.
should
==
[
"Pods-BananaLib"
,
"Pods-monkey"
]
dependencies
.
map
{
|
d
|
d
.
target
.
name
}.
should
==
[
"Pods-BananaLib"
,
"Pods-monkey"
]
end
end
it
"sets the dependencies of the pod targets"
do
it
"sets the dependencies of the pod targets"
do
@pod_target_1
.
stubs
(
:dependencies
).
returns
([
'monkey'
])
@pod_target_1
.
stubs
(
:dependencies
).
returns
([
'monkey'
])
@sut
.
send
(
:s
et
_target_dependencies
)
@sut
.
send
(
:s
ync
_target_dependencies
)
dependencies
=
@pod_target_1
.
target
.
dependencies
dependencies
=
@pod_target_1
.
target
.
dependencies
dependencies
.
map
{
|
d
|
d
.
target
.
name
}.
should
==
[
"Pods-monkey"
]
dependencies
.
map
{
|
d
|
d
.
target
.
name
}.
should
==
[
"Pods-monkey"
]
end
end
...
@@ -203,7 +204,7 @@ module Pod
...
@@ -203,7 +204,7 @@ module Pod
#-----------------------------------------------------------------------#
#-----------------------------------------------------------------------#
describe
"#
link_aggregate_target
"
do
describe
"#
sync_aggregate_targets_libraries
"
do
before
do
before
do
project
=
Pod
::
Project
.
new
(
config
.
sandbox
.
project_path
)
project
=
Pod
::
Project
.
new
(
config
.
sandbox
.
project_path
)
...
@@ -218,7 +219,7 @@ module Pod
...
@@ -218,7 +219,7 @@ module Pod
end
end
it
"links the aggregate targets to the pod targets"
do
it
"links the aggregate targets to the pod targets"
do
@sut
.
send
(
:
link_aggregate_target
)
@sut
.
send
(
:
sync_aggregate_targets_libraries
)
@aggregate_native_target
.
frameworks_build_phase
.
files
.
map
(
&
:file_ref
).
should
.
include?
(
@pod_native_target
.
product_reference
)
@aggregate_native_target
.
frameworks_build_phase
.
files
.
map
(
&
:file_ref
).
should
.
include?
(
@pod_native_target
.
product_reference
)
end
end
...
@@ -226,32 +227,6 @@ module Pod
...
@@ -226,32 +227,6 @@ module Pod
#-----------------------------------------------------------------------#
#-----------------------------------------------------------------------#
describe
"#clean_up_project"
do
before
do
@sut
=
PodsProjectGenerator
.
new
(
config
.
sandbox
,
[])
@sut
.
install
end
it
"removes the Pods group if empty"
do
@sut
.
send
(
:write_pod_project
)
@sut
.
project
[
'Pods'
].
should
.
be
.
nil
end
it
"removes the Development Pods group if empty"
do
@sut
.
send
(
:write_pod_project
)
@sut
.
project
[
'Development Pods'
].
should
.
be
.
nil
end
it
"recursively sorts the project by type"
do
@sut
.
project
.
main_group
.
expects
(
:recursively_sort_by_type
)
@sut
.
send
(
:write_pod_project
)
end
end
#-----------------------------------------------------------------------#
end
end
end
end
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