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
dd929589
Commit
dd929589
authored
Feb 03, 2016
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Analyzer] Reject abstract targets
parent
a6b73781
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
62 additions
and
69 deletions
+62
-69
installer.rb
lib/cocoapods/installer.rb
+0
-2
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+3
-2
user_project_integrator.rb
lib/cocoapods/installer/user_project_integrator.rb
+1
-1
aggregate_target.rb
lib/cocoapods/target/aggregate_target.rb
+1
-0
pod_target.rb
lib/cocoapods/target/pod_target.rb
+1
-0
analyzer_spec.rb
spec/unit/installer/analyzer_spec.rb
+1
-1
file_references_installer_spec.rb
spec/unit/installer/file_references_installer_spec.rb
+3
-3
aggregate_target_installer_spec.rb
...aller/target_installer/aggregate_target_installer_spec.rb
+28
-27
pod_target_installer_spec.rb
...t/installer/target_installer/pod_target_installer_spec.rb
+10
-9
target_installer_spec.rb
spec/unit/installer/target_installer_spec.rb
+3
-2
user_project_integrator_spec.rb
spec/unit/installer/user_project_integrator_spec.rb
+0
-6
installer_spec.rb
spec/unit/installer_spec.rb
+11
-16
No files found.
lib/cocoapods/installer.rb
View file @
dd929589
...
@@ -612,13 +612,11 @@ module Pod
...
@@ -612,13 +612,11 @@ module Pod
def
install_libraries
def
install_libraries
UI
.
message
'- Installing targets'
do
UI
.
message
'- Installing targets'
do
pod_targets
.
sort_by
(
&
:name
).
each
do
|
pod_target
|
pod_targets
.
sort_by
(
&
:name
).
each
do
|
pod_target
|
next
if
pod_target
.
target_definitions
.
all?
(
&
:abstract?
)
target_installer
=
PodTargetInstaller
.
new
(
sandbox
,
pod_target
)
target_installer
=
PodTargetInstaller
.
new
(
sandbox
,
pod_target
)
target_installer
.
install!
target_installer
.
install!
end
end
aggregate_targets
.
sort_by
(
&
:name
).
each
do
|
target
|
aggregate_targets
.
sort_by
(
&
:name
).
each
do
|
target
|
next
if
target
.
target_definition
.
abstract?
target_installer
=
AggregateTargetInstaller
.
new
(
sandbox
,
target
)
target_installer
=
AggregateTargetInstaller
.
new
(
sandbox
,
target
)
target_installer
.
install!
target_installer
.
install!
end
end
...
...
lib/cocoapods/installer/analyzer.rb
View file @
dd929589
...
@@ -230,8 +230,9 @@ module Pod
...
@@ -230,8 +230,9 @@ module Pod
# @return [Array<AggregateTarget>]
# @return [Array<AggregateTarget>]
#
#
def
generate_targets
def
generate_targets
pod_targets
=
generate_pod_targets
(
result
.
specs_by_target
)
specs_by_target
=
result
.
specs_by_target
.
reject
{
|
td
,
_
|
td
.
abstract?
}
aggregate_targets
=
result
.
specs_by_target
.
keys
.
reject
(
&
:abstract?
).
map
do
|
target_definition
|
pod_targets
=
generate_pod_targets
(
specs_by_target
)
aggregate_targets
=
specs_by_target
.
keys
.
map
do
|
target_definition
|
generate_target
(
target_definition
,
pod_targets
)
generate_target
(
target_definition
,
pod_targets
)
end
end
aggregate_targets
.
each
do
|
target
|
aggregate_targets
.
each
do
|
target
|
...
...
lib/cocoapods/installer/user_project_integrator.rb
View file @
dd929589
...
@@ -216,7 +216,7 @@ module Pod
...
@@ -216,7 +216,7 @@ module Pod
end
end
def
targets_to_integrate
def
targets_to_integrate
targets
.
reject
{
|
target
|
target
.
target_definition
.
abstract?
}
targets
end
end
# Prints a warning informing the user that a build configuration of
# Prints a warning informing the user that a build configuration of
...
...
lib/cocoapods/target/aggregate_target.rb
View file @
dd929589
...
@@ -13,6 +13,7 @@ module Pod
...
@@ -13,6 +13,7 @@ module Pod
# @param [Sandbox] sandbox @see sandbox
# @param [Sandbox] sandbox @see sandbox
#
#
def
initialize
(
target_definition
,
sandbox
)
def
initialize
(
target_definition
,
sandbox
)
raise
"Can't initialize an AggregateTarget with an abstract TargetDefinition"
if
target_definition
.
abstract?
super
()
super
()
@target_definition
=
target_definition
@target_definition
=
target_definition
@sandbox
=
sandbox
@sandbox
=
sandbox
...
...
lib/cocoapods/target/pod_target.rb
View file @
dd929589
...
@@ -52,6 +52,7 @@ module Pod
...
@@ -52,6 +52,7 @@ module Pod
def
initialize
(
specs
,
target_definitions
,
sandbox
,
scope_suffix
=
nil
)
def
initialize
(
specs
,
target_definitions
,
sandbox
,
scope_suffix
=
nil
)
raise
"Can't initialize a PodTarget without specs!"
if
specs
.
nil?
||
specs
.
empty?
raise
"Can't initialize a PodTarget without specs!"
if
specs
.
nil?
||
specs
.
empty?
raise
"Can't initialize a PodTarget without TargetDefinition!"
if
target_definitions
.
nil?
||
target_definitions
.
empty?
raise
"Can't initialize a PodTarget without TargetDefinition!"
if
target_definitions
.
nil?
||
target_definitions
.
empty?
raise
"Can't initialize a PodTarget with only abstract TargetDefinitions"
if
target_definitions
.
all?
(
&
:abstract?
)
raise
"Can't initialize a PodTarget with an empty string scope suffix!"
if
scope_suffix
==
''
raise
"Can't initialize a PodTarget with an empty string scope suffix!"
if
scope_suffix
==
''
super
()
super
()
@specs
=
specs
@specs
=
specs
...
...
spec/unit/installer/analyzer_spec.rb
View file @
dd929589
...
@@ -166,9 +166,9 @@ module Pod
...
@@ -166,9 +166,9 @@ module Pod
end
end
end
end
@analyzer
=
Pod
::
Installer
::
Analyzer
.
new
(
config
.
sandbox
,
@podfile
,
nil
)
@analyzer
=
Pod
::
Installer
::
Analyzer
.
new
(
config
.
sandbox
,
@podfile
,
nil
)
@analyzer
.
analyze
.
targets
.
count
.
should
==
1
target
=
@analyzer
.
analyze
.
targets
.
first
target
=
@analyzer
.
analyze
.
targets
.
first
restkit_target
=
target
.
pod_targets
.
find
{
|
pt
|
pt
.
pod_name
==
'RestKit'
}
restkit_target
=
target
.
pod_targets
.
find
{
|
pt
|
pt
.
pod_name
==
'RestKit'
}
restkit_target
.
should
.
be
.
scoped
restkit_target
.
dependent_targets
.
map
(
&
:pod_name
).
sort
.
should
==
%w(
restkit_target
.
dependent_targets
.
map
(
&
:pod_name
).
sort
.
should
==
%w(
AFNetworking
AFNetworking
ISO8601DateFormatterValueTransformer
ISO8601DateFormatterValueTransformer
...
...
spec/unit/installer/file_references_installer_spec.rb
View file @
dd929589
...
@@ -177,9 +177,9 @@ module Pod
...
@@ -177,9 +177,9 @@ module Pod
describe
'Private Helpers'
do
describe
'Private Helpers'
do
describe
'#file_accessors'
do
describe
'#file_accessors'
do
it
'returns the file accessors'
do
it
'returns the file accessors'
do
pod_target_1
=
PodTarget
.
new
([
stub
(
'Spec'
)],
[
stub
(
'TargetDefinition'
)
],
config
.
sandbox
)
pod_target_1
=
PodTarget
.
new
([
stub
(
'Spec'
)],
[
fixture_target_definition
],
config
.
sandbox
)
pod_target_1
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
pod_target_1
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
pod_target_2
=
PodTarget
.
new
([
stub
(
'Spec'
)],
[
stub
(
'TargetDefinition'
)
],
config
.
sandbox
)
pod_target_2
=
PodTarget
.
new
([
stub
(
'Spec'
)],
[
fixture_target_definition
],
config
.
sandbox
)
pod_target_2
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
pod_target_2
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
installer
=
Installer
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
pod_target_1
,
pod_target_2
],
@project
)
installer
=
Installer
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
pod_target_1
,
pod_target_2
],
@project
)
roots
=
installer
.
send
(
:file_accessors
).
map
{
|
fa
|
fa
.
path_list
.
root
}
roots
=
installer
.
send
(
:file_accessors
).
map
{
|
fa
|
fa
.
path_list
.
root
}
...
@@ -187,7 +187,7 @@ module Pod
...
@@ -187,7 +187,7 @@ module Pod
end
end
it
'handles pods without file accessors'
do
it
'handles pods without file accessors'
do
pod_target_1
=
PodTarget
.
new
([
stub
(
'Spec'
)],
[
stub
(
'TargetDefinition'
)
],
config
.
sandbox
)
pod_target_1
=
PodTarget
.
new
([
stub
(
'Spec'
)],
[
fixture_target_definition
],
config
.
sandbox
)
pod_target_1
.
file_accessors
=
[]
pod_target_1
.
file_accessors
=
[]
installer
=
Installer
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
pod_target_1
],
@project
)
installer
=
Installer
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
pod_target_1
],
@project
)
installer
.
send
(
:file_accessors
).
should
==
[]
installer
.
send
(
:file_accessors
).
should
==
[]
...
...
spec/unit/installer/target_installer/aggregate_target_installer_spec.rb
View file @
dd929589
...
@@ -7,9 +7,10 @@ module Pod
...
@@ -7,9 +7,10 @@ module Pod
config
.
sandbox
.
prepare
config
.
sandbox
.
prepare
@podfile
=
Podfile
.
new
do
@podfile
=
Podfile
.
new
do
platform
:ios
platform
:ios
project
'dummy'
project
'SampleProject/SampleProject'
target
'SampleProject'
end
end
@target_definition
=
@podfile
.
target_definitions
[
'
Pods
'
]
@target_definition
=
@podfile
.
target_definitions
[
'
SampleProject
'
]
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
config
.
sandbox
.
project
=
@project
config
.
sandbox
.
project
=
@project
...
@@ -41,17 +42,17 @@ module Pod
...
@@ -41,17 +42,17 @@ module Pod
it
'adds file references for the support files of the target'
do
it
'adds file references for the support files of the target'
do
@installer
.
install!
@installer
.
install!
group
=
@project
.
support_files_group
[
'Pods'
]
group
=
@project
.
support_files_group
[
'Pods
-SampleProject
'
]
group
.
children
.
map
(
&
:display_name
).
sort
.
should
==
[
group
.
children
.
map
(
&
:display_name
).
sort
.
should
==
[
'Pods-acknowledgements.markdown'
,
'Pods-
SampleProject-
acknowledgements.markdown'
,
'Pods-acknowledgements.plist'
,
'Pods-
SampleProject-
acknowledgements.plist'
,
'Pods-dummy.m'
,
'Pods-
SampleProject-
dummy.m'
,
'Pods-frameworks.sh'
,
'Pods-
SampleProject-
frameworks.sh'
,
'Pods-resources.sh'
,
'Pods-
SampleProject-
resources.sh'
,
'Pods.appstore.xcconfig'
,
'Pods
-SampleProject
.appstore.xcconfig'
,
'Pods.debug.xcconfig'
,
'Pods
-SampleProject
.debug.xcconfig'
,
'Pods.release.xcconfig'
,
'Pods
-SampleProject
.release.xcconfig'
,
'Pods.test.xcconfig'
,
'Pods
-SampleProject
.test.xcconfig'
,
]
]
end
end
...
@@ -138,16 +139,16 @@ module Pod
...
@@ -138,16 +139,16 @@ module Pod
it
'creates a create copy resources script'
do
it
'creates a create copy resources script'
do
@installer
.
install!
@installer
.
install!
support_files_dir
=
config
.
sandbox
.
target_support_files_dir
(
'Pods'
)
support_files_dir
=
config
.
sandbox
.
target_support_files_dir
(
'Pods
-SampleProject
'
)
script
=
support_files_dir
+
'Pods-resources.sh'
script
=
support_files_dir
+
'Pods-
SampleProject-
resources.sh'
script
.
read
.
should
.
include?
(
'logo-sidebar.png'
)
script
.
read
.
should
.
include?
(
'logo-sidebar.png'
)
end
end
it
'does not add framework resources to copy resources script'
do
it
'does not add framework resources to copy resources script'
do
@pod_target
.
stubs
(
:requires_frameworks?
=>
true
)
@pod_target
.
stubs
(
:requires_frameworks?
=>
true
)
@installer
.
install!
@installer
.
install!
support_files_dir
=
config
.
sandbox
.
target_support_files_dir
(
'Pods'
)
support_files_dir
=
config
.
sandbox
.
target_support_files_dir
(
'Pods
-SampleProject
'
)
script
=
support_files_dir
+
'Pods-resources.sh'
script
=
support_files_dir
+
'Pods-
SampleProject-
resources.sh'
script
.
read
.
should
.
not
.
include?
(
'logo-sidebar.png'
)
script
.
read
.
should
.
not
.
include?
(
'logo-sidebar.png'
)
end
end
...
@@ -161,8 +162,8 @@ module Pod
...
@@ -161,8 +162,8 @@ module Pod
@pod_target
.
stubs
(
:requires_frameworks?
=>
true
)
@pod_target
.
stubs
(
:requires_frameworks?
=>
true
)
@target
.
stubs
(
:requires_frameworks?
=>
true
)
@target
.
stubs
(
:requires_frameworks?
=>
true
)
@installer
.
install!
@installer
.
install!
support_files_dir
=
config
.
sandbox
.
target_support_files_dir
(
'Pods'
)
support_files_dir
=
config
.
sandbox
.
target_support_files_dir
(
'Pods
-SampleProject
'
)
script
=
support_files_dir
+
'Pods-frameworks.sh'
script
=
support_files_dir
+
'Pods-
SampleProject-
frameworks.sh'
script
.
read
.
should
.
include?
(
'BananaLib.framework'
)
script
.
read
.
should
.
include?
(
'BananaLib.framework'
)
end
end
...
@@ -186,28 +187,28 @@ module Pod
...
@@ -186,28 +187,28 @@ module Pod
@pod_target
.
stubs
(
:requires_frameworks?
=>
true
)
@pod_target
.
stubs
(
:requires_frameworks?
=>
true
)
@target
.
stubs
(
:requires_frameworks?
=>
true
)
@target
.
stubs
(
:requires_frameworks?
=>
true
)
@installer
.
install!
@installer
.
install!
support_files_dir
=
config
.
sandbox
.
target_support_files_dir
(
'Pods'
)
support_files_dir
=
config
.
sandbox
.
target_support_files_dir
(
'Pods
-SampleProject
'
)
script
=
support_files_dir
+
'Pods-frameworks.sh'
script
=
support_files_dir
+
'Pods-
SampleProject-
frameworks.sh'
script
.
read
.
should
.
not
.
include?
(
'BananaLib.framework'
)
script
.
read
.
should
.
not
.
include?
(
'BananaLib.framework'
)
end
end
it
'creates the acknowledgements files '
do
it
'creates the acknowledgements files '
do
@installer
.
install!
@installer
.
install!
support_files_dir
=
config
.
sandbox
.
target_support_files_dir
(
'Pods'
)
support_files_dir
=
config
.
sandbox
.
target_support_files_dir
(
'Pods
-SampleProject
'
)
markdown
=
support_files_dir
+
'Pods-acknowledgements.markdown'
markdown
=
support_files_dir
+
'Pods-
SampleProject-
acknowledgements.markdown'
markdown
.
read
.
should
.
include?
(
'Permission is hereby granted'
)
markdown
.
read
.
should
.
include?
(
'Permission is hereby granted'
)
plist
=
support_files_dir
+
'Pods-acknowledgements.plist'
plist
=
support_files_dir
+
'Pods-
SampleProject-
acknowledgements.plist'
plist
.
read
.
should
.
include?
(
'Permission is hereby granted'
)
plist
.
read
.
should
.
include?
(
'Permission is hereby granted'
)
end
end
it
'creates a dummy source to ensure the creation of a single base library'
do
it
'creates a dummy source to ensure the creation of a single base library'
do
@installer
.
install!
@installer
.
install!
build_files
=
@installer
.
target
.
native_target
.
source_build_phase
.
files
build_files
=
@installer
.
target
.
native_target
.
source_build_phase
.
files
build_file
=
build_files
.
find
{
|
bf
|
bf
.
file_ref
.
path
.
include?
(
'Pods-dummy.m'
)
}
build_file
=
build_files
.
find
{
|
bf
|
bf
.
file_ref
.
path
.
include?
(
'Pods-
SampleProject-
dummy.m'
)
}
build_file
.
should
.
be
.
not
.
nil
build_file
.
should
.
be
.
not
.
nil
build_file
.
file_ref
.
path
.
should
==
'Pods-dummy.m'
build_file
.
file_ref
.
path
.
should
==
'Pods-
SampleProject-
dummy.m'
support_files_dir
=
config
.
sandbox
.
target_support_files_dir
(
'Pods'
)
support_files_dir
=
config
.
sandbox
.
target_support_files_dir
(
'Pods
-SampleProject
'
)
dummy
=
support_files_dir
+
'Pods-dummy.m'
dummy
=
support_files_dir
+
'Pods-
SampleProject-
dummy.m'
dummy
.
read
.
should
.
include?
(
'@interface PodsDummy_Pods'
)
dummy
.
read
.
should
.
include?
(
'@interface PodsDummy_Pods'
)
end
end
end
end
...
...
spec/unit/installer/target_installer/pod_target_installer_spec.rb
View file @
dd929589
...
@@ -7,9 +7,10 @@ module Pod
...
@@ -7,9 +7,10 @@ module Pod
config
.
sandbox
.
prepare
config
.
sandbox
.
prepare
@podfile
=
Podfile
.
new
do
@podfile
=
Podfile
.
new
do
platform
:ios
,
'6.0'
platform
:ios
,
'6.0'
project
'dummy'
project
'SampleProject/SampleProject'
target
'SampleProject'
end
end
@target_definition
=
@podfile
.
target_definitions
[
'
Pods
'
]
@target_definition
=
@podfile
.
target_definitions
[
'
SampleProject
'
]
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
config
.
sandbox
.
project
=
@project
config
.
sandbox
.
project
=
@project
...
@@ -141,22 +142,22 @@ module Pod
...
@@ -141,22 +142,22 @@ module Pod
@installer
.
install!
@installer
.
install!
group
=
@project
[
'Pods/BananaLib/Support Files'
]
group
=
@project
[
'Pods/BananaLib/Support Files'
]
group
.
children
.
map
(
&
:display_name
).
sort
.
should
==
[
group
.
children
.
map
(
&
:display_name
).
sort
.
should
==
[
'BananaLib-Pods-dummy.m'
,
'BananaLib-Pods-
SampleProject-
dummy.m'
,
'BananaLib-Pods-prefix.pch'
,
'BananaLib-Pods-
SampleProject-
prefix.pch'
,
'BananaLib-Pods.xcconfig'
,
'BananaLib-Pods
-SampleProject
.xcconfig'
,
]
]
end
end
it
'adds the target for the static library to the project'
do
it
'adds the target for the static library to the project'
do
@installer
.
install!
@installer
.
install!
@project
.
targets
.
count
.
should
==
1
@project
.
targets
.
count
.
should
==
1
@project
.
targets
.
first
.
name
.
should
==
'BananaLib-Pods'
@project
.
targets
.
first
.
name
.
should
==
'BananaLib-Pods
-SampleProject
'
end
end
it
'adds the resource bundle targets'
do
it
'adds the resource bundle targets'
do
@pod_target
.
file_accessors
.
first
.
stubs
(
:resource_bundles
).
returns
(
'banana_bundle'
=>
[])
@pod_target
.
file_accessors
.
first
.
stubs
(
:resource_bundles
).
returns
(
'banana_bundle'
=>
[])
@installer
.
install!
@installer
.
install!
bundle_target
=
@project
.
targets
.
find
{
|
t
|
t
.
name
==
'BananaLib-Pods-banana_bundle'
}
bundle_target
=
@project
.
targets
.
find
{
|
t
|
t
.
name
==
'BananaLib-Pods-
SampleProject-
banana_bundle'
}
bundle_target
.
should
.
be
.
an
.
instance_of
Xcodeproj
::
Project
::
Object
::
PBXNativeTarget
bundle_target
.
should
.
be
.
an
.
instance_of
Xcodeproj
::
Project
::
Object
::
PBXNativeTarget
bundle_target
.
product_reference
.
name
.
should
==
'banana_bundle.bundle'
bundle_target
.
product_reference
.
name
.
should
==
'banana_bundle.bundle'
bundle_target
.
product_reference
.
path
.
should
==
'banana_bundle.bundle'
bundle_target
.
product_reference
.
path
.
should
==
'banana_bundle.bundle'
...
@@ -167,7 +168,7 @@ module Pod
...
@@ -167,7 +168,7 @@ module Pod
it
'adds the build configurations to the resources bundle targets'
do
it
'adds the build configurations to the resources bundle targets'
do
@pod_target
.
file_accessors
.
first
.
stubs
(
:resource_bundles
).
returns
(
'banana_bundle'
=>
[])
@pod_target
.
file_accessors
.
first
.
stubs
(
:resource_bundles
).
returns
(
'banana_bundle'
=>
[])
@installer
.
install!
@installer
.
install!
bundle_target
=
@project
.
targets
.
find
{
|
t
|
t
.
name
==
'BananaLib-Pods-banana_bundle'
}
bundle_target
=
@project
.
targets
.
find
{
|
t
|
t
.
name
==
'BananaLib-Pods-
SampleProject-
banana_bundle'
}
file
=
config
.
sandbox
.
root
+
@pod_target
.
xcconfig_path
file
=
config
.
sandbox
.
root
+
@pod_target
.
xcconfig_path
bundle_target
.
build_configurations
.
each
do
|
bc
|
bundle_target
.
build_configurations
.
each
do
|
bc
|
...
@@ -178,7 +179,7 @@ module Pod
...
@@ -178,7 +179,7 @@ module Pod
it
'sets the correct targeted device family for the resource bundle targets'
do
it
'sets the correct targeted device family for the resource bundle targets'
do
@pod_target
.
file_accessors
.
first
.
stubs
(
:resource_bundles
).
returns
(
'banana_bundle'
=>
[])
@pod_target
.
file_accessors
.
first
.
stubs
(
:resource_bundles
).
returns
(
'banana_bundle'
=>
[])
@installer
.
install!
@installer
.
install!
bundle_target
=
@project
.
targets
.
find
{
|
t
|
t
.
name
==
'BananaLib-Pods-banana_bundle'
}
bundle_target
=
@project
.
targets
.
find
{
|
t
|
t
.
name
==
'BananaLib-Pods-
SampleProject-
banana_bundle'
}
bundle_target
.
build_configurations
.
each
do
|
bc
|
bundle_target
.
build_configurations
.
each
do
|
bc
|
bc
.
build_settings
[
'TARGETED_DEVICE_FAMILY'
].
should
==
'1,2'
bc
.
build_settings
[
'TARGETED_DEVICE_FAMILY'
].
should
==
'1,2'
...
...
spec/unit/installer/target_installer_spec.rb
View file @
dd929589
...
@@ -5,9 +5,10 @@ module Pod
...
@@ -5,9 +5,10 @@ module Pod
before
do
before
do
@podfile
=
Podfile
.
new
do
@podfile
=
Podfile
.
new
do
platform
:ios
platform
:ios
project
'dummy'
project
'SampleProject/SampleProject'
target
'SampleProject'
end
end
@target_definition
=
@podfile
.
target_definitions
[
'
Pods
'
]
@target_definition
=
@podfile
.
target_definitions
[
'
SampleProject
'
]
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
config
.
sandbox
.
project
=
@project
config
.
sandbox
.
project
=
@project
...
...
spec/unit/installer/user_project_integrator_spec.rb
View file @
dd929589
...
@@ -205,12 +205,6 @@ module Pod
...
@@ -205,12 +205,6 @@ module Pod
@integrator
.
send
(
:targets_to_integrate
).
map
(
&
:name
).
should
==
[
'Pods-SampleProject'
,
'Pods-SampleProject-empty'
]
@integrator
.
send
(
:targets_to_integrate
).
map
(
&
:name
).
should
==
[
'Pods-SampleProject'
,
'Pods-SampleProject-empty'
]
end
end
it
'does skip libraries with only abstract target definitions'
do
@integrator
.
targets
.
map
(
&
:name
).
should
==
[
'Pods-SampleProject'
,
'Pods-SampleProject-empty'
]
@podfile
.
target_definition_list
.
each
{
|
td
|
td
.
abstract
=
true
}
@integrator
.
send
(
:targets_to_integrate
).
map
(
&
:name
).
should
==
[]
end
it
'skips saving projects that are not dirtied (but touches them instead)'
do
it
'skips saving projects that are not dirtied (but touches them instead)'
do
project
=
mock
(
'Project'
)
project
=
mock
(
'Project'
)
project
.
stubs
(
:path
).
returns
(
Pathname
(
'project.xcodeproj'
))
project
.
stubs
(
:path
).
returns
(
Pathname
(
'project.xcodeproj'
))
...
...
spec/unit/installer_spec.rb
View file @
dd929589
...
@@ -442,7 +442,7 @@ module Pod
...
@@ -442,7 +442,7 @@ module Pod
@analysis_result
=
Installer
::
Analyzer
::
AnalysisResult
.
new
@analysis_result
=
Installer
::
Analyzer
::
AnalysisResult
.
new
@analysis_result
.
specifications
=
[]
@analysis_result
.
specifications
=
[]
@analysis_result
.
sandbox_state
=
Installer
::
Analyzer
::
SpecsState
.
new
@analysis_result
.
sandbox_state
=
Installer
::
Analyzer
::
SpecsState
.
new
@pod_targets
=
[
PodTarget
.
new
([
stub
(
'Spec'
)],
[
stub
(
'TargetDefinition'
)
],
config
.
sandbox
)]
@pod_targets
=
[
PodTarget
.
new
([
stub
(
'Spec'
)],
[
fixture_target_definition
],
config
.
sandbox
)]
@installer
.
stubs
(
:analysis_result
).
returns
(
@analysis_result
)
@installer
.
stubs
(
:analysis_result
).
returns
(
@analysis_result
)
@installer
.
stubs
(
:pod_targets
).
returns
(
@pod_targets
)
@installer
.
stubs
(
:pod_targets
).
returns
(
@pod_targets
)
end
end
...
@@ -483,7 +483,7 @@ module Pod
...
@@ -483,7 +483,7 @@ module Pod
it
'correctly configures the Pod source installer'
do
it
'correctly configures the Pod source installer'
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
pod_target
=
PodTarget
.
new
([
spec
],
[
stub
(
'TargetDefinition'
)
],
config
.
sandbox
)
pod_target
=
PodTarget
.
new
([
spec
],
[
fixture_target_definition
],
config
.
sandbox
)
pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
@installer
.
instance_variable_set
(
:@installed_specs
,
[])
@installer
.
instance_variable_set
(
:@installed_specs
,
[])
...
@@ -493,7 +493,7 @@ module Pod
...
@@ -493,7 +493,7 @@ module Pod
it
'maintains the list of the installed specs'
do
it
'maintains the list of the installed specs'
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
pod_target
=
PodTarget
.
new
([
spec
],
[
stub
(
'TargetDefinition'
)
],
config
.
sandbox
)
pod_target
=
PodTarget
.
new
([
spec
],
[
fixture_target_definition
],
config
.
sandbox
)
pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
,
pod_target
])
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
,
pod_target
])
@installer
.
instance_variable_set
(
:@installed_specs
,
[])
@installer
.
instance_variable_set
(
:@installed_specs
,
[])
...
@@ -582,15 +582,11 @@ module Pod
...
@@ -582,15 +582,11 @@ module Pod
end
end
it
'sets the deployment target for the whole project'
do
it
'sets the deployment target for the whole project'
do
pod_target_ios
=
PodTarget
.
new
([
stub
(
'Spec'
)],
[
stub
(
'TargetDefinition'
)],
config
.
sandbox
)
target_definition_osx
=
fixture_target_definition
(
'OSX Target'
,
Platform
.
new
(
:osx
,
'10.8'
))
pod_target_osx
=
PodTarget
.
new
([
stub
(
'Spec'
)],
[
stub
(
'TargetDefinition'
)],
config
.
sandbox
)
target_definition_ios
=
fixture_target_definition
(
'iOS Target'
,
Platform
.
new
(
:ios
,
'6.0'
))
pod_target_ios
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
))
aggregate_target_osx
=
AggregateTarget
.
new
(
target_definition_osx
,
config
.
sandbox
)
pod_target_osx
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:osx
,
'10.8'
))
aggregate_target_ios
=
AggregateTarget
.
new
(
target_definition_ios
,
config
.
sandbox
)
aggregate_target_ios
=
AggregateTarget
.
new
(
nil
,
config
.
sandbox
)
@installer
.
stubs
(
:aggregate_targets
).
returns
([
aggregate_target_osx
,
aggregate_target_ios
])
aggregate_target_osx
=
AggregateTarget
.
new
(
nil
,
config
.
sandbox
)
aggregate_target_ios
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
))
aggregate_target_osx
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:osx
,
'10.8'
))
@installer
.
stubs
(
:aggregate_targets
).
returns
([
aggregate_target_ios
,
aggregate_target_osx
])
@installer
.
stubs
(
:pod_targets
).
returns
([])
@installer
.
stubs
(
:pod_targets
).
returns
([])
@installer
.
send
(
:prepare_pods_project
)
@installer
.
send
(
:prepare_pods_project
)
build_settings
=
@installer
.
pods_project
.
build_configurations
.
map
(
&
:build_settings
)
build_settings
=
@installer
.
pods_project
.
build_configurations
.
map
(
&
:build_settings
)
...
@@ -778,9 +774,8 @@ module Pod
...
@@ -778,9 +774,8 @@ module Pod
proj
=
Xcodeproj
::
Project
.
new
(
tmp_directory
+
'Yolo.xcodeproj'
,
false
,
1
)
proj
=
Xcodeproj
::
Project
.
new
(
tmp_directory
+
'Yolo.xcodeproj'
,
false
,
1
)
proj
.
save
proj
.
save
aggregate_target
=
AggregateTarget
.
new
(
nil
,
config
.
sandbox
)
aggregate_target
=
AggregateTarget
.
new
(
fixture_target_definition
,
config
.
sandbox
)
aggregate_target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
))
aggregate_target
.
user_project
=
proj
aggregate_target
.
stubs
(
:user_project
).
returns
(
proj
)
@installer
.
stubs
(
:aggregate_targets
).
returns
([
aggregate_target
])
@installer
.
stubs
(
:aggregate_targets
).
returns
([
aggregate_target
])
@installer
.
send
(
:prepare_pods_project
)
@installer
.
send
(
:prepare_pods_project
)
...
@@ -822,7 +817,7 @@ module Pod
...
@@ -822,7 +817,7 @@ module Pod
describe
'Integrating client projects'
do
describe
'Integrating client projects'
do
it
'integrates the client projects'
do
it
'integrates the client projects'
do
@installer
.
stubs
(
:aggregate_targets
).
returns
([
AggregateTarget
.
new
(
nil
,
config
.
sandbox
)])
@installer
.
stubs
(
:aggregate_targets
).
returns
([
AggregateTarget
.
new
(
fixture_target_definition
,
config
.
sandbox
)])
Installer
::
UserProjectIntegrator
.
any_instance
.
expects
(
:integrate!
)
Installer
::
UserProjectIntegrator
.
any_instance
.
expects
(
:integrate!
)
@installer
.
send
(
:integrate_user_project
)
@installer
.
send
(
:integrate_user_project
)
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