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
23b8cd37
Commit
23b8cd37
authored
Sep 11, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Target] Refactor
parent
402d214a
Show whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
585 additions
and
599 deletions
+585
-599
cocoapods.rb
lib/cocoapods.rb
+2
-2
aggregate_xcconfig.rb
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
+12
-9
private_pod_xcconfig.rb
lib/cocoapods/generator/xcconfig/private_pod_xcconfig.rb
+3
-3
public_pod_xcconfig.rb
lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb
+6
-4
xcconfig_helper.rb
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
+16
-1
installer_representation.rb
lib/cocoapods/hooks/installer_representation.rb
+1
-1
library_representation.rb
lib/cocoapods/hooks/library_representation.rb
+0
-1
installer.rb
lib/cocoapods/installer.rb
+6
-6
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+20
-3
pods_project_generator.rb
lib/cocoapods/installer/pods_project_generator.rb
+10
-11
file_references_installer.rb
...aller/pods_project_generator/file_references_installer.rb
+0
-1
support_files_generator.rb
...staller/pods_project_generator/support_files_generator.rb
+29
-25
target_installer.rb
...pods/installer/pods_project_generator/target_installer.rb
+2
-2
user_project_integrator.rb
lib/cocoapods/installer/user_project_integrator.rb
+3
-6
target_integrator.rb
...ds/installer/user_project_integrator/target_integrator.rb
+4
-4
target.rb
lib/cocoapods/target.rb
+183
-46
aggregate_target.rb
lib/cocoapods/target/aggregate_target.rb
+0
-74
pod_target.rb
lib/cocoapods/target/pod_target.rb
+0
-83
validator.rb
lib/cocoapods/validator.rb
+1
-1
cocoapods-integration-specs
spec/cocoapods-integration-specs
+1
-1
aggregate_xcconfig_spec.rb
spec/unit/generator/xcconfig/aggregate_xcconfig_spec.rb
+45
-40
private_pod_xcconfig_spec.rb
spec/unit/generator/xcconfig/private_pod_xcconfig_spec.rb
+10
-23
public_pod_xcconfig_spec.rb
spec/unit/generator/xcconfig/public_pod_xcconfig_spec.rb
+28
-30
xcconfig_helper_spec.rb
spec/unit/generator/xcconfig/xcconfig_helper_spec.rb
+25
-14
installer_representation_spec.rb
spec/unit/hooks/installer_representation_spec.rb
+2
-2
library_representation_spec.rb
spec/unit/hooks/library_representation_spec.rb
+2
-1
analyzer_spec.rb
spec/unit/installer/analyzer_spec.rb
+2
-2
file_references_installer_spec.rb
.../pods_project_generator/file_references_installer_spec.rb
+6
-6
support_files_generator_spec.rb
...er/pods_project_generator/support_files_generator_spec.rb
+30
-26
target_installer_spec.rb
...installer/pods_project_generator/target_installer_spec.rb
+8
-10
pods_project_generator_spec.rb
spec/unit/installer/pods_project_generator_spec.rb
+19
-18
target_integrator_spec.rb
...staller/user_project_integrator/target_integrator_spec.rb
+1
-4
user_project_integrator_spec.rb
spec/unit/installer/user_project_integrator_spec.rb
+2
-7
installer_spec.rb
spec/unit/installer_spec.rb
+23
-18
aggregate_target_spec.rb
spec/unit/target/aggregate_target_spec.rb
+0
-50
pod_target_spec.rb
spec/unit/target/pod_target_spec.rb
+0
-55
target_spec.rb
spec/unit/target_spec.rb
+83
-9
No files found.
lib/cocoapods.rb
View file @
23b8cd37
...
...
@@ -23,8 +23,8 @@ module Pod
autoload
:Installer
,
'cocoapods/installer'
autoload
:SourcesManager
,
'cocoapods/sources_manager'
autoload
:Target
,
'cocoapods/target'
autoload
:AggregateTarget
,
'cocoapods/target
/aggregate_target
'
autoload
:PodTarget
,
'cocoapods/target
/pod_target
'
autoload
:AggregateTarget
,
'cocoapods/target'
autoload
:PodTarget
,
'cocoapods/target'
autoload
:Project
,
'cocoapods/project'
autoload
:Resolver
,
'cocoapods/resolver'
autoload
:Sandbox
,
'cocoapods/sandbox'
...
...
lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
View file @
23b8cd37
...
...
@@ -9,11 +9,13 @@ module Pod
# @return [Target] the target represented by this xcconfig.
#
attr_reader
:target
attr_reader
:sandbox_root
# @param [Target] target @see target
#
def
initialize
(
targe
t
)
def
initialize
(
target
,
sandbox_roo
t
)
@target
=
target
@sandbox_root
=
sandbox_root
end
# @return [Xcodeproj::Config] The generated xcconfig.
...
...
@@ -46,19 +48,19 @@ module Pod
def
generate
@xcconfig
=
Xcodeproj
::
Config
.
new
({
'OTHER_LDFLAGS'
=>
XCConfigHelper
.
default_ld_flags
(
target
),
'HEADER_SEARCH_PATHS'
=>
XCConfigHelper
.
quote
(
target
.
sandbox
.
public_headers
.
search_paths
),
'HEADER_SEARCH_PATHS'
=>
XCConfigHelper
.
quote
(
target
.
public_headers_store
.
search_paths
),
'PODS_ROOT'
=>
relative_pods_root
,
'GCC_PREPROCESSOR_DEFINITIONS'
=>
'$(inherited) COCOAPODS=1'
,
})
target
.
pod_targets
.
each
do
|
pod_target
|
target
.
children
.
each
do
|
pod_target
|
pod_target
.
file_accessors
.
each
do
|
file_accessor
|
XCConfigHelper
.
add_spec_build_settings_to_xcconfig
(
file_accessor
.
spec_consumer
,
@xcconfig
)
file_accessor
.
vendored_frameworks
.
each
do
|
vendored_framework
|
XCConfigHelper
.
add_framework_build_settings
(
vendored_framework
,
@xcconfig
,
target
.
sandbox
.
root
)
XCConfigHelper
.
add_framework_build_settings
(
vendored_framework
,
@xcconfig
,
sandbox_
root
)
end
file_accessor
.
vendored_libraries
.
each
do
|
vendored_library
|
XCConfigHelper
.
add_library_build_settings
(
vendored_library
,
@xcconfig
,
target
.
sandbox
.
root
)
XCConfigHelper
.
add_library_build_settings
(
vendored_library
,
@xcconfig
,
sandbox_
root
)
end
end
end
...
...
@@ -68,10 +70,11 @@ module Pod
#
# See https://github.com/CocoaPods/CocoaPods/issues/1216
@xcconfig
.
attributes
.
delete
(
'USE_HEADERMAP'
)
@xcconfig
end
#-----------------------------------------------------------------------#
# @return [String] The xcconfig path of the root from the `$(SRCROOT)`
# variable of the user's project.
#
...
...
@@ -80,9 +83,9 @@ module Pod
#
def
relative_pods_root
if
target
.
user_project_path
"${SRCROOT}/
#{
target
.
support_files
_root
.
relative_path_from
(
target
.
user_project_path
.
dirname
)
}
"
"${SRCROOT}/
#{
sandbox
_root
.
relative_path_from
(
target
.
user_project_path
.
dirname
)
}
"
else
target
.
support_files_root
.
to_s
sandbox_root
end
end
...
...
@@ -90,5 +93,5 @@ module Pod
end
end
end
end
end
lib/cocoapods/generator/xcconfig/private_pod_xcconfig.rb
View file @
23b8cd37
...
...
@@ -47,7 +47,7 @@ module Pod
# @return [Xcodeproj::Config]
#
def
generate
search_pahts
=
target
.
build_headers
.
search_paths
.
concat
(
target
.
sandbox
.
public_headers
.
search_paths
)
search_pahts
=
target
.
build_headers_store
.
search_paths
.
concat
(
target
.
public_headers_store
.
search_paths
)
config
=
{
'OTHER_LDFLAGS'
=>
XCConfigHelper
.
default_ld_flags
(
target
),
'PODS_ROOT'
=>
'${SRCROOT}'
,
...
...
@@ -56,7 +56,7 @@ module Pod
# 'USE_HEADERMAP' => 'NO'
}
xcconfig_hash
=
add_xcconfig_namespaced_keys
(
public_xcconfig
.
to_hash
,
config
,
target
.
xcconfig_prefix
)
xcconfig_hash
=
add_xcconfig_namespaced_keys
(
public_xcconfig
.
to_hash
,
config
,
XCConfigHelper
.
prefix
(
target
.
name
)
)
@xcconfig
=
Xcodeproj
::
Config
.
new
(
xcconfig_hash
)
@xcconfig
.
includes
=
[
target
.
name
]
@xcconfig
...
...
@@ -113,5 +113,5 @@ module Pod
end
end
end
end
end
lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb
View file @
23b8cd37
...
...
@@ -14,11 +14,13 @@ module Pod
# @return [Target] the target represented by this xcconfig.
#
attr_reader
:target
attr_reader
:sandbox_root
# @param [Target] target @see target
#
def
initialize
(
target
)
def
initialize
(
target
,
sanbox_root
)
@target
=
target
@sandbox_root
=
sanbox_root
end
# @return [Xcodeproj::Config] The generated xcconfig.
...
...
@@ -33,7 +35,7 @@ module Pod
# @return [void]
#
def
save_as
(
path
)
generate
.
save_as
(
path
,
target
.
xcconfig_prefix
)
generate
.
save_as
(
path
,
XCConfigHelper
.
prefix
(
target
.
name
)
)
end
# Generates the xcconfig for the target.
...
...
@@ -45,10 +47,10 @@ module Pod
target
.
file_accessors
.
each
do
|
file_accessor
|
XCConfigHelper
.
add_spec_build_settings_to_xcconfig
(
file_accessor
.
spec_consumer
,
@xcconfig
)
file_accessor
.
vendored_frameworks
.
each
do
|
vendored_framework
|
XCConfigHelper
.
add_framework_build_settings
(
vendored_framework
,
@xcconfig
,
target
.
sandbox
.
root
)
XCConfigHelper
.
add_framework_build_settings
(
vendored_framework
,
@xcconfig
,
sandbox_
root
)
end
file_accessor
.
vendored_libraries
.
each
do
|
vendored_library
|
XCConfigHelper
.
add_library_build_settings
(
vendored_library
,
@xcconfig
,
target
.
sandbox
.
root
)
XCConfigHelper
.
add_library_build_settings
(
vendored_library
,
@xcconfig
,
sandbox_
root
)
end
end
@xcconfig
...
...
lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
View file @
23b8cd37
...
...
@@ -6,6 +6,18 @@ module Pod
#
module
XCConfigHelper
# Returns the XCConfig namespaced prefix to use for the target with the
# given name.
#
# @param [Array<String>] target_name
# the name of the target.
#
# @return [String] the prefix for the target.
#
def
self
.
prefix
(
target_name
)
target_name
.
upcase
.
gsub
(
/[^A-Z]/
,
'_'
)
+
'_'
end
# Converts an array of strings to a single string where the each string
# is surrounded by double quotes and separated by a space. Used to
# represent strings in a xcconfig file.
...
...
@@ -19,13 +31,16 @@ module Pod
strings
.
sort
.
map
{
|
s
|
%W|"
#{
s
}
"|
}.
join
(
" "
)
end
# Configures the project to load all members that implement Objective-c
# classes or categories from the static library#
#
# @return [String] the default linker flags. `-ObjC` is always included
# while `-fobjc-arc` is included only if requested in the
# Podfile.
#
def
self
.
default_ld_flags
(
target
)
ld_flags
=
'-ObjC'
if
target
.
target_definition
.
podfile
.
set_arc_compatibility_flag?
and
if
target
.
set_arc_compatibility_flag?
and
target
.
spec_consumers
.
any?
{
|
consumer
|
consumer
.
requires_arc?
}
ld_flags
<<
' -fobjc-arc'
end
...
...
lib/cocoapods/hooks/installer_representation.rb
View file @
23b8cd37
...
...
@@ -70,7 +70,7 @@ module Pod
#
def
pods_by_lib
result
=
{}
installer
.
aggregate_targets
.
map
(
&
:
pod_targets
).
flatten
.
each
do
|
lib
|
installer
.
aggregate_targets
.
map
(
&
:
children
).
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/hooks/library_representation.rb
View file @
23b8cd37
...
...
@@ -83,7 +83,6 @@ module Pod
def
initialize
(
sandbox
,
library
)
@sandbox
=
sandbox
@library
=
library
raise
"[BUG]"
unless
library
.
is_a?
(
AggregateTarget
)
end
#-----------------------------------------------------------------------#
...
...
lib/cocoapods/installer.rb
View file @
23b8cd37
...
...
@@ -191,7 +191,7 @@ module Pod
def
clean_sandbox
sandbox
.
public_headers
.
implode!
pod_targets
.
each
do
|
pod_target
|
pod_target
.
build_headers
.
implode!
pod_target
.
build_headers
_store
.
implode!
end
unless
sandbox
.
state
.
deleted
.
empty?
...
...
@@ -209,7 +209,7 @@ module Pod
#
def
create_file_accessors
aggregate_targets
.
each
do
|
target
|
target
.
pod_targets
.
each
do
|
pod_target
|
target
.
children
.
each
do
|
pod_target
|
pod_root
=
sandbox
.
pod_dir
(
pod_target
.
root_spec
.
name
)
path_list
=
Sandbox
::
PathList
.
new
(
pod_root
)
file_accessors
=
pod_target
.
specs
.
map
do
|
spec
|
...
...
@@ -299,11 +299,11 @@ module Pod
pod_targets
.
each
do
|
pod_target
|
pod_target
.
file_accessors
.
each
do
|
file_accessor
|
headers_sandbox
=
Pathname
.
new
(
file_accessor
.
spec
.
root
.
name
)
pod_target
.
build_headers
.
add_search_path
(
headers_sandbox
)
pod_target
.
build_headers
_store
.
add_search_path
(
headers_sandbox
)
sandbox
.
public_headers
.
add_search_path
(
headers_sandbox
)
header_mappings
(
headers_sandbox
,
file_accessor
,
file_accessor
.
headers
).
each
do
|
namespaced_path
,
files
|
pod_target
.
build_headers
.
add_files
(
namespaced_path
,
files
)
pod_target
.
build_headers
_store
.
add_files
(
namespaced_path
,
files
)
end
header_mappings
(
headers_sandbox
,
file_accessor
,
file_accessor
.
public_headers
).
each
do
|
namespaced_path
,
files
|
...
...
@@ -563,7 +563,7 @@ module Pod
#
def
libraries_using_spec
(
spec
)
aggregate_targets
.
select
do
|
aggregate_target
|
aggregate_target
.
pod_targets
.
any?
{
|
pod_target
|
pod_target
.
specs
.
include?
(
spec
)
}
aggregate_target
.
children
.
any?
{
|
pod_target
|
pod_target
.
specs
.
include?
(
spec
)
}
end
end
...
...
@@ -571,7 +571,7 @@ module Pod
# process.
#
def
pod_targets
aggregate_targets
.
map
(
&
:
pod_targets
).
flatten
aggregate_targets
.
map
(
&
:
children
).
flatten
end
#-------------------------------------------------------------------------#
...
...
lib/cocoapods/installer/analyzer.rb
View file @
23b8cd37
...
...
@@ -164,9 +164,20 @@ module Pod
def
generate_targets
targets
=
[]
result
.
specs_by_target
.
each
do
|
target_definition
,
specs
|
target
=
AggregateTarget
.
new
(
target_definition
,
sandbox
)
# TODO: install named targets even if empty
# TODO: add spec for aggregate targets to install
unless
target_definition
.
empty?
target
=
Target
.
new
(
target_definition
.
label
)
targets
<<
target
target
.
target_definition
=
target_definition
target
.
platform
=
target_definition
.
platform
target
.
support_files_root
=
sandbox
.
library_support_files_dir
(
target
.
name
)
target
.
set_arc_compatibility_flag
=
podfile
.
set_arc_compatibility_flag?
target
.
generate_bridge_support
=
podfile
.
generate_bridge_support?
target
.
public_headers_store
=
sandbox
.
public_headers
target
.
build_headers_store
=
Sandbox
::
HeadersStore
.
new
(
sandbox
,
"BuildHeaders"
)
if
config
.
integrate_targets?
project_path
=
compute_user_project_path
(
target_definition
)
user_project
=
Xcodeproj
::
Project
.
open
(
project_path
)
...
...
@@ -185,9 +196,15 @@ module Pod
end
.
uniq
grouped_specs
.
each
do
|
pod_specs
|
pod_target
=
PodTarget
.
new
(
pod_specs
,
target_definition
,
sandbox
)
pod_target
=
Target
.
new
(
pod_specs
.
first
.
root
.
name
,
target
)
pod_target
.
specs
=
[
pod_specs
]
pod_target
.
support_files_root
=
sandbox
.
library_support_files_dir
(
target
.
name
)
pod_target
.
user_build_configurations
=
target
.
user_build_configurations
target
.
pod_targets
<<
pod_target
pod_target
.
set_arc_compatibility_flag
=
podfile
.
set_arc_compatibility_flag?
pod_target
.
generate_bridge_support
=
podfile
.
generate_bridge_support?
pod_target
.
build_headers_store
=
Sandbox
::
HeadersStore
.
new
(
sandbox
,
"BuildHeaders"
)
pod_target
.
public_headers_store
=
sandbox
.
public_headers
end
end
end
targets
...
...
lib/cocoapods/installer/pods_project_generator.rb
View file @
23b8cd37
...
...
@@ -199,10 +199,9 @@ module Pod
#
def
sync_support_files
targets
=
all_pod_targets
+
aggregate_targets
targets
.
reject!
(
&
:skip_installation?
)
targets
.
each
do
|
target
|
UI
.
message
"- Generating support files for target `
#{
target
}
`"
do
gen
=
SupportFilesGenerator
.
new
(
target
,
sandbox
.
project
)
gen
=
SupportFilesGenerator
.
new
(
target
,
sandbox
)
gen
.
generate!
end
end
...
...
@@ -217,7 +216,7 @@ module Pod
UI
.
message
"- Populating aggregate targets"
do
aggregate_targets
.
each
do
|
aggregate_target
|
native_target
=
aggregate_target
.
native_target
aggregate_target
.
pod_targets
.
each
do
|
pod_target
|
aggregate_target
.
children
.
each
do
|
pod_target
|
product
=
pod_target
.
native_target
.
product_reference
unless
native_target
.
frameworks_build_phase
.
files_references
.
include?
(
product
)
native_target
.
frameworks_build_phase
.
add_file_reference
(
product
)
...
...
@@ -234,13 +233,13 @@ module Pod
def
add_missing_target_dependencies
UI
.
message
"- Setting-up target dependencies"
do
aggregate_targets
.
each
do
|
aggregate_target
|
aggregate_target
.
pod_targets
.
each
do
|
dep
|
aggregate_target
.
children
.
each
do
|
dep
|
aggregate_target
.
native_target
.
add_dependency
(
dep
.
target
)
end
aggregate_targets
.
each
do
|
aggregate_target
|
aggregate_target
.
pod_targets
.
each
do
|
pod_target
|
dependencies
=
pod_target
.
dependencies
.
map
{
|
dep_name
|
aggregate_target
.
pod_targets
.
find
{
|
target
|
target
.
pod_name
==
dep_name
}
}
aggregate_target
.
children
.
each
do
|
pod_target
|
dependencies
=
pod_target
.
dependencies
.
map
{
|
dep_name
|
aggregate_target
.
children
.
find
{
|
target
|
target
.
pod_name
==
dep_name
}
}
dependencies
.
each
do
|
dep
|
pod_target
.
native_target
.
add_dependency
(
dep
.
target
)
end
...
...
@@ -279,10 +278,10 @@ module Pod
@unrecognized_targets
=
native_targets_by_name
.
keys
.
dup
cp_targets
=
aggregate_targets
+
all_pod_targets
cp_targets
.
each
do
|
pod_target
|
native_targets
=
native_targets_by_name
[
pod_target
.
label
]
native_targets
=
native_targets_by_name
[
pod_target
.
name
]
if
native_targets
pod_target
.
native_target
=
native_targets
.
first
@unrecognized_targets
.
delete
(
pod_target
.
label
)
@unrecognized_targets
.
delete
(
pod_target
.
name
)
end
end
end
...
...
@@ -303,7 +302,7 @@ module Pod
pod_names
.
include?
(
group
.
display_name
)
end
aggregate_names
=
aggregate_targets
.
map
(
&
:
label
).
uniq
.
sort
aggregate_names
=
aggregate_targets
.
map
(
&
:
name
).
uniq
.
sort
groups_to_remove
<<
project
.
support_files_group
.
children
.
reject
do
|
group
|
aggregate_names
.
include?
(
group
.
display_name
)
end
...
...
@@ -347,7 +346,7 @@ module Pod
# process.
#
def
all_pod_targets
aggregate_targets
.
map
(
&
:
pod_targets
).
flatten
aggregate_targets
.
map
(
&
:
children
).
flatten
end
#
...
...
@@ -366,7 +365,7 @@ module Pod
#
def
aggregate_targets_to_install
aggregate_targets
.
sort_by
(
&
:name
).
select
do
|
target
|
target
.
native_target
.
nil?
&&
!
target
.
skip_installation?
target
.
native_target
.
nil?
end
end
...
...
lib/cocoapods/installer/pods_project_generator/file_references_installer.rb
View file @
23b8cd37
...
...
@@ -86,7 +86,6 @@ module Pod
# @!group Private Helpers
#---------------------------------------------------------------------#
# @return [Array<Sandbox::FileAccessor>] The file accessors for all the
# specs platform combinations.
#
...
...
lib/cocoapods/installer/pods_project_generator/support_files_generator.rb
View file @
23b8cd37
...
...
@@ -13,17 +13,21 @@ module Pod
#
attr_reader
:target
attr_reader
:
project
attr_reader
:
sandbox
def
initialize
(
target
,
project
)
def
initialize
(
target
,
sandbox
)
@target
=
target
@project
=
project
@sandbox
=
sandbox
end
def
project
sandbox
.
project
end
def
generate!
validate
# TODO clean up
if
target
.
is_a?
(
AggregateTarget
)
if
target
.
aggregate?
create_xcconfig_file_aggregate
create_target_environment_header
create_bridge_support_file
...
...
@@ -54,7 +58,7 @@ module Pod
#
def
create_xcconfig_file_aggregate
path
=
file_path
(
:public_xcconfig
)
gen
=
Generator
::
XCConfig
::
AggregateXCConfig
.
new
(
target
)
gen
=
Generator
::
XCConfig
::
AggregateXCConfig
.
new
(
target
,
sandbox
.
root
)
gen
.
save_as
(
path
)
target
.
xcconfig
=
gen
.
xcconfig
xcconfig_file_ref
=
add_file_to_support_group
(
path
)
...
...
@@ -65,13 +69,12 @@ module Pod
end
end
# Generates the contents of the xcconfig file and saves it to disk.
#
# @return [void]
#
def
create_xcconfig_file_pods
public_gen
=
Generator
::
XCConfig
::
PublicPodXCConfig
.
new
(
target
)
public_gen
=
Generator
::
XCConfig
::
PublicPodXCConfig
.
new
(
target
,
sandbox
.
root
)
path
=
file_path
(
:public_xcconfig
)
public_gen
.
save_as
(
path
)
add_file_to_support_group
(
path
)
...
...
@@ -87,13 +90,12 @@ module Pod
end
end
# Generates a header which allows to inspect at compile time the installed
# pods and the installed specifications of a pod.
# Generates a header which allows to inspect at compile time the
# installed pods and the installed specifications of a pod.
#
def
create_target_environment_header
path
=
file_path
(
:environment_header
)
generator
=
Generator
::
TargetEnvironmentHeader
.
new
(
target
.
pod_targets
.
map
{
|
l
|
l
.
specs
}.
flatten
)
path
=
file_path
(
:environment_header
,
target
.
root
)
generator
=
Generator
::
TargetEnvironmentHeader
.
new
(
target
.
children
.
map
{
|
l
|
l
.
specs
}.
flatten
)
generator
.
save_as
(
path
)
add_file_to_support_group
(
path
)
end
...
...
@@ -107,7 +109,7 @@ module Pod
# @return [void]
#
def
create_bridge_support_file
if
target
.
target_definition
.
podfile
.
generate_bridge_support?
if
target
.
generate_bridge_support?
path
=
file_path
(
:bridge_support
)
headers
=
target
.
target
.
headers_build_phase
.
files
.
map
{
|
bf
|
bf
.
file_ref
.
real_path
}
generator
=
Generator
::
BridgeSupport
.
new
(
headers
)
...
...
@@ -125,24 +127,25 @@ module Pod
Generator
::
Acknowledgements
.
generators
.
each
do
|
generator_class
|
basepath
=
file_path
(
:acknowledgements
)
path
=
generator_class
.
path_from_basepath
(
basepath
)
file_accessors
=
target
.
pod_targets
.
map
(
&
:file_accessors
).
flatten
file_accessors
=
target
.
children
.
map
(
&
:file_accessors
).
flatten
generator
=
generator_class
.
new
(
file_accessors
)
generator
.
save_as
(
path
)
add_file_to_support_group
(
path
)
end
end
# Creates a script that copies the resources to the bundle of the
client
# target.
# Creates a script that copies the resources to the bundle of the
#
client
target.
#
# @note The bridge support file needs to be created before the prefix
# header, otherwise it will not be added to the resources script.
# header, otherwise it will not be added to the resources
# script.
#
# @return [void]
#
def
create_copy_resources_script
path
=
file_path
(
:copy_resources_script
)
file_accessors
=
target
.
pod_targets
.
map
(
&
:file_accessors
).
flatten
file_accessors
=
target
.
children
.
map
(
&
:file_accessors
).
flatten
resource_paths
=
file_accessors
.
map
{
|
accessor
|
accessor
.
resources
.
flatten
.
map
{
|
res
|
res
.
relative_path_from
(
path
.
dirname
)
}}.
flatten
resource_bundles
=
file_accessors
.
map
{
|
accessor
|
accessor
.
resource_bundles
.
keys
.
map
{
|
name
|
"${BUILT_PRODUCTS_DIR}/
#{
name
}
.bundle"
}
}.
flatten
resources
=
[]
...
...
@@ -164,7 +167,7 @@ module Pod
def
create_prefix_header
path
=
file_path
(
:prefix_header
)
generator
=
Generator
::
PrefixHeader
.
new
(
target
.
file_accessors
,
target
.
platform
)
generator
.
imports
<<
file_path
(
:environment_header
).
basename
generator
.
imports
<<
file_path
(
:environment_header
,
target
.
root
).
basename
generator
.
save_as
(
path
)
add_file_to_support_group
(
path
)
target
.
prefix_header_path
=
path
...
...
@@ -183,7 +186,7 @@ module Pod
#
def
create_dummy_source
path
=
file_path
(
:dummy_source
)
generator
=
Generator
::
DummySource
.
new
(
target
.
label
)
generator
=
Generator
::
DummySource
.
new
(
target
.
name
)
generator
.
save_as
(
path
)
file_reference
=
add_file_to_support_group
(
path
)
existing
=
target
.
target
.
source_build_phase
.
files_references
.
include?
(
file_reference
)
...
...
@@ -214,10 +217,11 @@ module Pod
# @return [Pathname] The absolute path of the support file with the
# given extension.
#
def
file_path
(
key
)
def
file_path
(
key
,
target_for_path
=
nil
)
target_for_path
||=
target
file_name
=
SUPPORT_FILES_NAMES
[
key
]
raise
"Unrecognized key `
#{
key
}
`"
unless
file_name
target
.
support_files_root
+
"
#{
target
.
label
}
-
#{
file_name
}
"
target
_for_path
.
support_files_root
+
"
#{
target_for_path
.
name
}
-
#{
file_name
}
"
end
...
...
@@ -231,11 +235,11 @@ module Pod
#
def
support_files_group
unless
@support_files_group
if
target
.
is_a?
(
AggregateTarget
)
aggregate_name
=
target
.
label
if
target
.
aggregate?
aggregate_name
=
target
.
name
@support_files_group
=
project
.
add_aggregate_group
(
aggregate_name
,
project
.
path
.
dirname
)
else
aggregate_name
=
target
.
target_definition
.
label
.
to_s
aggregate_name
=
target
.
root
.
name
pod_name
=
target
.
pod_name
unless
project
.
aggregate_group
(
aggregate_name
)
# TODO
...
...
lib/cocoapods/installer/pods_project_generator/target_installer.rb
View file @
23b8cd37
...
...
@@ -36,7 +36,7 @@ module Pod
#
def
install!
add_target
unless
target
.
is_a?
(
AggregateTarget
)
unless
target
.
aggregate?
add_files_to_build_phases
add_resources_bundle_targets
link_to_system_frameworks
...
...
@@ -57,7 +57,7 @@ module Pod
# @return [void]
#
def
add_target
name
=
target
.
label
name
=
target
.
name
platform
=
target
.
platform
.
name
deployment_target
=
target
.
platform
.
deployment_target
.
to_s
@native_target
=
project
.
new_target
(
:static_library
,
name
,
platform
,
deployment_target
)
...
...
lib/cocoapods/installer/user_project_integrator.rb
View file @
23b8cd37
...
...
@@ -110,10 +110,12 @@ module Pod
# @return [void]
#
def
integrate_user_targets
targets_to_integrate
.
sort_by
(
&
:name
).
each
do
|
target
|
targets
.
sort_by
(
&
:name
).
each
do
|
target
|
unless
target
.
user_target_uuids
.
empty?
TargetIntegrator
.
new
(
target
).
integrate!
end
end
end
# Warns the user if the podfile is empty.
#
...
...
@@ -168,11 +170,6 @@ module Pod
end
.
compact
.
uniq
end
def
targets_to_integrate
targets
.
reject
{
|
target
|
target
.
target_definition
.
empty?
}
end
#-----------------------------------------------------------------------#
end
...
...
lib/cocoapods/installer/user_project_integrator/target_integrator.rb
View file @
23b8cd37
...
...
@@ -40,7 +40,7 @@ module Pod
# @return [String] a string representation suitable for debugging.
#
def
inspect
"#<
#{
self
.
class
}
for target `
#{
target
.
label
}
'>"
"#<
#{
self
.
class
}
for target `
#{
target
.
name
}
'>"
end
...
...
@@ -63,7 +63,7 @@ module Pod
# @return [Specification::Consumer] the consumer for the specifications.
#
def
spec_consumers
@spec_consumers
||=
target
.
pod_targets
.
map
(
&
:file_accessors
).
flatten
.
map
(
&
:spec_consumer
)
@spec_consumers
||=
target
.
children
.
map
(
&
:file_accessors
).
flatten
.
map
(
&
:spec_consumer
)
end
# Adds the `xcconfig` configurations files generated for the current
...
...
@@ -241,8 +241,8 @@ module Pod
# integration.
#
def
integration_message
"Integrating Pod
#{
'target'
.
pluralize
(
target
.
pod_targets
.
size
)
}
"
\
"`
#{
target
.
pod_targets
.
map
(
&
:name
).
to_sentence
}
` "
\
"Integrating Pod
#{
'target'
.
pluralize
(
target
.
children
.
size
)
}
"
\
"`
#{
target
.
children
.
map
(
&
:name
).
to_sentence
}
` "
\
"into aggregate target
#{
target
.
name
}
"
\
"of project
#{
UI
.
path
target
.
user_project_path
}
."
end
...
...
lib/cocoapods/target.rb
View file @
23b8cd37
...
...
@@ -8,35 +8,59 @@ module Pod
#
class
Target
# @return [PBXNativeTarget] the target definition of the Podfile that
# generated this target.
#
attr_reader
:target_definition
attr_accessor
:short_name
attr_accessor
:parent
def
initialize
(
short_name
,
parent
=
nil
)
@short_name
=
short_name
@parent
=
parent
@children
=
[]
@pod_targets
=
[]
@specs
=
[]
@file_accessors
=
[]
@user_target_uuids
=
[]
@user_build_configurations
=
{}
if
parent
parent
.
children
<<
self
end
end
# @return [
Sandbox] The sandbox where the Pods should be installed.
# @return [
Array]
#
attr_
reader
:sandbox
attr_
accessor
:children
# @return [
String] the name of the library.
# @return [
Target]
#
def
name
label
def
root
if
parent
parent
else
self
end
end
# @return [
String] the name of the library.
# @return [
Bool]
#
def
product_name
"lib
#{
label
}
.a"
def
root?
parent
.
nil?
end
# @return [String] the
XCConfig namespaced prefix
.
# @return [String] the
name of the library
.
#
def
xcconfig_prefix
label
.
upcase
.
gsub
(
/[^A-Z]/
,
'_'
)
+
'_'
def
name
if
root?
short_name
else
"
#{
parent
.
name
}
-
#{
short_name
}
"
end
end
def
skip_installation?
false
# @return [String] the name of the library.
#
def
product_name
"lib
#{
name
}
.a"
end
# @return [String] A string suitable for debugging.
...
...
@@ -45,69 +69,182 @@ module Pod
"<
#{
self
.
class
}
name=
#{
name
}
>"
end
# @return [String]
#
def
to_s
"
#{
name
}
#{
platform
}
"
s
=
"
#{
name
}
"
s
<<
"
#{
platform
}
"
if
platform
s
end
#-------------------------------------------------------------------------#
# @!group Information storage
public
# @return [Hash{String=>Symbol}] A hash representing the user build
# configurations where each key corresponds to the name of a
# configuration and its value to its type (`:debug` or `:release`).
#
attr_accessor
:user_build_configurations
# @!group Support files
#-------------------------------------------------------------------------#
# @return [PBXNativeTarget]
the target generated in the Pods project for
#
this library
.
# @return [PBXNativeTarget]
The Xcode native target generated in the Pods
#
project
.
#
attr_accessor
:target
alias
:native_target
:target
alias
:native_target
=
:target
=
# @return [P
latform] the platform for this library
.
# @return [P
athname] The directory where the support files are stored
.
#
def
platform
@platform
||=
target_definition
.
platform
end
attr_accessor
:support_files_root
# @return [HeadersStore] the build header store.
#
attr_accessor
:build_headers_store
# @return [
Xcodeproj::Config] The configuration file of the target
.
# @return [
HeadersStore] the public header store
.
#
# @note The configuration is generated by the {TargetInstaller} and
# used by {UserProjectIntegrator} to check for any overridden
#
values
.
attr_accessor
:public_headers_store
#
@return [Xcodeproj::Config] The public configuration
.
#
attr_accessor
:xcconfig
# @return [Pathname] The path of the xcconfig file relative to the root of
# the user project.
# @return [Pathname] The path of the public configuration.
#
attr_accessor
:xcconfig_path
# @return [Pathname] The path of the copy resources script relative to the
# root of the user project.
# @return [Pathname] The path of the copy resources script
#
attr_accessor
:copy_resources_script_path
# @return [Pathname]
# @return [Pathname] The path of the prefix header file.
#
attr_accessor
:prefix_header_path
public
# @!group Specs
#-------------------------------------------------------------------------#
# @!group Support files
attr_accessor
:specs
# @return [Specification] the spec for the target.
#
def
specs
(
@specs
+
children
.
map
(
&
:specs
)).
flatten
end
# @return [Array<Specification::Consumer>] The consumers of the Pod.
#
def
spec_consumers
specs
.
map
{
|
spec
|
spec
.
consumer
(
platform
)
}
end
# @return [Pathname] the folder where to store the support files of this
# library.
# @return [Specification] The root specification for the target.
#
def
support_files_root
@sandbox
.
library_support_files_dir
(
name
)
def
root_spec
specs
.
first
.
root
end
# @return [String] The name of the Pod that this target refers to.
#
def
pod_name
root_spec
.
name
end
# @return [Array<Sandbox::FileAccessor>] the file accessors for the
# specifications of this target.
#
attr_accessor
:file_accessors
# @return [Array<String>] The names of the Pods on which this target
# depends.
#
def
dependencies
specs
.
map
do
|
spec
|
spec
.
consumer
(
platform
).
dependencies
.
map
{
|
dep
|
Specification
.
root_name
(
dep
.
name
)
}
end
.
flatten
.
reject
{
|
dep
|
dep
==
pod_name
}
end
attr_accessor
:inhibits_warnings
alias
:inhibits_warnings?
:inhibits_warnings
# @inhibits_warnings ||= target_definition.inhibits_warnings_for_pod?(pod_name)
def
frameworks
spec_consumers
.
map
(
&
:frameworks
).
flatten
.
uniq
end
def
libraries
spec_consumers
.
map
(
&
:libraries
).
flatten
.
uniq
end
public
# @!group Aggregate
#-------------------------------------------------------------------------#
#
#
def
aggregate?
root?
end
#----------------------------------------#
# @return [Platform] the platform for this library.
#
def
platform
if
root?
@paltform
else
root
.
platform
end
end
#
#
def
platform
=
(
platform
)
if
root?
@paltform
=
platform
else
raise
"The platform must be set in the root target"
end
end
#----------------------------------------#
# @return [Pathname] the path of the user project that this target will
# integrate as identified by the analyzer.
#
# @note The project instance is not stored to prevent editing different
# instances.
#
attr_accessor
:user_project_path
# @return [String] the list of the UUIDs of the user targets that will be
# integrated by this target as identified by the analyzer.
#
# @note The target instances are not stored to prevent editing different
# instances.
#
attr_accessor
:user_target_uuids
# @return [Hash{String=>Symbol}] A hash representing the user build
# configurations where each key corresponds to the name of a
# configuration and its value to its type (`:debug` or `:release`).
#
attr_accessor
:user_build_configurations
#-------------------------------------------------------------------------#
attr_accessor
:target_definition
attr_accessor
:set_arc_compatibility_flag
alias
:set_arc_compatibility_flag?
:set_arc_compatibility_flag
attr_accessor
:generate_bridge_support
alias
:generate_bridge_support?
:generate_bridge_support
end
end
lib/cocoapods/target/aggregate_target.rb
deleted
100644 → 0
View file @
402d214a
module
Pod
# Stores the information relative to the target used to cluster the targets
# of the single Pods. The client targets will then depend on this one.
#
class
AggregateTarget
<
Target
# @param [TargetDefinition] target_definition @see target_definition
# @param [Sandbox] sandbox @see sandbox
#
def
initialize
(
target_definition
,
sandbox
)
@target_definition
=
target_definition
@sandbox
=
sandbox
@pod_targets
=
[]
@file_accessors
=
[]
@user_build_configurations
=
{}
end
def
skip_installation?
target_definition
.
empty?
end
# @return [String] the label for the target.
#
def
label
target_definition
.
label
.
to_s
end
#-------------------------------------------------------------------------#
# @return [Pathname] the path of the user project that this target will
# integrate as identified by the analyzer.
#
# @note The project instance is not stored to prevent editing different
# instances.
#
attr_accessor
:user_project_path
# @return [String] the list of the UUIDs of the user targets that will be
# integrated by this target as identified by the analyzer.
#
# @note The target instances are not stored to prevent editing different
# instances.
#
attr_accessor
:user_target_uuids
public
# @!group Pod targets
#-------------------------------------------------------------------------#
# @return [Array<PodTarget>] The dependencies for this target.
#
attr_accessor
:pod_targets
# @return [Array<Specification>] The specifications used by this aggregate target.
#
def
specs
pod_targets
.
map
(
&
:specs
).
flatten
end
# @return [Array<Specification::Consumer>] The consumers of the Pod.
#
def
spec_consumers
specs
.
map
{
|
spec
|
spec
.
consumer
(
platform
)
}
end
#-------------------------------------------------------------------------#
end
end
lib/cocoapods/target/pod_target.rb
deleted
100644 → 0
View file @
402d214a
module
Pod
# Stores the information relative to the target used to compile a single Pod.
# A pod can have one or more activated spec/subspecs.
#
class
PodTarget
<
Target
# @return [Specification] the spec for the target.
#
attr_reader
:specs
# @return [HeadersStore] the header directory for the target.
#
attr_reader
:build_headers
# @param [Specification] spec @see spec
# @param [TargetDefinition] target_definition @see target_definition
# @param [Sandbox] sandbox @see sandbox
#
def
initialize
(
specs
,
target_definition
,
sandbox
)
@specs
=
specs
@target_definition
=
target_definition
@sandbox
=
sandbox
@build_headers
=
Sandbox
::
HeadersStore
.
new
(
sandbox
,
"BuildHeaders"
)
@file_accessors
=
[]
@user_build_configurations
=
{}
end
# @return [String] the label for the target.
#
def
label
"
#{
target_definition
.
label
.
to_s
}
-
#{
root_spec
.
name
}
"
end
# @return [Array<Sandbox::FileAccessor>] the file accessors for the
# specifications of this target.
#
attr_accessor
:file_accessors
# @return [Array<Specification::Consumer>] the specification consumers for
# the target.
#
def
spec_consumers
specs
.
map
{
|
spec
|
spec
.
consumer
(
platform
)
}
end
# @return [Specification] The root specification for the target.
#
def
root_spec
specs
.
first
.
root
end
# @return [String] The name of the Pod that this target refers to.
#
def
pod_name
root_spec
.
name
end
# @return [Array<String>] The names of the Pods on which this target
# depends.
#
def
dependencies
specs
.
map
do
|
spec
|
spec
.
consumer
(
platform
).
dependencies
.
map
{
|
dep
|
Specification
.
root_name
(
dep
.
name
)
}
end
.
flatten
.
reject
{
|
dep
|
dep
==
pod_name
}
end
#-------------------------------------------------------------------------#
def
inhibits_warnings?
@inhibits_warnings
||=
target_definition
.
inhibits_warnings_for_pod?
(
pod_name
)
end
def
frameworks
spec_consumers
.
map
(
&
:frameworks
).
flatten
.
uniq
end
def
libraries
spec_consumers
.
map
(
&
:libraries
).
flatten
.
uniq
end
end
end
lib/cocoapods/validator.rb
View file @
23b8cd37
...
...
@@ -209,7 +209,7 @@ module Pod
installer
.
install!
file_accessors
=
installer
.
aggregate_targets
.
map
do
|
target
|
target
.
pod_targets
.
map
(
&
:file_accessors
)
target
.
children
.
map
(
&
:file_accessors
)
end
.
flatten
@file_accessor
=
file_accessors
.
find
{
|
accessor
|
accessor
.
spec
.
root
.
name
==
spec
.
root
.
name
}
...
...
cocoapods-integration-specs
@
a7ff74e4
Subproject commit
47c921f09fe5c1f0079922c6e10be0de21513a4a
Subproject commit
a7ff74e4d9bf72e594a11451e23112752ad8ea57
spec/unit/generator/xcconfig/aggregate_xcconfig_spec.rb
View file @
23b8cd37
...
...
@@ -6,85 +6,90 @@ module Pod
describe
AggregateXCConfig
do
before
do
@spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
@consumer
=
@spec
.
consumer
(
:ios
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target
=
AggregateTarget
.
new
(
target_definition
,
config
.
sandbox
)
@target
.
user_project_path
=
config
.
sandbox
.
root
.
dirname
+
'Project.xcodeproj'
@target
.
stubs
(
:platform
).
returns
(
:ios
)
@pod_target
=
PodTarget
.
new
([
@spec
],
target_definition
,
config
.
sandbox
)
@pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
@pod_target
.
stubs
(
:spec_consumers
).
returns
([
@consumer
])
@target
.
pod_targets
=
[
@pod_target
]
@generator
=
AggregateXCConfig
.
new
(
@target
)
target
=
Target
.
new
(
'Pod'
)
target
.
user_project_path
=
config
.
sandbox
.
root
.
dirname
+
'Project.xcodeproj'
target
.
stubs
(
:platform
).
returns
(
:ios
)
target
.
public_headers_store
=
config
.
sandbox
.
public_headers
target
.
user_project_path
=
config
.
sandbox
.
root
+
'../Project.xcodeproj'
target
.
support_files_root
=
config
.
sandbox
.
root
@sut
=
AggregateXCConfig
.
new
(
target
,
config
.
sandbox
.
root
)
end
#---------------------------------------------------------------------#
#-----------------------------------------------------------------------#
before
do
@podfile
=
Podfile
.
new
@target
.
target_definition
.
stubs
(
:podfile
).
returns
(
@podfile
)
@xcconfig
=
@generator
.
generate
end
describe
"#generate"
do
it
"generates the xcconfig"
do
@xcconfig
.
class
.
should
==
Xcodeproj
::
Config
xcconfig
=
@sut
.
generate
xcconfig
.
class
.
should
==
Xcodeproj
::
Config
end
it
"configures the project to load all members that implement Objective-c classes or categories from the static library"
do
@xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
include
'-ObjC'
xcconfig
=
@sut
.
generate
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
include
'-ObjC'
end
it
'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it'
do
@consumer
.
stubs
(
:requires_arc?
).
returns
(
true
)
@
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
not
.
include
(
"-fobjc-arc"
)
xcconfig
=
@sut
.
generate
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
not
.
include
(
"-fobjc-arc"
)
end
it
'adds the -fobjc-arc to OTHER_LDFLAGS if any pods require arc and the podfile explicitly requires it'
do
@podfile
.
stubs
(
:set_arc_compatibility_flag?
).
returns
(
true
)
@consumer
.
stubs
(
:requires_arc?
).
returns
(
true
)
@xcconfig
=
@generator
.
generate
@
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
split
(
" "
).
should
.
include
(
"-fobjc-arc"
)
@sut
.
target
.
set_arc_compatibility_flag
=
true
@sut
.
target
.
stubs
(
:spec_consumers
).
returns
([
stub
(
:requires_arc?
=>
true
)]
)
xcconfig
=
@sut
.
generate
xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
split
(
" "
).
should
.
include
(
"-fobjc-arc"
)
end
it
"sets the PODS_ROOT build variable"
do
@xcconfig
.
to_hash
[
'PODS_ROOT'
].
should
==
'${SRCROOT}/Pods'
xcconfig
=
@sut
.
generate
xcconfig
.
to_hash
[
'PODS_ROOT'
].
should
==
'${SRCROOT}/Pods'
end
it
'adds the sandbox public headers search paths to the xcconfig, with quotes'
do
xcconfig
=
@sut
.
generate
expected
=
"
\"
#{
config
.
sandbox
.
public_headers
.
search_paths
.
join
(
'" "'
)
}
\"
"
@
xcconfig
.
to_hash
[
'HEADER_SEARCH_PATHS'
].
should
==
expected
xcconfig
.
to_hash
[
'HEADER_SEARCH_PATHS'
].
should
==
expected
end
it
'adds the COCOAPODS macro definition'
do
@xcconfig
.
to_hash
[
'GCC_PREPROCESSOR_DEFINITIONS'
].
should
.
include
'COCOAPODS=1'
xcconfig
=
@sut
.
generate
xcconfig
.
to_hash
[
'GCC_PREPROCESSOR_DEFINITIONS'
].
should
.
include
'COCOAPODS=1'
end
it
'inherits the parent GCC_PREPROCESSOR_DEFINITIONS value'
do
@xcconfig
.
to_hash
[
'GCC_PREPROCESSOR_DEFINITIONS'
].
should
.
include
'$(inherited)'
xcconfig
=
@sut
.
generate
xcconfig
.
to_hash
[
'GCC_PREPROCESSOR_DEFINITIONS'
].
should
.
include
'$(inherited)'
end
#-----------------------------------------------------------------------#
before
do
@path
=
temporary_directory
+
'sample.xcconfig'
@generator
.
save_as
(
@path
)
end
#---------------------------------------------------------------------#
describe
"#save_as"
do
it
"saves the xcconfig"
do
generated
=
Xcodeproj
::
Config
.
new
(
@path
)
generated
.
class
.
should
==
Xcodeproj
::
Config
path
=
temporary_directory
+
'sample.xcconfig'
@sut
.
generate
@sut
.
save_as
(
path
)
Xcodeproj
::
Config
.
new
(
path
).
to_hash
[
'OTHER_LDFLAGS'
].
should
==
"-ObjC"
end
end
#-----------------------------------------------------------------------#
#---------------------------------------------------------------------#
describe
"Private Helpers"
do
it
"returns the path of the pods root relative to the user project"
do
@generator
.
send
(
:relative_pods_root
).
should
==
'${SRCROOT}/Pods'
@sut
.
send
(
:relative_pods_root
).
should
==
'${SRCROOT}/Pods'
end
end
#---------------------------------------------------------------------#
end
end
end
end
spec/unit/generator/xcconfig/private_pod_xcconfig_spec.rb
View file @
23b8cd37
...
...
@@ -5,17 +5,16 @@ module Pod
module
XCConfig
describe
PrivatePodXCConfig
do
describe
"
i
n general"
do
describe
"
I
n general"
do
before
do
@spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
@consumer
=
@spec
.
consumer
(
:ios
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@pod_target
=
PodTarget
.
new
([
@spec
],
target_definition
,
config
.
sandbox
)
@pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
@pod_target
=
Target
.
new
(
'Pods-BananaLib'
)
@pod_target
.
platform
=
Platform
.
ios
@pod_target
.
build_headers_store
=
Sandbox
::
HeadersStore
.
new
(
config
.
sandbox
,
"BuildHeaders"
)
@pod_target
.
public_headers_store
=
config
.
sandbox
.
public_headers
public_xcconfig
=
Xcodeproj
::
Config
.
new
({
"OTHER_LDFLAGS"
=>
"-framework SystemConfiguration"
})
@generator
=
PrivatePodXCConfig
.
new
(
@pod_target
,
public_xcconfig
)
@podfile
=
Podfile
.
new
@pod_target
.
target_definition
.
stubs
(
:podfile
).
returns
(
@podfile
)
@xcconfig
=
@generator
.
generate
end
...
...
@@ -23,28 +22,16 @@ module Pod
@xcconfig
.
class
.
should
==
Xcodeproj
::
Config
end
it
"
configures the project to load all members that implement Objective-c classes or categories from the static library
"
do
it
"
sets the default linker flags
"
do
@xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
include
'-ObjC'
end
it
'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it'
do
@consumer
.
stubs
(
:requires_arc?
).
returns
(
true
)
@xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
not
.
include
(
"-fobjc-arc"
)
end
it
'adds the -fobjc-arc to OTHER_LDFLAGS if any pods require arc and the podfile explicitly requires it'
do
@podfile
.
stubs
(
:set_arc_compatibility_flag?
).
returns
(
true
)
@consumer
.
stubs
(
:requires_arc?
).
returns
(
true
)
@xcconfig
=
@generator
.
generate
@xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
split
(
" "
).
should
.
include
(
"-fobjc-arc"
)
end
it
"sets the PODS_ROOT build variable"
do
@xcconfig
.
to_hash
[
'PODS_ROOT'
].
should
.
not
==
nil
end
it
'adds the library build headers and public headers search paths to the xcconfig, with quotes'
do
private_headers
=
"
\"
#{
@pod_target
.
build_headers
.
search_paths
.
join
(
'" "'
)
}
\"
"
private_headers
=
"
\"
#{
@pod_target
.
build_headers
_store
.
search_paths
.
join
(
'" "'
)
}
\"
"
public_headers
=
"
\"
#{
config
.
sandbox
.
public_headers
.
search_paths
.
join
(
'" "'
)
}
\"
"
@xcconfig
.
to_hash
[
'HEADER_SEARCH_PATHS'
].
should
.
include
private_headers
@xcconfig
.
to_hash
[
'HEADER_SEARCH_PATHS'
].
should
.
include
public_headers
...
...
@@ -55,7 +42,7 @@ module Pod
end
it
'adds the pod namespaced configuration items'
do
@xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
include
(
"${
#{
@pod_target
.
xcconfig_prefix
}
OTHER_LDFLAGS}"
)
@xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
include
(
"${
PODS_BANANALIB_
OTHER_LDFLAGS}"
)
end
it
'sets the relative path of the pods root for spec libraries to ${SRCROOT}'
do
...
...
@@ -71,7 +58,7 @@ module Pod
end
#---------------------------------------------------------------------
----
#
#---------------------------------------------------------------------#
describe
"Private Helpers"
do
...
...
@@ -124,7 +111,7 @@ module Pod
end
#---------------------------------------------------------------------
----
#
#---------------------------------------------------------------------#
end
end
...
...
spec/unit/generator/xcconfig/public_pod_xcconfig_spec.rb
View file @
23b8cd37
...
...
@@ -7,50 +7,45 @@ module Pod
before
do
@spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@pod_target
=
PodTarget
.
new
([
@spec
],
@target_definition
,
config
.
sandbox
)
@pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
@generator
=
PublicPodXCConfig
.
new
(
@pod_target
)
@podfile
=
Podfile
.
new
@spec
.
xcconfig
=
{
'OTHER_LDFLAGS'
=>
'-no_compact_unwind'
}
@spec
.
frameworks
=
[
'QuartzCore'
]
@spec
.
weak_frameworks
=
[
'iAd'
]
@spec
.
libraries
=
[
'xml2'
]
@pod_target
=
Target
.
new
(
'Pods-BananaLib'
)
@sut
=
PublicPodXCConfig
.
new
(
@pod_target
,
config
.
sandbox
.
root
)
file_accessors
=
[
Sandbox
::
FileAccessor
.
new
(
fixture
(
'banana-lib'
),
@spec
.
consumer
(
:ios
))]
# vendored_framework_paths = [config.sandbox.root + 'BananaLib/BananaLib.framework']
# Sandbox::FileAccessor.any_instance.stubs(:vendored_frameworks).returns(vendored_framework_paths)
@pod_target
.
target_definition
.
stubs
(
:podfile
).
returns
(
@podfile
)
@pod_target
.
stubs
(
:file_accessors
).
returns
(
file_accessors
)
@xcconfig
=
@generator
.
generate
end
it
"generates the xcconfig"
do
@xcconfig
.
class
.
should
==
Xcodeproj
::
Config
xcconfig
=
@sut
.
generate
xcconfig
.
class
.
should
==
Xcodeproj
::
Config
end
it
"includes the xcconfig of the specifications"
do
@xcconfig
.
to_hash
[
"OTHER_LDFLAGS"
].
should
.
include
(
'-no_compact_unwind'
)
@spec
.
xcconfig
=
{
'OTHER_LDFLAGS'
=>
'-no_compact_unwind'
}
xcconfig
=
@sut
.
generate
xcconfig
.
to_hash
[
"OTHER_LDFLAGS"
].
should
.
include
(
'-no_compact_unwind'
)
end
it
"includes the libraries for the specifications"
do
@xcconfig
.
to_hash
[
"OTHER_LDFLAGS"
].
should
.
include
(
'-lxml2'
)
@spec
.
libraries
=
[
'xml2'
]
xcconfig
=
@sut
.
generate
xcconfig
.
to_hash
[
"OTHER_LDFLAGS"
].
should
.
include
(
'-lxml2'
)
end
it
"includes the frameworks of the specifications"
do
@xcconfig
.
to_hash
[
"OTHER_LDFLAGS"
].
should
.
include
(
'-framework QuartzCore'
)
@spec
.
frameworks
=
[
'QuartzCore'
]
xcconfig
=
@sut
.
generate
xcconfig
.
to_hash
[
"OTHER_LDFLAGS"
].
should
.
include
(
'-framework QuartzCore'
)
end
it
"includes the weak-frameworks of the specifications"
do
@xcconfig
.
to_hash
[
"OTHER_LDFLAGS"
].
should
.
include
(
'-weak_framework iAd'
)
@spec
.
weak_frameworks
=
[
'iAd'
]
xcconfig
=
@sut
.
generate
xcconfig
.
to_hash
[
"OTHER_LDFLAGS"
].
should
.
include
(
'-weak_framework iAd'
)
end
it
"includes the developer frameworks search paths when SenTestingKit is detected"
do
@spec
.
xcconfig
=
{
'OTHER_LDFLAGS'
=>
'-no_compact_unwind'
}
@spec
.
frameworks
=
[
'SenTestingKit'
]
xcconfig
=
@
generator
.
generate
xcconfig
=
@
sut
.
generate
framework_search_paths
=
xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
]
framework_search_paths
.
should
.
include
(
'$(SDKROOT)/Developer'
)
end
...
...
@@ -58,29 +53,30 @@ module Pod
it
"doesn't include the developer frameworks if already present"
do
@spec
.
xcconfig
=
{
'FRAMEWORK_SEARCH_PATHS'
=>
'"$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
}
@spec
.
frameworks
=
[
'SenTestingKit'
]
xcconfig
=
@
generator
.
generate
xcconfig
=
@
sut
.
generate
framework_search_paths
=
xcconfig
.
to_hash
[
'FRAMEWORK_SEARCH_PATHS'
].
split
(
' '
)
framework_search_paths
.
select
{
|
path
|
path
==
'"$(SDKROOT)/Developer/Library/Frameworks"'
}.
count
.
should
==
1
framework_search_paths
.
select
{
|
path
|
path
==
'"$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
}.
count
.
should
==
1
end
it
"includes the build settings of the frameworks bundles of the spec"
do
config
.
sandbox
.
stubs
(
:
root
).
returns
(
fixture
(
''
))
xcconfig
=
@
generator
.
generate
@sut
.
stubs
(
:sandbox_
root
).
returns
(
fixture
(
''
))
xcconfig
=
@
sut
.
generate
xcconfig
.
to_hash
[
"FRAMEWORK_SEARCH_PATHS"
].
should
.
include?
(
'"$(PODS_ROOT)/banana-lib"'
)
end
it
"includes the build settings of the libraries shipped with the spec"
do
config
.
sandbox
.
stubs
(
:
root
).
returns
(
fixture
(
''
))
xcconfig
=
@
generator
.
generate
@sut
.
stubs
(
:sandbox_
root
).
returns
(
fixture
(
''
))
xcconfig
=
@
sut
.
generate
xcconfig
.
to_hash
[
"LIBRARY_SEARCH_PATHS"
].
should
.
include?
(
'"$(PODS_ROOT)/banana-lib"'
)
end
#---------------------------------------------------------------------
--
#
#---------------------------------------------------------------------#
before
do
xcconfig
=
@sut
.
generate
@path
=
temporary_directory
+
'sample.xcconfig'
@
generator
.
save_as
(
@path
)
@
sut
.
save_as
(
@path
)
end
it
"saves the xcconfig"
do
...
...
@@ -90,9 +86,11 @@ module Pod
it
"writes the xcconfig with a prefix computed from the target definition and root spec"
do
generated
=
Xcodeproj
::
Config
.
new
(
@path
)
generated
.
to_hash
.
each
{
|
k
,
v
|
k
.
should
.
start_with
(
@pod_target
.
xcconfig_prefix
)
}
generated
.
to_hash
.
each
{
|
k
,
v
|
k
.
should
.
start_with
(
'PODS_BANANALIB_'
)
}
end
#---------------------------------------------------------------------#
end
end
end
...
...
spec/unit/generator/xcconfig/xcconfig_helper_spec.rb
View file @
23b8cd37
...
...
@@ -11,22 +11,14 @@ module Pod
#---------------------------------------------------------------------#
describe
"::default_ld_flags"
do
it
"returns the default linker flags"
do
podfile
=
stub
(
:set_arc_compatibility_flag?
=>
false
)
target_definition
=
stub
(
:podfile
=>
podfile
)
target
=
stub
(
:target_definition
=>
target_definition
)
result
=
@sut
.
default_ld_flags
(
target
)
result
.
should
==
'-ObjC'
describe
"::prefix"
do
it
"returns the prefix to use for the target with the given name"
do
@sut
.
prefix
(
'Pods'
).
should
==
'PODS_'
@sut
.
prefix
(
'Pods-BananaLib'
).
should
==
'PODS_BANANALIB_'
end
it
"includes the ARC compatibility flag if required by the Podfile"
do
podfile
=
stub
(
:set_arc_compatibility_flag?
=>
true
)
target_definition
=
stub
(
:podfile
=>
podfile
)
spec_consumer
=
stub
(
:requires_arc?
=>
true
)
target
=
stub
(
:target_definition
=>
target_definition
,
:spec_consumers
=>
[
spec_consumer
]
)
result
=
@sut
.
default_ld_flags
(
target
)
result
.
should
==
'-ObjC -fobjc-arc'
it
"replaces any non character which is not in the alphabet with an underscore"
do
@sut
.
prefix
(
'Pods-BananaLib+Categories'
).
should
==
'PODS_BANANALIB_CATEGORIES_'
end
end
...
...
@@ -41,6 +33,25 @@ module Pod
#---------------------------------------------------------------------#
describe
"::default_ld_flags"
do
it
"returns the default linker flags"
do
target
=
Target
.
new
(
'BananaLib'
)
target
.
set_arc_compatibility_flag
=
false
result
=
@sut
.
default_ld_flags
(
target
)
result
.
should
==
'-ObjC'
end
it
"includes the ARC compatibility flag if required by the Podfile"
do
target
=
Target
.
new
(
'BananaLib'
)
target
.
set_arc_compatibility_flag
=
true
target
.
stubs
(
:spec_consumers
).
returns
([
stub
(
:requires_arc?
=>
true
)])
result
=
@sut
.
default_ld_flags
(
target
)
result
.
should
==
'-ObjC -fobjc-arc'
end
end
#---------------------------------------------------------------------#
describe
"::add_spec_build_settings_to_xcconfig"
do
it
"adds the build settings of the consumer"
do
xcconfig
=
Xcodeproj
::
Config
.
new
...
...
spec/unit/hooks/installer_representation_spec.rb
View file @
23b8cd37
...
...
@@ -16,7 +16,7 @@ module Pod
config
.
integrate_targets
=
false
@installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
@installer
.
send
(
:analyze
)
@specs
=
@installer
.
aggregate_targets
.
first
.
pod_targets
.
first
.
specs
@specs
=
@installer
.
aggregate_targets
.
first
.
children
.
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
.
aggregate_targets
.
first
.
pod_targets
.
first
.
target_definition
target_definition
=
@installer
.
aggregate_targets
.
first
.
children
.
first
.
target_definition
pods_by_lib
[
target_definition
].
map
(
&
:name
).
should
==
[
'JSONKit'
]
end
...
...
spec/unit/hooks/library_representation_spec.rb
View file @
23b8cd37
...
...
@@ -7,7 +7,8 @@ module Pod
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'MyApp'
,
nil
)
@spec
=
Spec
.
new
@spec
.
name
=
'RestKit'
@lib
=
AggregateTarget
.
new
(
@target_definition
,
config
.
sandbox
)
@lib
=
Target
.
new
(
'Pods-MyApp'
,
nil
)
@lib
.
target_definition
=
@target_definition
@rep
=
Hooks
::
LibraryRepresentation
.
new
(
config
.
sandbox
,
@lib
)
end
...
...
spec/unit/installer/analyzer_spec.rb
View file @
23b8cd37
...
...
@@ -76,7 +76,7 @@ module Pod
it
"generates the libraries which represent the target definitions"
do
target
=
@analyzer
.
analyze
.
targets
.
first
target
.
pod_targets
.
map
(
&
:name
).
sort
.
should
==
[
target
.
children
.
map
(
&
:name
).
sort
.
should
==
[
'Pods-JSONKit'
,
'Pods-AFNetworking'
,
'Pods-SVPullToRefresh'
,
...
...
@@ -171,7 +171,7 @@ module Pod
end
it
"adds the specifications to the correspondent libraries"
do
@analyzer
.
analyze
.
targets
.
first
.
pod_targets
.
map
(
&
:specs
).
flatten
.
map
(
&
:to_s
).
should
==
[
@analyzer
.
analyze
.
targets
.
first
.
children
.
map
(
&
:specs
).
flatten
.
map
(
&
:to_s
).
should
==
[
"AFNetworking (1.0.1)"
,
"JSONKit (1.5pre)"
,
"SVPullToRefresh (0.4)"
,
...
...
spec/unit/installer/pods_project_generator/file_references_installer_spec.rb
View file @
23b8cd37
...
...
@@ -5,7 +5,7 @@ module Pod
before
do
@file_accessor
=
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)
@pod_target
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
@pod_target
=
Target
.
new
(
'BananaLib'
)
@pod_target
.
file_accessors
=
[
@file_accessor
]
config
.
sandbox
.
project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
config
.
sandbox
.
project
.
add_pod_group
(
'BananaLib'
,
fixture
(
'banana-lib'
))
...
...
@@ -54,9 +54,9 @@ module Pod
describe
"#file_accessors"
do
it
"returns the file accessors"
do
pod_target_1
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target_1
=
Target
.
new
(
'BananaLib_1'
)
pod_target_1
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
pod_target_2
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target_2
=
Target
.
new
(
'BananaLib_1'
)
pod_target_2
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
@sut
=
Installer
::
PodsProjectGenerator
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
pod_target_1
,
pod_target_2
])
roots
=
@sut
.
send
(
:file_accessors
).
map
{
|
fa
|
fa
.
path_list
.
root
}
...
...
@@ -64,9 +64,9 @@ module Pod
end
it
"handles libraries empty libraries without file accessors"
do
pod_target
_1
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target
_1
.
file_accessors
=
[]
@sut
=
Installer
::
PodsProjectGenerator
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
pod_target
_1
])
pod_target
=
Target
.
new
(
'BananaLib_1'
)
pod_target
.
file_accessors
=
[]
@sut
=
Installer
::
PodsProjectGenerator
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
pod_target
])
roots
=
@sut
.
send
(
:file_accessors
).
should
==
[]
end
end
...
...
spec/unit/installer/pods_project_generator/support_files_generator_spec.rb
View file @
23b8cd37
...
...
@@ -7,29 +7,28 @@ module Pod
before
do
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
native_target
=
@project
.
new_target
(
:static_target
,
'Pods'
,
:ios
,
'6.0'
)
config
.
sandbox
.
project
=
@project
@podfile
=
Podfile
.
new
do
platform
:ios
xcodeproj
'dummy'
end
@target_definition
=
@podfile
.
target_definitions
[
'Pods'
]
@target
=
AggregateTarget
.
new
(
@target_definition
,
config
.
sandbox
)
@target
.
stubs
(
:label
).
returns
(
'Pods'
)
@target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
))
@target
=
Target
.
new
(
'Pods'
)
@target
.
platform
=
Platform
.
new
(
:ios
,
'6.0'
)
@target
.
user_project_path
=
config
.
sandbox
.
root
+
'../user_project.xcodeproj'
@target
.
user_build_configurations
=
{
'Debug'
=>
:debug
,
'Release'
=>
:release
,
'AppStore'
=>
:release
,
'Test'
=>
:debug
}
@target
.
support_files_root
=
config
.
sandbox
.
root
@target
.
target
=
native_target
@target
.
public_headers_store
=
config
.
sandbox
.
public_headers
@target
.
build_headers_store
=
config
.
sandbox
.
public_headers
file_accessor
=
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)
@spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
@pod_target
=
PodTarget
.
new
([
@spec
],
@target_definition
,
config
.
sandbox
)
@pod_target
.
s
tubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
))
@pod_target
=
Target
.
new
(
'BananaLib'
,
@target
)
@pod_target
.
s
pecs
=
[
@spec
]
@pod_target
.
user_build_configurations
=
@target
.
user_build_configurations
@pod_target
.
file_accessors
=
[
file_accessor
]
@pod_target
.
support_files_root
=
config
.
sandbox
.
root
@pod_target
.
public_headers_store
=
config
.
sandbox
.
public_headers
@pod_target
.
build_headers_store
=
config
.
sandbox
.
public_headers
@target
.
pod_targets
=
[
@pod_target
]
@sut
=
Installer
::
PodsProjectGenerator
::
SupportFilesGenerator
.
new
(
@target
,
@project
)
@sut
=
Installer
::
PodsProjectGenerator
::
SupportFilesGenerator
.
new
(
@target
,
config
.
sandbox
)
end
it
"adds file references for the support files of the target"
do
...
...
@@ -64,7 +63,7 @@ module Pod
end
it
"creates a bridge support file"
do
Podfile
.
any_instance
.
stubs
(
:generate_bridge_support?
=>
true
)
@target
.
generate_bridge_support
=
true
Generator
::
BridgeSupport
.
any_instance
.
expects
(
:save_as
).
once
@sut
.
generate!
end
...
...
@@ -108,24 +107,29 @@ module Pod
describe
"PodTarget"
do
before
do
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
@project
.
add_pod_group
(
'BananaLib'
,
fixture
(
'banana-lib'
))
native_target
=
@project
.
new_target
(
:static_target
,
'Pods-BananaLib'
,
:ios
,
'6.0'
)
config
.
sandbox
.
project
=
@project
@podfile
=
Podfile
.
new
do
platform
:ios
xcodeproj
'dummy'
end
@target_definition
=
@podfile
.
target_definitions
[
'Pods'
]
@target
=
Target
.
new
(
'Pods'
)
@target
.
platform
=
Platform
.
new
(
:ios
,
'6.0'
)
@target
.
user_project_path
=
config
.
sandbox
.
root
+
'../user_project.xcodeproj'
@target
.
user_build_configurations
=
{
'Debug'
=>
:debug
,
'Release'
=>
:release
,
'AppStore'
=>
:release
,
'Test'
=>
:debug
}
@target
.
support_files_root
=
config
.
sandbox
.
root
@target
.
public_headers_store
=
config
.
sandbox
.
public_headers
@target
.
build_headers_store
=
config
.
sandbox
.
public_headers
file_accessor
=
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)
@spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
@target
=
PodTarget
.
new
([
@spec
],
@target_definition
,
config
.
sandbox
)
@target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
))
@target
.
user_build_configurations
=
@target
.
user_build_configurations
@target
.
file_accessors
=
[
file_accessor
]
@target
.
target
=
native_target
@pod_target
=
Target
.
new
(
'BananaLib'
,
@target
)
@pod_target
.
specs
=
[
@spec
]
@pod_target
.
user_build_configurations
=
@target
.
user_build_configurations
@pod_target
.
file_accessors
=
[
file_accessor
]
@pod_target
.
support_files_root
=
config
.
sandbox
.
root
@pod_target
.
public_headers_store
=
config
.
sandbox
.
public_headers
@pod_target
.
build_headers_store
=
config
.
sandbox
.
public_headers
@pod_target
.
target
=
native_target
@sut
=
Installer
::
PodsProjectGenerator
::
SupportFilesGenerator
.
new
(
@
target
,
@project
)
@sut
=
Installer
::
PodsProjectGenerator
::
SupportFilesGenerator
.
new
(
@
pod_target
,
config
.
sandbox
)
end
it
"creates the xcconfig file"
do
...
...
spec/unit/installer/pods_project_generator/target_installer_spec.rb
View file @
23b8cd37
...
...
@@ -17,9 +17,8 @@ module Pod
before
do
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
target
=
AggregateTarget
.
new
(
nil
,
config
.
sandbox
)
target
.
stubs
(
:label
).
returns
(
'Pods'
)
target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
))
target
=
Target
.
new
(
'Pods'
)
target
.
platform
=
Platform
.
new
(
:ios
,
'6.0'
)
@sut
=
Installer
::
PodsProjectGenerator
::
TargetInstaller
.
new
(
@project
,
target
)
end
...
...
@@ -101,11 +100,10 @@ module Pod
project
.
add_file_reference
(
file
,
group
)
end
target
=
PodTarget
.
new
([
spec
],
nil
,
config
.
sandbox
)
target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
)
)
target
=
Target
.
new
(
'Pods-BananaLib'
)
target
.
platform
=
Platform
.
new
(
:ios
,
'6.0'
)
target
.
file_accessors
=
[
file_accessor
]
target
.
stubs
(
:inhibits_warnings?
).
returns
(
false
)
target
.
stubs
(
:label
).
returns
(
'Pods-BananaLib'
)
target
.
inhibits_warnings
=
false
@sut
=
Installer
::
PodsProjectGenerator
::
TargetInstaller
.
new
(
project
,
target
)
@sut
.
send
(
:add_target
)
end
...
...
@@ -144,9 +142,9 @@ module Pod
describe
"#link_to_system_frameworks"
do
before
do
project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
target
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
)
)
target
.
stubs
(
:label
).
returns
(
'Pods-BananaLib'
)
target
=
Target
.
new
(
'Pods-BananaLib'
)
target
.
platform
=
Platform
.
new
(
:ios
,
'6.0'
)
target
.
inhibits_warnings
=
false
@sut
=
Installer
::
PodsProjectGenerator
::
TargetInstaller
.
new
(
project
,
target
)
@sut
.
send
(
:add_target
)
end
...
...
spec/unit/installer/pods_project_generator_spec.rb
View file @
23b8cd37
...
...
@@ -81,10 +81,11 @@ module Pod
end
it
"sets the deployment target for the project"
do
target_ios
=
AggregateTarget
.
new
(
nil
,
config
.
sandbox
)
target_osx
=
AggregateTarget
.
new
(
nil
,
config
.
sandbox
)
target_ios
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
))
target_osx
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:osx
,
'10.8'
))
target_ios
=
Target
.
new
(
'Pods-ios'
)
target_ios
.
platform
=
Platform
.
ios
target_ios
.
platform
=
Platform
.
new
(
:ios
,
'6.0'
)
target_osx
=
Target
.
new
(
'Pods-osx'
)
target_osx
.
platform
=
Platform
.
new
(
:osx
,
'10.8'
)
@sut
.
stubs
(
:aggregate_targets
).
returns
([
target_ios
,
target_osx
])
@sut
.
send
(
:prepare_project
)
build_settings
=
@sut
.
project
.
build_configurations
.
map
(
&
:build_settings
)
...
...
@@ -119,8 +120,8 @@ module Pod
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
nil
)
pod_target
=
PodTarget
.
new
([],
@target_definition
,
config
.
sandbox
)
pod_target
.
stubs
(
:name
).
returns
(
'BananaLib'
)
aggregate_target
=
AggregateTarget
.
new
(
@target_definition
,
config
.
sandbox
)
aggregate_target
.
pod_targets
=
[
pod_target
]
aggregate_target
=
Target
.
new
(
'Pods'
)
aggregate_target
.
children
=
[
pod_target
]
@sut
=
PodsProjectGenerator
.
new
(
config
.
sandbox
,
[
aggregate_target
])
end
...
...
@@ -177,11 +178,10 @@ module Pod
project
=
Pod
::
Project
.
new
(
config
.
sandbox
.
project_path
)
@aggregate_native_target
=
project
.
new_target
(
:static_library
,
'Pods'
,
:ios
)
@pod_native_target
=
project
.
new_target
(
:static_library
,
'Pods-BananaLib'
,
:ios
)
pod_target
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target
.
target
=
@pod_native_target
aggregate_target
=
AggregateTarget
.
new
(
nil
,
config
.
sandbox
)
aggregate_target
.
pod_targets
=
[
pod_target
]
aggregate_target
=
Target
.
new
(
'Pods'
)
aggregate_target
.
target
=
@aggregate_native_target
pod_target
=
Target
.
new
(
'Pods-BananaLib'
,
aggregate_target
)
pod_target
.
target
=
@pod_native_target
@sut
=
PodsProjectGenerator
.
new
(
config
.
sandbox
,
[
aggregate_target
])
end
...
...
@@ -200,16 +200,15 @@ module Pod
project
=
Pod
::
Project
.
new
(
config
.
sandbox
.
project_path
)
aggregate_native_target
=
project
.
new_target
(
:static_library
,
'Pods'
,
:ios
)
pod_native_target_1
=
project
.
new_target
(
:static_library
,
'Pods-BananaLib'
,
:ios
)
@pod_target_1
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
@pod_target_1
.
stubs
(
:pod_name
).
returns
(
'BananaLib'
)
@pod_target_1
.
target
=
pod_native_target_1
pod_native_target_2
=
project
.
new_target
(
:static_library
,
'Pods-monkey'
,
:ios
)
pod_target_2
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target_2
.
stubs
(
:pod_name
).
returns
(
'monkey'
)
pod_target_2
.
target
=
pod_native_target_2
@aggregate_target
=
AggregateTarget
.
new
(
nil
,
config
.
sandbox
)
@aggregate_target
.
pod_targets
=
[
@pod_target_1
,
pod_target_2
]
@aggregate_target
=
Target
.
new
(
'Pods'
)
@aggregate_target
.
target
=
aggregate_native_target
@pod_target_1
=
Target
.
new
(
'BananaLib'
,
@aggregate_target
)
@pod_target_1
.
target
=
pod_native_target_1
@pod_target_2
=
Target
.
new
(
'monkey'
,
@aggregate_target
)
@pod_target_2
.
target
=
pod_native_target_2
@sut
=
PodsProjectGenerator
.
new
(
config
.
sandbox
,
[
@aggregate_target
])
end
...
...
@@ -222,6 +221,8 @@ module Pod
it
"sets the dependencies of the pod targets"
do
@pod_target_1
.
stubs
(
:dependencies
).
returns
([
'monkey'
])
@pod_target_1
.
stubs
(
:pod_name
).
returns
(
'BananaLib'
)
@pod_target_2
.
stubs
(
:pod_name
).
returns
(
'monkey'
)
@sut
.
send
(
:add_missing_target_dependencies
)
dependencies
=
@pod_target_1
.
target
.
dependencies
dependencies
.
map
{
|
d
|
d
.
target
.
name
}.
should
==
[
"Pods-monkey"
]
...
...
spec/unit/installer/user_project_integrator/target_integrator_spec.rb
View file @
23b8cd37
...
...
@@ -9,11 +9,8 @@ module Pod
before
do
project_path
=
SpecHelper
.
create_sample_app_copy_from_fixture
(
'SampleProject'
)
@project
=
Xcodeproj
::
Project
.
open
(
project_path
)
Xcodeproj
::
Project
.
new
(
config
.
sandbox
.
project_path
).
save
@native_target
=
@project
.
targets
.
first
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
target_definition
.
link_with_first_target
=
true
@target
=
AggregateTarget
.
new
(
target_definition
,
config
.
sandbox
)
@target
=
Target
.
new
(
'Pods'
)
@target
.
user_project_path
=
project_path
@target
.
user_target_uuids
=
[
@native_target
.
uuid
]
@target
.
xcconfig_path
=
config
.
sandbox
.
root
+
'Pods.xcconfig'
...
...
spec/unit/installer/user_project_integrator_spec.rb
View file @
23b8cd37
...
...
@@ -18,12 +18,12 @@ module Pod
end
config
.
sandbox
.
project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
Xcodeproj
::
Project
.
new
(
config
.
sandbox
.
project_path
).
save
@library
=
AggregateTarget
.
new
(
@podfile
.
target_definitions
[
'Pods'
],
config
.
sandbox
)
@library
=
Target
.
new
(
'Pods'
)
@library
.
user_project_path
=
sample_project_path
@library
.
user_target_uuids
=
[
'A346496C14F9BE9A0080D870'
]
@library
.
xcconfig_path
=
config
.
sandbox
.
root
+
'Pods.xcconfig'
@library
.
copy_resources_script_path
=
config
.
sandbox
.
root
+
'Pods-resources.sh'
empty_library
=
AggregateTarget
.
new
(
@podfile
.
target_definitions
[
:empty
],
config
.
sandbox
)
empty_library
=
Target
.
new
(
'Empty'
)
@integrator
=
Installer
::
UserProjectIntegrator
.
new
(
@podfile
,
config
.
sandbox
,
temporary_directory
,
[
@library
,
empty_library
])
end
...
...
@@ -148,11 +148,6 @@ module Pod
@integrator
.
send
(
:user_project_paths
).
should
==
[
@sample_project_path
]
end
it
"skips libraries with empty target definitions"
do
@integrator
.
targets
.
map
(
&
:name
).
should
==
[
"Pods"
,
"Pods-empty"
]
@integrator
.
send
(
:targets_to_integrate
).
map
(
&
:name
).
should
==
[
'Pods'
]
end
end
#-----------------------------------------------------------------------#
...
...
spec/unit/installer_spec.rb
View file @
23b8cd37
...
...
@@ -115,7 +115,10 @@ module Pod
@analysis_result
=
Installer
::
Analyzer
::
AnalysisResult
.
new
@analysis_result
.
specifications
=
[]
config
.
sandbox
.
state
=
Installer
::
Analyzer
::
SpecsState
.
new
()
@pod_targets
=
[
PodTarget
.
new
([],
nil
,
config
.
sandbox
)]
pod_target
=
Target
.
new
(
'BananaLib'
,
nil
)
pod_target
.
build_headers_store
=
Sandbox
::
HeadersStore
.
new
(
config
.
sandbox
,
"BuildHeaders"
)
@pod_targets
=
[
pod_target
]
@installer
.
stubs
(
:analysis_result
).
returns
(
@analysis_result
)
@installer
.
stubs
(
:pod_targets
).
returns
(
@pod_targets
)
end
...
...
@@ -123,7 +126,7 @@ module Pod
it
"cleans the header stores"
do
config
.
sandbox
.
public_headers
.
expects
(
:implode!
)
@installer
.
pod_targets
.
each
do
|
pods_target
|
pods_target
.
build_headers
.
expects
(
:implode!
)
pods_target
.
build_headers
_store
.
expects
(
:implode!
)
end
@installer
.
send
(
:clean_sandbox
)
end
...
...
@@ -159,7 +162,8 @@ module Pod
it
"correctly configures the Pod source installer"
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
pod_target
=
PodTarget
.
new
([
spec
],
nil
,
config
.
sandbox
)
pod_target
=
Target
.
new
(
'BananaLib'
)
pod_target
.
specs
=
[
spec
]
pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
@installer
.
instance_variable_set
(
:@installed_specs
,
[])
...
...
@@ -169,7 +173,8 @@ module Pod
it
"maintains the list of the installed specs"
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
pod_target
=
PodTarget
.
new
([
spec
],
nil
,
config
.
sandbox
)
pod_target
=
Target
.
new
(
'BananaLib'
)
pod_target
.
specs
=
[
spec
]
pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
,
pod_target
])
@installer
.
instance_variable_set
(
:@installed_specs
,
[])
...
...
@@ -195,7 +200,7 @@ module Pod
describe
"#refresh_file_accessors"
do
it
"refreshes the file accessors after cleaning and executing the specification hooks"
do
pod_target
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
pod_target
=
Target
.
new
(
'BananaLib'
)
file_accessor
=
stub
()
pod_target
.
file_accessors
=
[
file_accessor
]
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
...
...
@@ -209,13 +214,17 @@ module Pod
describe
"#link_headers"
do
before
do
@pod_target
=
Target
.
new
(
'BananaLib'
)
@pod_target
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
@pod_target
.
build_headers_store
=
Sandbox
::
HeadersStore
.
new
(
config
.
sandbox
,
"BuildHeaders"
)
@installer
.
stubs
(
:pod_targets
).
returns
([
@pod_target
])
end
it
"links the build headers"
do
pod_target
=
PodTarget
.
new
(
nil
,
nil
,
config
.
sandbox
)
pod_target
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
@installer
.
send
(
:link_headers
)
headers_root
=
pod_target
.
build_headers
.
root
headers_root
=
@pod_target
.
build_headers_store
.
root
public_header
=
headers_root
+
'BananaLib/Banana.h'
private_header
=
headers_root
+
'BananaLib/BananaPrivate.h'
public_header
.
should
.
exist
...
...
@@ -223,9 +232,6 @@ module Pod
end
it
"links the public headers"
do
pod_target
=
PodTarget
.
new
(
nil
,
nil
,
config
.
sandbox
)
pod_target
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
@installer
.
send
(
:link_headers
)
headers_root
=
config
.
sandbox
.
public_headers
.
root
...
...
@@ -340,7 +346,7 @@ module Pod
describe
"#integrate_user_project"
do
it
"integrates the client projects"
do
@installer
.
stubs
(
:aggregate_targets
).
returns
([
AggregateTarget
.
new
(
nil
,
config
.
sandbox
)])
@installer
.
stubs
(
:aggregate_targets
).
returns
([
Target
.
new
(
'Pods'
)])
Installer
::
UserProjectIntegrator
.
any_instance
.
expects
(
:integrate!
)
@installer
.
send
(
:integrate_user_project
)
end
...
...
@@ -384,10 +390,9 @@ module Pod
end
it
"calls the hooks in the specs for each target"
do
pod_target_ios
=
PodTarget
.
new
([
@spec
],
nil
,
config
.
sandbox
)
pod_target_osx
=
PodTarget
.
new
([
@spec
],
nil
,
config
.
sandbox
)
pod_target_ios
.
stubs
(
:name
).
returns
(
'label'
)
pod_target_osx
.
stubs
(
:name
).
returns
(
'label'
)
pod_target_ios
=
Target
.
new
(
'ios-BananaLib'
)
pod_target_osx
=
Target
.
new
(
'osx-BananaLib'
)
library_ios_rep
=
stub
()
library_osx_rep
=
stub
()
target_installer_data
=
stub
()
...
...
@@ -410,7 +415,7 @@ module Pod
it
"returns the hook representation of a pod"
do
file_accessor
=
stub
(
:spec
=>
@spec
)
@aggregate_target
.
pod_targets
.
first
.
stubs
(
:file_accessors
).
returns
([
file_accessor
])
@aggregate_target
.
children
.
first
.
stubs
(
:file_accessors
).
returns
([
file_accessor
])
rep
=
@installer
.
send
(
:pod_rep
,
'JSONKit'
)
rep
.
name
.
should
==
'JSONKit'
rep
.
root_spec
.
should
==
@spec
...
...
spec/unit/target/aggregate_target_spec.rb
deleted
100644 → 0
View file @
402d214a
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
module
Pod
describe
AggregateTarget
do
describe
"In general"
do
before
do
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
.
link_with_first_target
=
true
@target
=
AggregateTarget
.
new
(
@target_definition
,
config
.
sandbox
)
end
it
"returns the target_definition that generated it"
do
@target
.
target_definition
.
should
==
@target_definition
end
it
"returns the label of the target definition"
do
@target
.
label
.
should
==
'Pods'
end
it
"returns its name"
do
@target
.
name
.
should
==
'Pods'
end
it
"returns the name of its product"
do
@target
.
product_name
.
should
==
'libPods.a'
end
end
describe
"Pod targets"
do
before
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
pod_target
=
PodTarget
.
new
([
spec
],
target_definition
,
config
.
sandbox
)
@target
=
AggregateTarget
.
new
(
target_definition
,
config
.
sandbox
)
@target
.
stubs
(
:platform
).
returns
(
:ios
)
@target
.
pod_targets
=
[
pod_target
]
end
it
"returns the specs of the Pods used by this aggregate target"
do
@target
.
specs
.
map
(
&
:name
).
should
==
[
"BananaLib"
]
end
it
"returns the spec consumers for the pod targets"
do
consumer_reps
=
@target
.
spec_consumers
.
map
{
|
consumer
|
[
consumer
.
spec
.
name
,
consumer
.
platform_name
]
}
consumer_reps
.
should
==
[[
"BananaLib"
,
:ios
]]
end
end
end
end
spec/unit/target/pod_target_spec.rb
deleted
100644 → 0
View file @
402d214a
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
module
Pod
describe
PodTarget
do
before
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@pod_target
=
PodTarget
.
new
([
spec
],
@target_definition
,
config
.
sandbox
)
@pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
end
describe
"In general"
do
it
"returns the target_definition that generated it"
do
@pod_target
.
target_definition
.
should
==
@target_definition
end
it
"returns its name"
do
@pod_target
.
name
.
should
==
'Pods-BananaLib'
end
it
"returns the name of its product"
do
@pod_target
.
product_name
.
should
==
'libPods-BananaLib.a'
end
it
"returns the spec consumers for the pod targets"
do
@pod_target
.
spec_consumers
.
should
.
not
==
nil
end
it
"returns the root spec"
do
@pod_target
.
root_spec
.
name
.
should
==
'BananaLib'
end
it
"returns the name of the Pod"
do
@pod_target
.
pod_name
.
should
==
'BananaLib'
end
it
"returns the name of the Pods on which this target depends"
do
@pod_target
.
dependencies
.
should
==
[
"monkey"
]
end
it
"returns the dependencies as root names"
do
dependencies
=
[
stub
(
:name
=>
'monkey/subspec'
)]
Specification
::
Consumer
.
any_instance
.
stubs
(
:dependencies
).
returns
(
dependencies
)
@pod_target
.
dependencies
.
should
==
[
"monkey"
]
end
it
"never includes itself in the dependencies"
do
dependencies
=
[
stub
(
:name
=>
'BananaLib/subspec'
)]
Specification
::
Consumer
.
any_instance
.
stubs
(
:dependencies
).
returns
(
dependencies
)
@pod_target
.
dependencies
.
should
==
[]
end
end
end
end
spec/unit/target_spec.rb
View file @
23b8cd37
...
...
@@ -3,25 +3,99 @@ require File.expand_path('../../spec_helper', __FILE__)
module
Pod
describe
Target
do
before
do
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
.
link_with_first_target
=
true
@lib
=
AggregateTarget
.
new
(
@target_definition
,
config
.
sandbox
)
@sut
=
Target
.
new
(
'Pods'
,
nil
)
@child
=
Target
.
new
(
'BananaLib'
,
@sut
)
end
it
"returns the target_definition that generated it"
do
@lib
.
target_definition
.
should
==
@target_definition
#-------------------------------------------------------------------------#
describe
"In general"
do
it
"adds itself to the children of the parent"
do
@sut
.
children
.
should
==
[
@child
]
end
it
"returns the root"
do
@sut
.
root
.
should
==
@sut
@child
.
root
.
should
==
@sut
end
it
"returns the label of the target definition"
do
@lib
.
label
.
should
==
'Pods'
it
"returns whether it is root"
do
@sut
.
should
.
be
.
root
@child
.
should
.
not
.
be
.
root
end
it
"returns its name"
do
@lib
.
name
.
should
==
'Pods'
@sut
.
name
.
should
==
'Pods'
@child
.
name
.
should
==
'Pods-BananaLib'
end
it
"returns the name of its product"
do
@lib
.
product_name
.
should
==
'libPods.a'
@sut
.
product_name
.
should
==
'libPods.a'
end
end
#-------------------------------------------------------------------------#
describe
"Specs"
do
before
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
@sut
.
specs
=
[
spec
]
@sut
.
platform
=
Platform
.
ios
end
it
"returns the specs of the Pods used by this aggregate target"
do
@sut
.
specs
.
map
(
&
:name
).
should
==
[
"BananaLib"
]
end
it
"returns the spec consumers for the pod targets"
do
consumers
=
@sut
.
spec_consumers
.
map
{
|
consumer
|
[
consumer
.
spec
.
name
,
consumer
.
platform_name
]
}
consumers
.
should
==
[[
"BananaLib"
,
:ios
]]
end
it
"returns the root spec"
do
@sut
.
root_spec
.
name
.
should
==
'BananaLib'
end
it
"returns the name of the Pod"
do
@sut
.
pod_name
.
should
==
'BananaLib'
end
#----------------------------------------#
describe
"#dependencies"
do
it
"returns the name of the Pods on which this target depends"
do
@sut
.
dependencies
.
should
==
[
"monkey"
]
end
it
"returns the dependencies as root names"
do
dependencies
=
[
stub
(
:name
=>
'monkey/subspec'
)]
Specification
::
Consumer
.
any_instance
.
stubs
(
:dependencies
).
returns
(
dependencies
)
@sut
.
dependencies
.
should
==
[
"monkey"
]
end
it
"never includes itself in the dependencies"
do
dependencies
=
[
stub
(
:name
=>
'BananaLib/subspec'
)]
Specification
::
Consumer
.
any_instance
.
stubs
(
:dependencies
).
returns
(
dependencies
)
@sut
.
dependencies
.
should
==
[]
end
end
#----------------------------------------#
end
#-------------------------------------------------------------------------#
describe
"Aggregate"
do
end
#-------------------------------------------------------------------------#
describe
"Pod"
do
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