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
ae4e411e
Commit
ae4e411e
authored
Jun 09, 2013
by
Jeremy Slater
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update tests
parent
2719a381
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
843 additions
and
527 deletions
+843
-527
aggregate_xcconfig_spec.rb
spec/unit/generator/xcconfig/aggregate_xcconfig_spec.rb
+91
-0
private_pod_xcconfig_spec.rb
spec/unit/generator/xcconfig/private_pod_xcconfig_spec.rb
+78
-0
public_pod_xcconfig_spec.rb
spec/unit/generator/xcconfig/public_pod_xcconfig_spec.rb
+78
-0
xcconfig_spec.rb
spec/unit/generator/xcconfig_spec.rb
+0
-140
installer_representation_spec.rb
spec/unit/hooks/installer_representation_spec.rb
+4
-4
library_representation_spec.rb
spec/unit/hooks/library_representation_spec.rb
+5
-9
analyzer_spec.rb
spec/unit/installer/analyzer_spec.rb
+4
-4
file_references_installer_spec.rb
spec/unit/installer/file_references_installer_spec.rb
+12
-12
aggregate_target_installer_spec.rb
...aller/target_installer/aggregate_target_installer_spec.rb
+166
-1
pod_target_installer_spec.rb
...t/installer/target_installer/pod_target_installer_spec.rb
+229
-1
target_installer_spec.rb
spec/unit/installer/target_installer_spec.rb
+1
-285
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
-3
installer_spec.rb
spec/unit/installer_spec.rb
+49
-51
library_spec.rb
spec/unit/library_spec.rb
+3
-4
aggregate_target_spec.rb
spec/unit/target/aggregate_target_spec.rb
+80
-2
pod_target_spec.rb
spec/unit/target/pod_target_spec.rb
+40
-4
target_spec.rb
spec/unit/target_spec.rb
+0
-3
No files found.
spec/unit/generator/xcconfig/aggregate_xcconfig_spec.rb
View file @
ae4e411e
...
@@ -2,6 +2,97 @@ require File.expand_path('../../../../spec_helper', __FILE__)
...
@@ -2,6 +2,97 @@ require File.expand_path('../../../../spec_helper', __FILE__)
module
Pod
module
Pod
describe
Generator
::
AggregateXCConfig
do
describe
Generator
::
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
.
client_root
=
config
.
sandbox
.
root
.
dirname
@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
=
Generator
::
AggregateXCConfig
.
new
(
@target
)
end
it
"returns the sandbox"
do
@generator
.
sandbox
.
class
.
should
==
Sandbox
end
it
"returns the path of the pods root relative to the user project"
do
@generator
.
target
.
relative_pods_root
.
should
==
'${SRCROOT}/Pods'
end
#-----------------------------------------------------------------------#
before
do
@podfile
=
Podfile
.
new
@target
.
target_definition
.
stubs
(
:podfile
).
returns
(
@podfile
)
@xcconfig
=
@generator
.
generate
end
it
"generates the xcconfig"
do
@xcconfig
.
class
.
should
==
Xcodeproj
::
Config
end
it
"sets to always search the user paths"
do
@xcconfig
.
to_hash
[
'ALWAYS_SEARCH_USER_PATHS'
].
should
==
'YES'
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'
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
==
'${SRCROOT}/Pods'
end
it
'adds the sandbox public headers search paths to the xcconfig, with quotes'
do
expected
=
"
\"
#{
config
.
sandbox
.
public_headers
.
search_paths
.
join
(
'" "'
)
}
\"
"
@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'
end
it
'inherits the parent GCC_PREPROCESSOR_DEFINITIONS value'
do
@xcconfig
.
to_hash
[
'GCC_PREPROCESSOR_DEFINITIONS'
].
should
.
include
'$(inherited)'
end
it
'adds the pod namespaced configuration items'
do
@xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
include
(
"${
#{
@pod_target
.
xcconfig_prefix
}
OTHER_LDFLAGS}"
)
end
#-----------------------------------------------------------------------#
before
do
@path
=
temporary_directory
+
'sample.xcconfig'
@generator
.
save_as
(
@path
)
end
it
"saves the xcconfig"
do
generated
=
Xcodeproj
::
Config
.
new
(
@path
)
generated
.
class
.
should
==
Xcodeproj
::
Config
end
it
"includes the namespaced public pod xcconfig file"
do
generated
=
Xcodeproj
::
Config
.
new
(
@path
)
generated
.
includes
.
should
.
include
(
"
#{
@pod_target
.
label
}
"
)
end
end
end
end
end
spec/unit/generator/xcconfig/private_pod_xcconfig_spec.rb
View file @
ae4e411e
...
@@ -2,6 +2,84 @@ require File.expand_path('../../../../spec_helper', __FILE__)
...
@@ -2,6 +2,84 @@ require File.expand_path('../../../../spec_helper', __FILE__)
module
Pod
module
Pod
describe
Generator
::
PrivatePodXCConfig
do
describe
Generator
::
PrivatePodXCConfig
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
)
@generator
=
Generator
::
PrivatePodXCConfig
.
new
(
@pod_target
)
end
it
"returns the sandbox"
do
@generator
.
sandbox
.
class
.
should
==
Sandbox
end
#-----------------------------------------------------------------------#
before
do
@podfile
=
Podfile
.
new
@pod_target
.
target_definition
.
stubs
(
:podfile
).
returns
(
@podfile
)
@xcconfig
=
@generator
.
generate
end
it
"generates the xcconfig"
do
@xcconfig
.
class
.
should
==
Xcodeproj
::
Config
end
it
"sets to always search the user paths"
do
@xcconfig
.
to_hash
[
'ALWAYS_SEARCH_USER_PATHS'
].
should
==
'YES'
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'
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
(
'" "'
)
}
\"
"
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
end
it
'adds the COCOAPODS macro definition'
do
@xcconfig
.
to_hash
[
'GCC_PREPROCESSOR_DEFINITIONS'
].
should
.
include
'COCOAPODS=1'
end
it
'adds the pod namespaced configuration items'
do
@xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
include
(
"${
#{
@pod_target
.
xcconfig_prefix
}
OTHER_LDFLAGS}"
)
end
#-----------------------------------------------------------------------#
it
'sets the relative path of the pods root for spec libraries to ${SRCROOT}'
do
@xcconfig
.
to_hash
[
'PODS_ROOT'
].
should
==
'${SRCROOT}'
end
#-----------------------------------------------------------------------#
it
"saves the xcconfig"
do
path
=
temporary_directory
+
'sample.xcconfig'
@generator
.
save_as
(
path
)
generated
=
Xcodeproj
::
Config
.
new
(
path
)
generated
.
class
.
should
==
Xcodeproj
::
Config
end
end
end
end
end
spec/unit/generator/xcconfig/public_pod_xcconfig_spec.rb
View file @
ae4e411e
...
@@ -2,6 +2,84 @@ require File.expand_path('../../../../spec_helper', __FILE__)
...
@@ -2,6 +2,84 @@ require File.expand_path('../../../../spec_helper', __FILE__)
module
Pod
module
Pod
describe
Generator
::
PublicPodXCConfig
do
describe
Generator
::
PublicPodXCConfig
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
)
@generator
=
Generator
::
PublicPodXCConfig
.
new
(
@pod_target
)
end
it
"returns the sandbox"
do
@generator
.
sandbox
.
class
.
should
==
Sandbox
end
#-----------------------------------------------------------------------#
before
do
@podfile
=
Podfile
.
new
@pod_target
.
target_definition
.
stubs
(
:podfile
).
returns
(
@podfile
)
@spec
.
xcconfig
=
{
'OTHER_LDFLAGS'
=>
'-no_compact_unwind'
}
@spec
.
frameworks
=
[
'QuartzCore'
]
@spec
.
weak_frameworks
=
[
'iAd'
]
@spec
.
libraries
=
[
'xml2'
]
@xcconfig
=
@generator
.
generate
end
it
"generates the xcconfig"
do
@xcconfig
.
class
.
should
==
Xcodeproj
::
Config
end
it
"includes the xcconfig of the specifications"
do
@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'
)
end
it
"includes the frameworks of the specifications"
do
@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'
)
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
.
to_hash
[
"FRAMEWORK_SEARCH_PATHS"
].
should
==
'$(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
end
it
"doesn't include the developer frameworks if already present"
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
pod_target
=
PodTarget
.
new
([
@spec
,
spec
],
@target_definition
,
config
.
sandbox
)
pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
generator
=
Generator
::
PublicPodXCConfig
.
new
(
pod_target
)
@spec
.
frameworks
=
[
'SenTestingKit'
]
spec
.
frameworks
=
[
'SenTestingKit'
]
xcconfig
=
generator
.
generate
xcconfig
.
to_hash
[
"FRAMEWORK_SEARCH_PATHS"
].
should
==
'$(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
end
#-----------------------------------------------------------------------#
before
do
@path
=
temporary_directory
+
'sample.xcconfig'
@generator
.
save_as
(
@path
)
end
it
"saves the xcconfig"
do
generated
=
Xcodeproj
::
Config
.
new
(
@path
)
generated
.
class
.
should
==
Xcodeproj
::
Config
end
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
)
}
end
end
end
end
end
spec/unit/generator/xcconfig_spec.rb
View file @
ae4e411e
...
@@ -2,146 +2,6 @@ require File.expand_path('../../../spec_helper', __FILE__)
...
@@ -2,146 +2,6 @@ require File.expand_path('../../../spec_helper', __FILE__)
module
Pod
module
Pod
describe
Generator
::
XCConfig
do
describe
Generator
::
XCConfig
do
before
do
@spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
@consumer
=
@spec
.
consumer
(
:ios
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target
=
Target
.
new
(
target_definition
,
config
.
sandbox
)
@target
.
platform
=
:ios
library_definition
=
Podfile
::
TargetDefinition
.
new
(
@spec
.
name
,
target_definition
)
@library
=
Target
.
new
(
library_definition
,
config
.
sandbox
)
@library
.
spec
=
@spec
@library
.
platform
=
:ios
@target
.
libraries
=
[
@library
]
@generator
=
Generator
::
XCConfig
.
new
(
@library
,
[
@consumer
],
'./Pods'
)
end
it
"returns the sandbox"
do
@generator
.
sandbox
.
class
.
should
==
Sandbox
end
it
"returns the pods"
do
names
=
@generator
.
spec_consumers
.
should
==
[
@consumer
]
end
it
"returns the path of the pods root relative to the user project"
do
@generator
.
relative_pods_root
.
should
==
'./Pods'
end
#-----------------------------------------------------------------------#
before
do
@spec
.
xcconfig
=
{
'OTHER_LDFLAGS'
=>
'-no_compact_unwind'
}
@spec
.
frameworks
=
[
'QuartzCore'
]
@spec
.
weak_frameworks
=
[
'iAd'
]
@spec
.
libraries
=
[
'xml2'
]
@xcconfig
=
@generator
.
generate
end
it
"generates the xcconfig"
do
@xcconfig
.
class
.
should
==
Xcodeproj
::
Config
end
it
"sets to always search the user paths"
do
@xcconfig
.
to_hash
[
'ALWAYS_SEARCH_USER_PATHS'
].
should
==
'YES'
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'
end
it
'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it'
do
@xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
not
.
include
(
"-fobjc-arc"
)
end
it
'adds the -fobjc-arc to OTHER_LDFLAGS if any pods require arc (to support non-ARC projects on iOS 4.0)'
do
@generator
.
set_arc_compatibility_flag
=
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
"redirects the HEADERS_SEARCH_PATHS to the pod variable"
do
@xcconfig
.
to_hash
[
'HEADER_SEARCH_PATHS'
].
should
==
'${PODS_HEADERS_SEARCH_PATHS}'
end
it
"sets the PODS_HEADERS_SEARCH_PATHS to look for public and build headers for per spec library targets"
do
@xcconfig
.
to_hash
[
'PODS_HEADERS_SEARCH_PATHS'
].
should
==
'${PODS_BUILD_HEADERS_SEARCH_PATHS} ${PODS_PUBLIC_HEADERS_SEARCH_PATHS}'
end
it
"sets the PODS_HEADERS_SEARCH_PATHS to look for the public headers for the integration library target"
do
xcconfig
=
Generator
::
XCConfig
.
new
(
@target
,
[],
'./Pods'
).
generate
xcconfig
.
to_hash
[
'PODS_HEADERS_SEARCH_PATHS'
].
should
==
'${PODS_PUBLIC_HEADERS_SEARCH_PATHS}'
end
it
'adds the library build headers search paths to the xcconfig, with quotes'
do
expected
=
"
\"
#{
@library
.
build_headers
.
search_paths
.
join
(
'" "'
)
}
\"
"
@xcconfig
.
to_hash
[
'PODS_BUILD_HEADERS_SEARCH_PATHS'
].
should
==
expected
end
it
'adds the sandbox public headers search paths to the xcconfig, with quotes'
do
expected
=
"
\"
#{
config
.
sandbox
.
public_headers
.
search_paths
.
join
(
'" "'
)
}
\"
"
@xcconfig
.
to_hash
[
'PODS_PUBLIC_HEADERS_SEARCH_PATHS'
].
should
==
expected
end
it
'adds the COCOAPODS macro definition'
do
@xcconfig
.
to_hash
[
'GCC_PREPROCESSOR_DEFINITIONS'
].
should
==
'COCOAPODS=1'
end
it
'adds the pod namespaced configuration items'
do
@xcconfig
.
to_hash
[
'OTHER_LDFLAGS'
].
should
.
include
(
"${
#{
@library
.
xcconfig_prefix
}
OTHER_LDFLAGS}"
)
end
it
"includes the xcconfig of the specifications"
do
@xcconfig
.
to_hash
[
"
#{
@library
.
xcconfig_prefix
}
OTHER_LDFLAGS"
].
should
.
include
(
'-no_compact_unwind'
)
end
it
"includes the libraries for the specifications"
do
@xcconfig
.
to_hash
[
"
#{
@library
.
xcconfig_prefix
}
OTHER_LDFLAGS"
].
should
.
include
(
'-lxml2'
)
end
it
"includes the frameworks of the specifications"
do
@xcconfig
.
to_hash
[
"
#{
@library
.
xcconfig_prefix
}
OTHER_LDFLAGS"
].
should
.
include
(
'-framework QuartzCore'
)
end
it
"includes the weak-frameworks of the specifications"
do
@xcconfig
.
to_hash
[
"
#{
@library
.
xcconfig_prefix
}
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
.
to_hash
[
"
#{
@library
.
xcconfig_prefix
}
FRAMEWORK_SEARCH_PATHS"
].
should
==
'$(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
end
it
"doesn't include the developer frameworks if already present"
do
consumer_1
=
@spec
.
consumer
(
:ios
)
consumer_2
=
@spec
.
consumer
(
:ios
)
generator
=
Generator
::
XCConfig
.
new
(
@library
,
[
consumer_1
,
consumer_2
],
'./Pods'
)
@spec
.
frameworks
=
[
'SenTestingKit'
]
xcconfig
=
generator
.
generate
xcconfig
.
to_hash
[
"
#{
@library
.
xcconfig_prefix
}
FRAMEWORK_SEARCH_PATHS"
].
should
==
'$(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"'
end
#-----------------------------------------------------------------------#
it
'sets the relative path of the pods root for spec libraries to ${SRCROOT}'
do
@xcconfig
.
to_hash
[
'PODS_ROOT'
].
should
==
'${SRCROOT}'
end
#-----------------------------------------------------------------------#
it
"saves the xcconfig"
do
path
=
temporary_directory
+
'sample.xcconfig'
@generator
.
save_as
(
path
)
generated
=
Xcodeproj
::
Config
.
new
(
path
)
generated
.
class
.
should
==
Xcodeproj
::
Config
end
end
end
end
end
spec/unit/hooks/installer_representation_spec.rb
View file @
ae4e411e
...
@@ -16,7 +16,7 @@ module Pod
...
@@ -16,7 +16,7 @@ module Pod
config
.
integrate_targets
=
false
config
.
integrate_targets
=
false
@installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
@installer
=
Installer
.
new
(
config
.
sandbox
,
podfile
)
@installer
.
send
(
:analyze
)
@installer
.
send
(
:analyze
)
@spec
=
@installer
.
targets
.
first
.
libraries
.
map
(
&
:spec
).
first
@spec
s
=
@installer
.
targets
.
first
.
pod_targets
.
first
.
specs
@installer
.
stubs
(
:installed_specs
).
returns
(
@specs
)
@installer
.
stubs
(
:installed_specs
).
returns
(
@specs
)
@rep
=
Hooks
::
InstallerRepresentation
.
new
(
@installer
)
@rep
=
Hooks
::
InstallerRepresentation
.
new
(
@installer
)
end
end
...
@@ -40,19 +40,19 @@ module Pod
...
@@ -40,19 +40,19 @@ module Pod
end
end
it
"the hook representation of the libraries"
do
it
"the hook representation of the libraries"
do
@rep
.
libraries
.
map
(
&
:name
).
sort
.
should
==
[
'Pods
'
,
'Pods
-JSONKit'
].
sort
@rep
.
libraries
.
map
(
&
:name
).
sort
.
should
==
[
'Pods-JSONKit'
].
sort
end
end
it
"returns the specs by library representation"
do
it
"returns the specs by library representation"
do
specs_by_lib
=
@rep
.
specs_by_lib
specs_by_lib
=
@rep
.
specs_by_lib
lib_rep
=
specs_by_lib
.
keys
.
first
lib_rep
=
specs_by_lib
.
keys
.
first
lib_rep
.
name
.
should
==
'Pods-JSONKit'
lib_rep
.
name
.
should
==
'Pods-JSONKit'
specs_by_lib
.
should
==
{
lib_rep
=>
@spec
}
specs_by_lib
.
should
==
{
lib_rep
=>
@spec
s
}
end
end
it
"returns the pods representation by library representation"
do
it
"returns the pods representation by library representation"
do
pods_by_lib
=
@rep
.
pods_by_lib
pods_by_lib
=
@rep
.
pods_by_lib
target_definition
=
@installer
.
targets
.
first
.
librarie
s
.
first
.
target_definition
target_definition
=
@installer
.
targets
.
first
.
pod_target
s
.
first
.
target_definition
pods_by_lib
[
target_definition
].
map
(
&
:name
).
should
==
[
'JSONKit'
]
pods_by_lib
[
target_definition
].
map
(
&
:name
).
should
==
[
'JSONKit'
]
end
end
...
...
spec/unit/hooks/library_representation_spec.rb
View file @
ae4e411e
...
@@ -5,7 +5,9 @@ module Pod
...
@@ -5,7 +5,9 @@ module Pod
before
do
before
do
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'MyApp'
,
nil
)
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'MyApp'
,
nil
)
@lib
=
Target
.
new
(
@target_definition
,
config
.
sandbox
)
@spec
=
Spec
.
new
@spec
.
name
=
'RestKit'
@lib
=
PodTarget
.
new
([
@spec
],
@target_definition
,
config
.
sandbox
)
@rep
=
Hooks
::
LibraryRepresentation
.
new
(
config
.
sandbox
,
@lib
)
@rep
=
Hooks
::
LibraryRepresentation
.
new
(
config
.
sandbox
,
@lib
)
end
end
...
@@ -14,7 +16,7 @@ module Pod
...
@@ -14,7 +16,7 @@ module Pod
describe
"Public Hooks API"
do
describe
"Public Hooks API"
do
it
"returns the name"
do
it
"returns the name"
do
@rep
.
name
.
should
==
'Pods-MyApp'
@rep
.
name
.
should
==
'Pods-MyApp
-RestKit
'
end
end
it
"returns the dependencies"
do
it
"returns the dependencies"
do
...
@@ -27,13 +29,7 @@ module Pod
...
@@ -27,13 +29,7 @@ module Pod
end
end
it
"returns the path of the prefix header"
do
it
"returns the path of the prefix header"
do
@lib
.
support_files_root
=
temporary_directory
@rep
.
prefix_header_path
.
should
==
temporary_directory
+
'Pods/Pods-MyApp-RestKit-prefix.pch'
@rep
.
prefix_header_path
.
should
==
temporary_directory
+
'Pods-MyApp-prefix.pch'
end
it
"returns the path of the copy resources script"
do
@lib
.
support_files_root
=
temporary_directory
@rep
.
copy_resources_script_path
.
should
==
temporary_directory
+
'Pods-MyApp-resources.sh'
end
end
it
"returns the pods project"
do
it
"returns the pods project"
do
...
...
spec/unit/installer/analyzer_spec.rb
View file @
ae4e411e
...
@@ -76,11 +76,11 @@ module Pod
...
@@ -76,11 +76,11 @@ module Pod
it
"generates the libraries which represent the target definitions"
do
it
"generates the libraries which represent the target definitions"
do
target
=
@analyzer
.
analyze
.
targets
.
first
target
=
@analyzer
.
analyze
.
targets
.
first
target
.
librarie
s
.
map
(
&
:name
).
sort
.
should
==
[
target
.
pod_target
s
.
map
(
&
:name
).
sort
.
should
==
[
'Pods-JSONKit'
,
'Pods-JSONKit'
,
'Pods-AFNetworking'
,
'Pods-AFNetworking'
,
'Pods-SVPullToRefresh'
,
'Pods-SVPullToRefresh'
,
'Pods-libextobjc
-EXTKeyPathCoding
'
'Pods-libextobjc'
].
sort
].
sort
target
.
support_files_root
.
should
==
config
.
sandbox
.
root
target
.
support_files_root
.
should
==
config
.
sandbox
.
root
...
@@ -167,8 +167,8 @@ module Pod
...
@@ -167,8 +167,8 @@ module Pod
podspec
.
should
.
not
.
exist?
podspec
.
should
.
not
.
exist?
end
end
xit
"adds the specifications to the correspondent libraries in after the resolution
"
do
it
"adds the specifications to the correspondent libraries
"
do
@analyzer
.
analyze
.
targets
.
first
.
libraries
.
first
.
specs
.
map
(
&
:to_s
).
should
==
[
@analyzer
.
analyze
.
targets
.
first
.
pod_targets
.
map
(
&
:specs
).
flatten
.
map
(
&
:to_s
).
should
==
[
"AFNetworking (1.0.1)"
,
"AFNetworking (1.0.1)"
,
"JSONKit (1.5pre)"
,
"JSONKit (1.5pre)"
,
"SVPullToRefresh (0.4)"
,
"SVPullToRefresh (0.4)"
,
...
...
spec/unit/installer/file_references_installer_spec.rb
View file @
ae4e411e
...
@@ -5,10 +5,10 @@ module Pod
...
@@ -5,10 +5,10 @@ module Pod
before
do
before
do
@file_accessor
=
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)
@file_accessor
=
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)
@
library
=
Target
.
new
(
nil
,
config
.
sandbox
)
@
pod_target
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
@
library
.
file_accessors
=
[
@file_accessor
]
@
pod_target
.
file_accessors
=
[
@file_accessor
]
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
@installer
=
Installer
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
@
library
],
@project
)
@installer
=
Installer
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
@
pod_target
],
@project
)
end
end
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
...
@@ -50,7 +50,7 @@ module Pod
...
@@ -50,7 +50,7 @@ module Pod
it
"links the build headers"
do
it
"links the build headers"
do
@installer
.
install!
@installer
.
install!
headers_root
=
@
library
.
build_headers
.
root
headers_root
=
@
pod_target
.
build_headers
.
root
public_header
=
headers_root
+
'BananaLib/Banana.h'
public_header
=
headers_root
+
'BananaLib/Banana.h'
private_header
=
headers_root
+
'BananaLib/BananaPrivate.h'
private_header
=
headers_root
+
'BananaLib/BananaPrivate.h'
public_header
.
should
.
exist
public_header
.
should
.
exist
...
@@ -73,19 +73,19 @@ module Pod
...
@@ -73,19 +73,19 @@ module Pod
describe
"Private Helpers"
do
describe
"Private Helpers"
do
it
"returns the file accessors"
do
it
"returns the file accessors"
do
library_1
=
Target
.
new
(
nil
,
config
.
sandbox
)
pod_target_1
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
library
_1
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
pod_target
_1
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
library_2
=
Target
.
new
(
nil
,
config
.
sandbox
)
pod_target_2
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
library
_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
,
[
library_1
,
library
_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
}
roots
.
should
==
[
fixture
(
'banana-lib'
),
fixture
(
'banana-lib'
)]
roots
.
should
==
[
fixture
(
'banana-lib'
),
fixture
(
'banana-lib'
)]
end
end
it
"handles libraries empty libraries without file accessors"
do
it
"handles libraries empty libraries without file accessors"
do
library_1
=
Target
.
new
(
nil
,
config
.
sandbox
)
pod_target_1
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
library
_1
.
file_accessors
=
[]
pod_target
_1
.
file_accessors
=
[]
installer
=
Installer
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
library
_1
],
@project
)
installer
=
Installer
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
pod_target
_1
],
@project
)
roots
=
installer
.
send
(
:file_accessors
).
should
==
[]
roots
=
installer
.
send
(
:file_accessors
).
should
==
[]
end
end
...
...
spec/unit/installer/target_installer/aggregate_target_installer_spec.rb
View file @
ae4e411e
...
@@ -2,8 +2,173 @@ require File.expand_path('../../../../spec_helper', __FILE__)
...
@@ -2,8 +2,173 @@ require File.expand_path('../../../../spec_helper', __FILE__)
module
Pod
module
Pod
describe
Installer
::
AggregateTargetInstaller
do
describe
Installer
::
AggregateTargetInstaller
do
describe
"In General"
do
describe
"In General"
do
before
do
@podfile
=
Podfile
.
new
do
platform
:ios
xcodeproj
'dummy'
end
@target_definition
=
@podfile
.
target_definitions
[
'Pods'
]
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
config
.
sandbox
.
project
=
@project
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
@spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@project
.
add_file_references
(
file_accessor
.
source_files
,
'BananaLib'
,
@project
.
pods
)
@target
=
AggregateTarget
.
new
(
@target_definition
,
config
.
sandbox
)
@target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
))
@target
.
user_project_path
=
config
.
sandbox
.
root
+
'../user_project.xcodeproj'
@target
.
client_root
=
config
.
sandbox
.
root
.
dirname
@target
.
user_build_configurations
=
{
'Debug'
=>
:debug
,
'Release'
=>
:release
,
'AppStore'
=>
:release
,
'Test'
=>
:debug
}
@pod_target
=
PodTarget
.
new
([
@spec
],
@target_definition
,
config
.
sandbox
)
@pod_target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
))
@pod_target
.
user_build_configurations
=
@target
.
user_build_configurations
@pod_target
.
file_accessors
=
[
file_accessor
]
@target
.
pod_targets
=
[
@pod_target
]
@installer
=
Installer
::
AggregateTargetInstaller
.
new
(
config
.
sandbox
,
@target
)
@spec
.
prefix_header_contents
=
'#import "BlocksKit.h"'
end
it
"adds file references for the support files of the target"
do
@installer
.
install!
group
=
@project
.
support_files_group
[
'Pods'
]
group
.
children
.
map
(
&
:display_name
).
sort
.
should
==
[
"Pods-acknowledgements.markdown"
,
"Pods-acknowledgements.plist"
,
"Pods-dummy.m"
,
"Pods-environment.h"
,
"Pods-resources.sh"
,
"Pods.xcconfig"
]
end
#--------------------------------------#
it
'adds the target for the static library to the project'
do
@installer
.
install!
@project
.
targets
.
count
.
should
==
1
@project
.
targets
.
first
.
name
.
should
==
@target_definition
.
label
end
it
"adds the user build configurations to the target"
do
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
build_settings
(
'Test'
)[
"VALIDATE_PRODUCT"
].
should
==
nil
target
.
build_settings
(
'AppStore'
)[
"VALIDATE_PRODUCT"
].
should
==
"YES"
end
it
"sets ARCHS to 'armv6 armv7' for both configurations if the deployment target is less than 4.3 for iOS targets"
do
@target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'4.0'
))
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
build_settings
(
'Debug'
)[
"ARCHS"
].
should
==
"armv6 armv7"
target
.
build_settings
(
'Release'
)[
"ARCHS"
].
should
==
"armv6 armv7"
end
it
"uses standard ARCHs if deployment target is 4.3 or above"
do
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
build_settings
(
'Debug'
)[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
target
.
build_settings
(
'AppStore'
)[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
end
it
"sets VALIDATE_PRODUCT to YES for the Release configuration for iOS targets"
do
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
build_settings
(
'Release'
)[
"VALIDATE_PRODUCT"
].
should
==
"YES"
end
it
"sets the platform and the deployment target for iOS targets"
do
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
platform_name
.
should
==
:ios
target
.
deployment_target
.
should
==
"6.0"
target
.
build_settings
(
'Debug'
)[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"6.0"
target
.
build_settings
(
'AppStore'
)[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"6.0"
end
it
"sets the platform and the deployment target for OS X targets"
do
@target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:osx
,
'10.8'
))
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
platform_name
.
should
==
:osx
target
.
deployment_target
.
should
==
"10.8"
target
.
build_settings
(
'Debug'
)[
"MACOSX_DEPLOYMENT_TARGET"
].
should
==
"10.8"
target
.
build_settings
(
'AppStore'
)[
"MACOSX_DEPLOYMENT_TARGET"
].
should
==
"10.8"
end
it
"adds the user's build configurations to the target"
do
@installer
.
install!
@project
.
targets
.
first
.
build_configurations
.
map
(
&
:name
).
sort
.
should
==
%w{ AppStore Debug Release Test }
end
it
"it creates different hash instances for the build settings of various build configurations"
do
@installer
.
install!
build_settings
=
@project
.
targets
.
first
.
build_configurations
.
map
(
&
:build_settings
)
build_settings
.
map
(
&
:object_id
).
uniq
.
count
.
should
==
4
end
it
"does not enable the GCC_WARN_INHIBIT_ALL_WARNINGS flag by default"
do
@installer
.
install!
@installer
.
library
.
target
.
build_configurations
.
each
do
|
config
|
config
.
build_settings
[
'GCC_WARN_INHIBIT_ALL_WARNINGS'
].
should
.
be
.
nil
end
end
#--------------------------------------#
it
"creates the xcconfig file"
do
@installer
.
install!
file
=
config
.
sandbox
.
root
+
@target
.
xcconfig_path
xcconfig
=
Xcodeproj
::
Config
.
new
(
file
)
xcconfig
.
to_hash
[
'PODS_ROOT'
].
should
==
'${SRCROOT}/Pods'
end
it
"creates a header for the target which contains the information about the installed Pods"
do
@installer
.
install!
file
=
config
.
sandbox
.
root
+
'Pods-environment.h'
contents
=
file
.
read
contents
.
should
.
include?
(
'#define COCOAPODS_POD_AVAILABLE_BananaLib'
)
contents
.
should
.
include?
(
'#define COCOAPODS_VERSION_MAJOR_BananaLib 1'
)
contents
.
should
.
include?
(
'#define COCOAPODS_VERSION_MINOR_BananaLib 0'
)
contents
.
should
.
include?
(
'#define COCOAPODS_VERSION_PATCH_BananaLib 0'
)
end
it
"creates a bridge support file"
do
Podfile
.
any_instance
.
stubs
(
:generate_bridge_support?
=>
true
)
Generator
::
BridgeSupport
.
any_instance
.
expects
(
:save_as
).
once
@installer
.
install!
end
it
"creates a create copy resources script"
do
@installer
.
install!
script
=
config
.
sandbox
.
root
+
'Pods-resources.sh'
script
.
read
.
should
.
include?
(
'logo-sidebar.png'
)
end
it
"creates the acknowledgements files "
do
@installer
.
install!
markdown
=
config
.
sandbox
.
root
+
'Pods-acknowledgements.markdown'
markdown
.
read
.
should
.
include?
(
'Permission is hereby granted'
)
plist
=
config
.
sandbox
.
root
+
'Pods-acknowledgements.plist'
plist
.
read
.
should
.
include?
(
'Permission is hereby granted'
)
end
it
"creates a dummy source to ensure the creation of a single base library"
do
@installer
.
install!
build_files
=
@installer
.
library
.
target
.
source_build_phase
.
files
build_file
=
build_files
.
find
{
|
bf
|
bf
.
file_ref
.
name
==
'Pods-dummy.m'
}
build_file
.
should
.
be
.
not
.
nil
build_file
.
file_ref
.
path
.
should
==
'Pods-dummy.m'
dummy
=
config
.
sandbox
.
root
+
'Pods-dummy.m'
dummy
.
read
.
should
.
include?
(
'@interface PodsDummy_Pods'
)
end
end
end
end
end
end
end
spec/unit/installer/target_installer/pod_target_installer_spec.rb
View file @
ae4e411e
...
@@ -2,8 +2,236 @@ require File.expand_path('../../../../spec_helper', __FILE__)
...
@@ -2,8 +2,236 @@ require File.expand_path('../../../../spec_helper', __FILE__)
module
Pod
module
Pod
describe
Installer
::
PodTargetInstaller
do
describe
Installer
::
PodTargetInstaller
do
describe
"In General"
do
describe
"In General"
do
before
do
@podfile
=
Podfile
.
new
do
platform
:ios
xcodeproj
'dummy'
end
@target_definition
=
@podfile
.
target_definitions
[
'Pods'
]
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
config
.
sandbox
.
project
=
@project
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
@spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@project
.
add_file_references
(
file_accessor
.
source_files
,
'BananaLib'
,
@project
.
pods
)
@pod_target
=
PodTarget
.
new
([
@spec
],
@target_definition
,
config
.
sandbox
)
@pod_target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
))
@pod_target
.
user_build_configurations
=
{
'Debug'
=>
:debug
,
'Release'
=>
:release
,
'AppStore'
=>
:release
,
'Test'
=>
:debug
}
@pod_target
.
file_accessors
=
[
file_accessor
]
@installer
=
Installer
::
PodTargetInstaller
.
new
(
config
.
sandbox
,
@pod_target
)
@spec
.
prefix_header_contents
=
'#import "BlocksKit.h"'
end
it
"adds file references for the support files of the target"
do
@installer
.
install!
@project
.
support_files_group
group
=
@project
.
support_files_group
[
'Pods-BananaLib'
]
group
.
children
.
map
(
&
:display_name
).
sort
.
should
==
[
"Pods-BananaLib-Private.xcconfig"
,
"Pods-BananaLib-dummy.m"
,
"Pods-BananaLib-prefix.pch"
,
"Pods-BananaLib.xcconfig"
,
]
end
#--------------------------------------#
it
'adds the target for the static library to the project'
do
@installer
.
install!
@project
.
targets
.
count
.
should
==
1
@project
.
targets
.
first
.
name
.
should
==
'Pods-BananaLib'
end
it
"adds the user build configurations to the target"
do
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
build_settings
(
'Test'
)[
"VALIDATE_PRODUCT"
].
should
==
nil
target
.
build_settings
(
'AppStore'
)[
"VALIDATE_PRODUCT"
].
should
==
"YES"
end
it
"sets ARCHS to 'armv6 armv7' for both configurations if the deployment target is less than 4.3 for iOS targets"
do
@pod_target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'4.0'
))
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
build_settings
(
'Debug'
)[
"ARCHS"
].
should
==
"armv6 armv7"
target
.
build_settings
(
'Release'
)[
"ARCHS"
].
should
==
"armv6 armv7"
end
it
"uses standard ARCHs if deployment target is 4.3 or above"
do
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
build_settings
(
'Debug'
)[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
target
.
build_settings
(
'AppStore'
)[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
end
it
"sets VALIDATE_PRODUCT to YES for the Release configuration for iOS targets"
do
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
build_settings
(
'Release'
)[
"VALIDATE_PRODUCT"
].
should
==
"YES"
end
it
"sets the platform and the deployment target for iOS targets"
do
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
platform_name
.
should
==
:ios
target
.
deployment_target
.
should
==
"6.0"
target
.
build_settings
(
'Debug'
)[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"6.0"
target
.
build_settings
(
'AppStore'
)[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"6.0"
end
it
"sets the platform and the deployment target for OS X targets"
do
@pod_target
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:osx
,
'10.8'
))
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
platform_name
.
should
==
:osx
target
.
deployment_target
.
should
==
"10.8"
target
.
build_settings
(
'Debug'
)[
"MACOSX_DEPLOYMENT_TARGET"
].
should
==
"10.8"
target
.
build_settings
(
'AppStore'
)[
"MACOSX_DEPLOYMENT_TARGET"
].
should
==
"10.8"
end
it
"adds the user's build configurations to the target"
do
@installer
.
install!
@project
.
targets
.
first
.
build_configurations
.
map
(
&
:name
).
sort
.
should
==
%w{ AppStore Debug Release Test }
end
it
"it creates different hash instances for the build settings of various build configurations"
do
@installer
.
install!
build_settings
=
@project
.
targets
.
first
.
build_configurations
.
map
(
&
:build_settings
)
build_settings
.
map
(
&
:object_id
).
uniq
.
count
.
should
==
4
end
it
"does not enable the GCC_WARN_INHIBIT_ALL_WARNINGS flag by default"
do
@installer
.
install!
@installer
.
library
.
target
.
build_configurations
.
each
do
|
config
|
config
.
build_settings
[
'GCC_WARN_INHIBIT_ALL_WARNINGS'
].
should
.
be
.
nil
end
end
#--------------------------------------#
it
'adds the source files of each pod to the target of the Pod library'
do
@installer
.
install!
names
=
@installer
.
library
.
target
.
source_build_phase
.
files
.
map
{
|
bf
|
bf
.
file_ref
.
name
}
names
.
should
.
include
(
"Banana.m"
)
end
it
'adds the frameworks required by to the pod to the project for informative purposes'
do
Specification
::
Consumer
.
any_instance
.
stubs
(
:frameworks
).
returns
([
'QuartzCore'
])
@installer
.
install!
names
=
@installer
.
sandbox
.
project
[
'Frameworks'
].
children
.
map
(
&
:name
)
names
.
sort
.
should
==
[
"Foundation.framework"
,
"QuartzCore.framework"
]
end
#--------------------------------------#
it
"creates the xcconfig file"
do
@installer
.
install!
file
=
config
.
sandbox
.
root
+
@pod_target
.
xcconfig_private_path
xcconfig
=
Xcodeproj
::
Config
.
new
(
file
)
xcconfig
.
to_hash
[
'PODS_ROOT'
].
should
==
'${SRCROOT}'
end
it
"creates a prefix header, including the contents of the specification's prefix header"
do
@spec
.
prefix_header_contents
=
'#import "BlocksKit.h"'
@installer
.
install!
prefix_header
=
config
.
sandbox
.
root
+
'Pods-BananaLib-prefix.pch'
generated
=
prefix_header
.
read
expected
=
<<-
EOS
.
strip_heredoc
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#import "Pods-environment.h"
#import "BlocksKit.h"
#import <BananaTree/BananaTree.h>
EOS
generated
.
should
==
expected
end
it
"creates a dummy source to ensure the compilation of libraries with only categories"
do
@installer
.
install!
build_files
=
@installer
.
library
.
target
.
source_build_phase
.
files
build_file
=
build_files
.
find
{
|
bf
|
bf
.
file_ref
.
name
==
'Pods-BananaLib-dummy.m'
}
build_file
.
should
.
be
.
not
.
nil
build_file
.
file_ref
.
path
.
should
==
'Pods-BananaLib-dummy.m'
dummy
=
config
.
sandbox
.
root
+
'Pods-BananaLib-dummy.m'
dummy
.
read
.
should
.
include?
(
'@interface PodsDummy_Pods'
)
end
#--------------------------------------------------------------------------------#
describe
"concerning ARC before and after iOS 6.0 and OS X 10.8"
do
before
do
@spec
=
Pod
::
Spec
.
new
end
it
"does not do anything if ARC is *not* required"
do
@spec
.
requires_arc
=
false
@spec
.
ios
.
deployment_target
=
'5'
@spec
.
osx
.
deployment_target
=
'10.6'
ios_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
osx_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:osx
))
ios_flags
.
should
.
not
.
include
'-DOS_OBJECT_USE_OBJC'
osx_flags
.
should
.
not
.
include
'-DOS_OBJECT_USE_OBJC'
end
it
"does *not* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and has a deployment target of >= iOS 6.0 or OS X 10.8"
do
@spec
.
requires_arc
=
false
@spec
.
ios
.
deployment_target
=
'6'
@spec
.
osx
.
deployment_target
=
'10.8'
ios_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
osx_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:osx
))
ios_flags
.
should
.
not
.
include
'-DOS_OBJECT_USE_OBJC'
osx_flags
.
should
.
not
.
include
'-DOS_OBJECT_USE_OBJC'
end
it
"*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required but has a deployment target < iOS 6.0 or OS X 10.8"
do
@spec
.
requires_arc
=
true
@spec
.
ios
.
deployment_target
=
'5.1'
@spec
.
osx
.
deployment_target
=
'10.7.2'
ios_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
osx_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:osx
))
ios_flags
.
should
.
include
'-DOS_OBJECT_USE_OBJC'
osx_flags
.
should
.
include
'-DOS_OBJECT_USE_OBJC'
end
it
"*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and *no* deployment target is specified"
do
@spec
.
requires_arc
=
true
ios_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
osx_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:osx
))
ios_flags
.
should
.
include
'-DOS_OBJECT_USE_OBJC'
osx_flags
.
should
.
include
'-DOS_OBJECT_USE_OBJC'
end
it
"adds -w per pod if target definition inhibits warnings for that pod"
do
@installer
.
library
.
target_definition
.
stubs
(
:inhibits_warnings_for_pod?
).
returns
(
true
)
flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
flags
.
should
.
include?
(
'-w'
)
end
it
"doesn't inhibit warnings by default"
do
flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
flags
.
should
.
not
.
include?
(
'-w'
)
end
it
"adds -Xanalyzer -analyzer-disable-checker per pod"
do
@installer
.
library
.
target_definition
.
stubs
(
:inhibits_warnings_for_pod?
).
returns
(
true
)
flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
flags
.
should
.
include?
(
'-Xanalyzer -analyzer-disable-checker'
)
end
it
"doesn't inhibit analyzer warnings by default"
do
flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
flags
.
should
.
not
.
include?
(
'-Xanalyzer -analyzer-disable-checker'
)
end
end
end
end
end
end
end
end
spec/unit/installer/target_installer_spec.rb
View file @
ae4e411e
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
module
Pod
module
Pod
describe
TargetInstaller
=
Installer
::
TargetInstaller
do
describe
Installer
::
TargetInstaller
do
describe
"In General"
do
before
do
@podfile
=
Podfile
.
new
do
platform
:ios
xcodeproj
'dummy'
end
@target_definition
=
@podfile
.
target_definitions
[
'Pods'
]
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
config
.
sandbox
.
project
=
@project
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
))
@spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
file_accessor
=
Sandbox
::
FileAccessor
.
new
(
path_list
,
@spec
.
consumer
(
:ios
))
@project
.
add_file_references
(
file_accessor
.
source_files
,
'BananaLib'
,
@project
.
pods
)
@library
=
Target
.
new
(
@target_definition
,
config
.
sandbox
)
@library
.
platform
=
Platform
.
new
(
:ios
,
'6.0'
)
@library
.
support_files_root
=
config
.
sandbox
.
root
@library
.
client_root
=
config
.
sandbox
.
root
.
dirname
@library
.
user_project_path
=
config
.
sandbox
.
root
+
'../user_project.xcodeproj'
@library
.
user_build_configurations
=
{
'Debug'
=>
:debug
,
'Release'
=>
:release
,
'AppStore'
=>
:release
,
'Test'
=>
:debug
}
@library
.
spec
=
@spec
@library
.
file_accessors
=
[
file_accessor
]
@installer
=
TargetInstaller
.
new
(
config
.
sandbox
,
@library
)
@spec
.
prefix_header_contents
=
'#import "BlocksKit.h"'
end
it
"adds file references for the support files of the target"
do
@installer
.
install!
group
=
@project
.
support_files_group
[
'Pods'
]
group
.
children
.
map
(
&
:display_name
).
sort
.
should
==
[
"Pods-acknowledgements.markdown"
,
"Pods-acknowledgements.plist"
,
"Pods-dummy.m"
,
"Pods-environment.h"
,
"Pods-prefix.pch"
,
"Pods-resources.sh"
,
"Pods.xcconfig"
]
end
#--------------------------------------#
it
'adds the target for the static library to the project'
do
@installer
.
install!
@project
.
targets
.
count
.
should
==
1
@project
.
targets
.
first
.
name
.
should
==
@target_definition
.
label
end
it
"adds the user build configurations to the target"
do
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
build_settings
(
'Test'
)[
"VALIDATE_PRODUCT"
].
should
==
nil
target
.
build_settings
(
'AppStore'
)[
"VALIDATE_PRODUCT"
].
should
==
"YES"
end
it
"sets ARCHS to 'armv6 armv7' for both configurations if the deployment target is less than 4.3 for iOS targets"
do
@library
.
platform
=
Platform
.
new
(
:ios
,
'4.0'
)
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
build_settings
(
'Debug'
)[
"ARCHS"
].
should
==
"armv6 armv7"
target
.
build_settings
(
'Release'
)[
"ARCHS"
].
should
==
"armv6 armv7"
end
it
"uses standard ARCHs if deployment target is 4.3 or above"
do
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
build_settings
(
'Debug'
)[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
target
.
build_settings
(
'AppStore'
)[
"ARCHS"
].
should
==
"$(ARCHS_STANDARD_32_BIT)"
end
it
"sets VALIDATE_PRODUCT to YES for the Release configuration for iOS targets"
do
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
build_settings
(
'Release'
)[
"VALIDATE_PRODUCT"
].
should
==
"YES"
end
it
"sets the platform and the deployment target for iOS targets"
do
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
platform_name
.
should
==
:ios
target
.
deployment_target
.
should
==
"6.0"
target
.
build_settings
(
'Debug'
)[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"6.0"
target
.
build_settings
(
'AppStore'
)[
"IPHONEOS_DEPLOYMENT_TARGET"
].
should
==
"6.0"
end
it
"sets the platform and the deployment target for OS X targets"
do
@library
.
platform
=
Platform
.
new
(
:osx
,
'10.8'
)
@installer
.
install!
target
=
@project
.
targets
.
first
target
.
platform_name
.
should
==
:osx
target
.
deployment_target
.
should
==
"10.8"
target
.
build_settings
(
'Debug'
)[
"MACOSX_DEPLOYMENT_TARGET"
].
should
==
"10.8"
target
.
build_settings
(
'AppStore'
)[
"MACOSX_DEPLOYMENT_TARGET"
].
should
==
"10.8"
end
it
"adds the user's build configurations to the target"
do
@installer
.
install!
@project
.
targets
.
first
.
build_configurations
.
map
(
&
:name
).
sort
.
should
==
%w{ AppStore Debug Release Test }
end
it
"it creates different hash instances for the build settings of various build configurations"
do
@installer
.
install!
build_settings
=
@project
.
targets
.
first
.
build_configurations
.
map
(
&
:build_settings
)
build_settings
.
map
(
&
:object_id
).
uniq
.
count
.
should
==
4
end
it
"does not enable the GCC_WARN_INHIBIT_ALL_WARNINGS flag by default"
do
@installer
.
install!
@installer
.
library
.
target
.
build_configurations
.
each
do
|
config
|
config
.
build_settings
[
'GCC_WARN_INHIBIT_ALL_WARNINGS'
].
should
.
be
.
nil
end
end
#--------------------------------------#
it
'adds the source files of each pod to the target of the Pod library'
do
@installer
.
install!
names
=
@installer
.
library
.
target
.
source_build_phase
.
files
.
map
{
|
bf
|
bf
.
file_ref
.
name
}
names
.
should
.
include
(
"Banana.m"
)
end
it
'adds the frameworks required by to the pod to the project for informative purposes'
do
Specification
::
Consumer
.
any_instance
.
stubs
(
:frameworks
).
returns
([
'QuartzCore'
])
@installer
.
install!
names
=
@installer
.
sandbox
.
project
[
'Frameworks'
].
children
.
map
(
&
:name
)
names
.
sort
.
should
==
[
"Foundation.framework"
,
"QuartzCore.framework"
]
end
#--------------------------------------#
it
"creates the xcconfig file"
do
@installer
.
install!
file
=
config
.
sandbox
.
root
+
@library
.
xcconfig_path
xcconfig
=
Xcodeproj
::
Config
.
new
(
file
)
xcconfig
.
to_hash
[
'PODS_ROOT'
].
should
==
'${SRCROOT}'
end
it
"creates a header for the target which contains the information about the installed Pods"
do
target
=
Target
.
new
(
@target_definition
,
config
.
sandbox
)
lib_definition
=
Podfile
::
TargetDefinition
.
from_hash
(
@target_definition
.
to_hash
,
@target_definition
.
parent
)
lib_definition
.
name
=
'BananaLib'
library
=
Target
.
new
(
@target_definition
,
config
.
sandbox
)
target
.
platform
=
library
.
platform
=
@library
.
platform
target
.
support_files_root
=
library
.
support_files_root
=
@library
.
support_files_root
target
.
client_root
=
library
.
client_root
=
@library
.
client_root
target
.
user_project_path
=
library
.
user_project_path
=
@library
.
user_project_path
target
.
user_build_configurations
=
library
.
user_build_configurations
=
@library
.
user_build_configurations
library
.
spec
=
@library
.
spec
library
.
file_accessors
=
@library
.
file_accessors
target
.
libraries
=
[
library
]
@installer
=
TargetInstaller
.
new
(
config
.
sandbox
,
target
)
@installer
.
install!
file
=
config
.
sandbox
.
root
+
'Pods-environment.h'
contents
=
file
.
read
contents
.
should
.
include?
(
'#define COCOAPODS_POD_AVAILABLE_BananaLib'
)
contents
.
should
.
include?
(
'#define COCOAPODS_VERSION_MAJOR_BananaLib 1'
)
contents
.
should
.
include?
(
'#define COCOAPODS_VERSION_MINOR_BananaLib 0'
)
contents
.
should
.
include?
(
'#define COCOAPODS_VERSION_PATCH_BananaLib 0'
)
end
it
"creates a prefix header, including the contents of the specification's prefix header"
do
@spec
.
prefix_header_contents
=
'#import "BlocksKit.h"'
@installer
.
install!
prefix_header
=
config
.
sandbox
.
root
+
'Pods-prefix.pch'
generated
=
prefix_header
.
read
expected
=
<<-
EOS
.
strip_heredoc
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#import "Pods-environment.h"
#import "BlocksKit.h"
#import <BananaTree/BananaTree.h>
EOS
generated
.
should
==
expected
end
it
"creates a bridge support file"
do
Podfile
.
any_instance
.
stubs
(
:generate_bridge_support?
=>
true
)
Generator
::
BridgeSupport
.
any_instance
.
expects
(
:save_as
).
once
@installer
.
install!
end
it
"creates a create copy resources script"
do
@installer
.
install!
script
=
config
.
sandbox
.
root
+
'Pods-resources.sh'
script
.
read
.
should
.
include?
(
'logo-sidebar.png'
)
end
it
"creates the acknowledgements files "
do
@installer
.
install!
markdown
=
config
.
sandbox
.
root
+
'Pods-acknowledgements.markdown'
markdown
.
read
.
should
.
include?
(
'Permission is hereby granted'
)
plist
=
config
.
sandbox
.
root
+
'Pods-acknowledgements.plist'
plist
.
read
.
should
.
include?
(
'Permission is hereby granted'
)
end
it
"creates a dummy source to ensure the compilation of libraries with only categories"
do
@installer
.
install!
build_files
=
@installer
.
library
.
target
.
source_build_phase
.
files
build_file
=
build_files
.
find
{
|
bf
|
bf
.
file_ref
.
name
==
'Pods-dummy.m'
}
build_file
.
should
.
be
.
not
.
nil
build_file
.
file_ref
.
path
.
should
==
'Pods-dummy.m'
dummy
=
config
.
sandbox
.
root
+
'Pods-dummy.m'
dummy
.
read
.
should
.
include?
(
'@interface PodsDummy_Pods'
)
end
#--------------------------------------------------------------------------------#
describe
"concerning ARC before and after iOS 6.0 and OS X 10.8"
do
before
do
@spec
=
Pod
::
Spec
.
new
end
it
"does not do anything if ARC is *not* required"
do
@spec
.
requires_arc
=
false
@spec
.
ios
.
deployment_target
=
'5'
@spec
.
osx
.
deployment_target
=
'10.6'
ios_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
osx_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:osx
))
ios_flags
.
should
.
not
.
include
'-DOS_OBJECT_USE_OBJC'
osx_flags
.
should
.
not
.
include
'-DOS_OBJECT_USE_OBJC'
end
it
"does *not* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and has a deployment target of >= iOS 6.0 or OS X 10.8"
do
@spec
.
requires_arc
=
false
@spec
.
ios
.
deployment_target
=
'6'
@spec
.
osx
.
deployment_target
=
'10.8'
ios_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
osx_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:osx
))
ios_flags
.
should
.
not
.
include
'-DOS_OBJECT_USE_OBJC'
osx_flags
.
should
.
not
.
include
'-DOS_OBJECT_USE_OBJC'
end
it
"*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required but has a deployment target < iOS 6.0 or OS X 10.8"
do
@spec
.
requires_arc
=
true
@spec
.
ios
.
deployment_target
=
'5.1'
@spec
.
osx
.
deployment_target
=
'10.7.2'
ios_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
osx_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:osx
))
ios_flags
.
should
.
include
'-DOS_OBJECT_USE_OBJC'
osx_flags
.
should
.
include
'-DOS_OBJECT_USE_OBJC'
end
it
"*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and *no* deployment target is specified"
do
@spec
.
requires_arc
=
true
ios_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
osx_flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:osx
))
ios_flags
.
should
.
include
'-DOS_OBJECT_USE_OBJC'
osx_flags
.
should
.
include
'-DOS_OBJECT_USE_OBJC'
end
it
"adds -w per pod if target definition inhibits warnings for that pod"
do
@installer
.
library
.
target_definition
.
stubs
(
:inhibits_warnings_for_pod?
).
returns
(
true
)
flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
flags
.
should
.
include?
(
'-w'
)
end
it
"doesn't inhibit warnings by default"
do
flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
flags
.
should
.
not
.
include?
(
'-w'
)
end
it
"adds -Xanalyzer -analyzer-disable-checker per pod"
do
@installer
.
library
.
target_definition
.
stubs
(
:inhibits_warnings_for_pod?
).
returns
(
true
)
flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
flags
.
should
.
include?
(
'-Xanalyzer -analyzer-disable-checker'
)
end
it
"doesn't inhibit analyzer warnings by default"
do
flags
=
@installer
.
send
(
:compiler_flags_for_consumer
,
@spec
.
consumer
(
:ios
))
flags
.
should
.
not
.
include?
(
'-Xanalyzer -analyzer-disable-checker'
)
end
end
end
end
end
end
end
spec/unit/installer/user_project_integrator/target_integrator_spec.rb
View file @
ae4e411e
...
@@ -17,13 +17,10 @@ module Pod
...
@@ -17,13 +17,10 @@ module Pod
@target
=
@sample_project
.
targets
.
first
@target
=
@sample_project
.
targets
.
first
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
target_definition
.
link_with_first_target
=
true
target_definition
.
link_with_first_target
=
true
@lib
=
Target
.
new
(
target_definition
,
config
.
sandbox
)
@lib
=
Aggregate
Target
.
new
(
target_definition
,
config
.
sandbox
)
@lib
.
user_project_path
=
sample_project_path
@lib
.
user_project_path
=
sample_project_path
@lib
.
client_root
=
sample_project_path
.
dirname
@lib
.
client_root
=
sample_project_path
.
dirname
pods_project
=
Project
.
new
()
@lib
.
target
=
pods_project
.
new_target
(
:static_library
,
target_definition
.
label
,
:ios
)
@lib
.
user_target_uuids
=
[
@target
.
uuid
]
@lib
.
user_target_uuids
=
[
@target
.
uuid
]
@lib
.
support_files_root
=
config
.
sandbox
.
root
@target_integrator
=
TargetIntegrator
.
new
(
@lib
)
@target_integrator
=
TargetIntegrator
.
new
(
@lib
)
end
end
...
...
spec/unit/installer/user_project_integrator_spec.rb
View file @
ae4e411e
...
@@ -18,12 +18,11 @@ module Pod
...
@@ -18,12 +18,11 @@ module Pod
end
end
config
.
sandbox
.
project
=
Project
.
new
()
config
.
sandbox
.
project
=
Project
.
new
()
Xcodeproj
::
Project
.
new
.
save_as
(
config
.
sandbox
.
project_path
)
Xcodeproj
::
Project
.
new
.
save_as
(
config
.
sandbox
.
project_path
)
@library
=
Target
.
new
(
@podfile
.
target_definitions
[
'Pods'
],
config
.
sandbox
)
@library
=
Aggregate
Target
.
new
(
@podfile
.
target_definitions
[
'Pods'
],
config
.
sandbox
)
@library
.
client_root
=
sample_project_path
.
dirname
@library
.
client_root
=
sample_project_path
.
dirname
@library
.
user_project_path
=
sample_project_path
@library
.
user_project_path
=
sample_project_path
@library
.
user_target_uuids
=
[
'A346496C14F9BE9A0080D870'
]
@library
.
user_target_uuids
=
[
'A346496C14F9BE9A0080D870'
]
@library
.
support_files_root
=
config
.
sandbox
.
root
empty_library
=
AggregateTarget
.
new
(
@podfile
.
target_definitions
[
:empty
],
config
.
sandbox
)
empty_library
=
Target
.
new
(
@podfile
.
target_definitions
[
:empty
],
config
.
sandbox
)
@integrator
=
Installer
::
UserProjectIntegrator
.
new
(
@podfile
,
config
.
sandbox
,
temporary_directory
,
[
@library
,
empty_library
])
@integrator
=
Installer
::
UserProjectIntegrator
.
new
(
@podfile
,
config
.
sandbox
,
temporary_directory
,
[
@library
,
empty_library
])
end
end
...
...
spec/unit/installer_spec.rb
View file @
ae4e411e
...
@@ -105,16 +105,18 @@ module Pod
...
@@ -105,16 +105,18 @@ module Pod
@installer
.
analysis_result
.
sandbox_state
.
added
.
should
==
[
"JSONKit"
]
@installer
.
analysis_result
.
sandbox_state
.
added
.
should
==
[
"JSONKit"
]
end
end
it
"stores the
librarie
s created by the analyzer"
do
it
"stores the
target
s created by the analyzer"
do
@installer
.
send
(
:analyze
)
@installer
.
send
(
:analyze
)
@installer
.
libraries
.
map
(
&
:name
).
sort
.
should
==
[
'Pods'
,
'Pods-JSONKit'
].
sort
@installer
.
targets
.
map
(
&
:name
).
sort
.
should
==
[
'Pods'
]
@installer
.
pod_targets
.
map
(
&
:name
).
sort
.
should
==
[
'Pods-JSONKit'
]
end
end
it
"configures the analizer to use update mode if appropriate"
do
it
"configures the analizer to use update mode if appropriate"
do
@installer
.
update_mode
=
true
@installer
.
update_mode
=
true
Installer
::
Analyzer
.
any_instance
.
expects
(
:update_mode
=
).
with
(
true
)
Installer
::
Analyzer
.
any_instance
.
expects
(
:update_mode
=
).
with
(
true
)
@installer
.
send
(
:analyze
)
@installer
.
send
(
:analyze
)
@installer
.
libraries
.
map
(
&
:name
).
sort
.
should
==
[
'Pods'
,
'Pods-JSONKit'
].
sort
@installer
.
targets
.
map
(
&
:name
).
sort
.
should
==
[
'Pods'
]
@installer
.
pod_targets
.
map
(
&
:name
).
sort
.
should
==
[
'Pods-JSONKit'
]
end
end
end
end
...
@@ -127,15 +129,15 @@ module Pod
...
@@ -127,15 +129,15 @@ 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
()
@
libraries
=
[
Target
.
new
(
nil
,
config
.
sandbox
)]
@
pod_targets
=
[
PodTarget
.
new
([],
nil
,
config
.
sandbox
)]
@installer
.
stubs
(
:analysis_result
).
returns
(
@analysis_result
)
@installer
.
stubs
(
:analysis_result
).
returns
(
@analysis_result
)
@installer
.
stubs
(
:
libraries
).
returns
(
@librarie
s
)
@installer
.
stubs
(
:
pod_targets
).
returns
(
@pod_target
s
)
end
end
it
"cleans the header stores"
do
it
"cleans the header stores"
do
config
.
sandbox
.
public_headers
.
expects
(
:implode!
)
config
.
sandbox
.
public_headers
.
expects
(
:implode!
)
@installer
.
libraries
.
each
do
|
library
|
@installer
.
pod_targets
.
each
do
|
pods_target
|
library
.
build_headers
.
expects
(
:implode!
)
pods_target
.
build_headers
.
expects
(
:implode!
)
end
end
@installer
.
send
(
:clean_sandbox
)
@installer
.
send
(
:clean_sandbox
)
end
end
...
@@ -172,10 +174,9 @@ module Pod
...
@@ -172,10 +174,9 @@ 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'
)
library
=
Target
.
new
(
nil
,
config
.
sandbox
)
pod_target
=
PodTarget
.
new
([
spec
],
nil
,
config
.
sandbox
)
library
.
spec
=
spec
pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
library
.
platform
=
:ios
@installer
.
stubs
(
:pod_targets
).
returns
([
pod_target
])
@installer
.
stubs
(
:libraries
).
returns
([
library
])
@installer
.
instance_variable_set
(
:@installed_specs
,
[])
@installer
.
instance_variable_set
(
:@installed_specs
,
[])
Installer
::
PodSourceInstaller
.
any_instance
.
expects
(
:install!
)
Installer
::
PodSourceInstaller
.
any_instance
.
expects
(
:install!
)
@installer
.
send
(
:install_source_of_pod
,
'BananaLib'
)
@installer
.
send
(
:install_source_of_pod
,
'BananaLib'
)
...
@@ -183,9 +184,9 @@ module Pod
...
@@ -183,9 +184,9 @@ 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'
)
library
=
Target
.
new
(
nil
,
config
.
sandbox
)
pod_target
=
PodTarget
.
new
([
spec
],
nil
,
config
.
sandbox
)
library
.
spec
=
spec
pod_target
.
stubs
(
:platform
).
returns
(
:ios
)
@installer
.
stubs
(
:
libraries
).
returns
([
library
,
library
])
@installer
.
stubs
(
:
pod_targets
).
returns
([
pod_target
,
pod_target
])
@installer
.
instance_variable_set
(
:@installed_specs
,
[])
@installer
.
instance_variable_set
(
:@installed_specs
,
[])
Installer
::
PodSourceInstaller
.
any_instance
.
stubs
(
:install!
)
Installer
::
PodSourceInstaller
.
any_instance
.
stubs
(
:install!
)
@installer
.
send
(
:install_source_of_pod
,
'BananaLib'
)
@installer
.
send
(
:install_source_of_pod
,
'BananaLib'
)
...
@@ -230,11 +231,11 @@ module Pod
...
@@ -230,11 +231,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
library_ios
=
Target
.
new
(
nil
,
config
.
sandbox
)
pod_target_ios
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
library_osx
=
Target
.
new
(
nil
,
config
.
sandbox
)
pod_target_osx
=
PodTarget
.
new
([],
nil
,
config
.
sandbox
)
library_ios
.
platform
=
Platform
.
new
(
:ios
,
'6.0'
)
pod_target_ios
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:ios
,
'6.0'
)
)
library_osx
.
platform
=
Platform
.
new
(
:osx
,
'10.8'
)
pod_target_osx
.
stubs
(
:platform
).
returns
(
Platform
.
new
(
:osx
,
'10.8'
)
)
@installer
.
stubs
(
:targets
).
returns
([
library_ios
,
library
_osx
])
@installer
.
stubs
(
:targets
).
returns
([
pod_target_ios
,
pod_target
_osx
])
@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
)
build_settings
.
should
==
[
build_settings
.
should
==
[
...
@@ -249,7 +250,7 @@ module Pod
...
@@ -249,7 +250,7 @@ module Pod
describe
"#install_file_references"
do
describe
"#install_file_references"
do
it
"installs the file references"
do
it
"installs the file references"
do
@installer
.
stubs
(
:
librarie
s
).
returns
([])
@installer
.
stubs
(
:
pod_target
s
).
returns
([])
Installer
::
FileReferencesInstaller
.
any_instance
.
expects
(
:install!
)
Installer
::
FileReferencesInstaller
.
any_instance
.
expects
(
:install!
)
@installer
.
send
(
:install_file_references
)
@installer
.
send
(
:install_file_references
)
end
end
...
@@ -264,20 +265,20 @@ module Pod
...
@@ -264,20 +265,20 @@ module Pod
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
nil
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
nil
)
target_definition
.
store_pod
(
'BananaLib'
)
target_definition
.
store_pod
(
'BananaLib'
)
library
=
Target
.
new
(
target_definition
,
config
.
sandbox
)
pod_target
=
PodTarget
.
new
([
spec
],
target_definition
,
config
.
sandbox
)
library
.
spec
=
spec
@installer
.
stubs
(
:targets
).
returns
([])
@installer
.
stubs
(
:
libraries
).
returns
([
library
])
@installer
.
stubs
(
:
pod_targets
).
returns
([
pod_target
])
Installer
::
TargetInstaller
.
any_instance
.
expects
(
:install!
)
Installer
::
Pod
TargetInstaller
.
any_instance
.
expects
(
:install!
)
@installer
.
send
(
:install_libraries
)
@installer
.
send
(
:install_libraries
)
end
end
it
"skips empty
librarie
s"
do
it
"skips empty
pod target
s"
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
nil
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
:default
,
nil
)
library
=
Target
.
new
(
target_definition
,
config
.
sandbox
)
pod_target
=
PodTarget
.
new
([
spec
],
target_definition
,
config
.
sandbox
)
library
.
spec
=
spec
@installer
.
stubs
(
:targets
).
returns
([])
@installer
.
stubs
(
:
libraries
).
returns
([
library
])
@installer
.
stubs
(
:
pod_targets
).
returns
([
pod_target
])
Installer
::
TargetInstaller
.
any_instance
.
expects
(
:install!
).
never
Installer
::
Pod
TargetInstaller
.
any_instance
.
expects
(
:install!
).
never
@installer
.
send
(
:install_libraries
)
@installer
.
send
(
:install_libraries
)
end
end
...
@@ -345,29 +346,28 @@ module Pod
...
@@ -345,29 +346,28 @@ module Pod
describe
"Integrating client projects"
do
describe
"Integrating client projects"
do
it
"links the pod
libraries with th
e integration library target"
do
it
"links the pod
targets with the aggregat
e integration library target"
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
target
=
Target
.
new
(
target_definition
,
config
.
sandbox
)
target
=
Aggregate
Target
.
new
(
target_definition
,
config
.
sandbox
)
lib_definition
=
Podfile
::
TargetDefinition
.
new
(
'BananaLib'
,
nil
)
lib_definition
=
Podfile
::
TargetDefinition
.
new
(
'BananaLib'
,
nil
)
lib_definition
.
store_pod
(
'BananaLib'
)
lib_definition
.
store_pod
(
'BananaLib'
)
library
=
Target
.
new
(
lib_definition
,
config
.
sandbox
)
pod_target
=
PodTarget
.
new
([
spec
],
lib_definition
,
config
.
sandbox
)
library
.
spec
=
spec
target
.
pod_targets
=
[
pod_target
]
target
.
libraries
=
[
library
]
project
=
Xcodeproj
::
Project
.
new
project
=
Xcodeproj
::
Project
.
new
pods_target
=
project
.
new_target
(
:static_library
,
target
.
name
,
:ios
)
pods_target
=
project
.
new_target
(
:static_library
,
target
.
name
,
:ios
)
native_target
=
project
.
new_target
(
:static_library
,
library
.
name
,
:ios
)
native_target
=
project
.
new_target
(
:static_library
,
pod_target
.
name
,
:ios
)
@installer
.
stubs
(
:pods_project
).
returns
(
project
)
@installer
.
stubs
(
:pods_project
).
returns
(
project
)
@installer
.
stubs
(
:targets
).
returns
([
target
])
@installer
.
stubs
(
:targets
).
returns
([
target
])
@installer
.
stubs
(
:
libraries
).
returns
([
library
])
@installer
.
stubs
(
:
pod_targets
).
returns
([
pod_target
])
@installer
.
send
(
:link_integration_libraries
)
@installer
.
send
(
:link_integration_libraries
)
pods_target
.
frameworks_build_phase
.
files
.
map
(
&
:display_name
).
should
.
include?
(
library
.
product_name
)
pods_target
.
frameworks_build_phase
.
files
.
map
(
&
:display_name
).
should
.
include?
(
pod_target
.
product_name
)
end
end
it
"integrates the client projects"
do
it
"integrates the client projects"
do
@installer
.
stubs
(
:
libraries
).
returns
([
Target
.
new
(
nil
,
config
.
sandbox
)])
@installer
.
stubs
(
:
targets
).
returns
([
Aggregate
Target
.
new
(
nil
,
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
...
@@ -380,10 +380,10 @@ module Pod
...
@@ -380,10 +380,10 @@ module Pod
before
do
before
do
@installer
.
send
(
:analyze
)
@installer
.
send
(
:analyze
)
@specs
=
@installer
.
libraries
.
map
(
&
:spec
)
@specs
=
@installer
.
pod_targets
.
map
(
&
:specs
).
flatten
@spec
=
@specs
.
find
{
|
spec
|
spec
&&
spec
.
name
==
'JSONKit'
}
@spec
=
@specs
.
find
{
|
spec
|
spec
&&
spec
.
name
==
'JSONKit'
}
@installer
.
stubs
(
:installed_specs
).
returns
(
@specs
)
@installer
.
stubs
(
:installed_specs
).
returns
(
@specs
)
@lib
=
@installer
.
targets
.
first
.
librarie
s
.
first
@lib
=
@installer
.
targets
.
first
.
pod_target
s
.
first
end
end
it
"runs the pre install hooks"
do
it
"runs the pre install hooks"
do
...
@@ -411,19 +411,17 @@ module Pod
...
@@ -411,19 +411,17 @@ module Pod
end
end
it
"calls the hooks in the specs for each target"
do
it
"calls the hooks in the specs for each target"
do
library_ios
=
Target
.
new
(
nil
,
config
.
sandbox
)
pod_target_ios
=
PodTarget
.
new
([
@spec
],
nil
,
config
.
sandbox
)
library_osx
=
Target
.
new
(
nil
,
config
.
sandbox
)
pod_target_osx
=
PodTarget
.
new
([
@spec
],
nil
,
config
.
sandbox
)
library_ios
.
spec
=
@spec
pod_target_ios
.
stubs
(
:name
).
returns
(
'label'
)
library_osx
.
spec
=
@spec
pod_target_osx
.
stubs
(
:name
).
returns
(
'label'
)
library_ios
.
stubs
(
:name
).
returns
(
'label'
)
library_osx
.
stubs
(
:name
).
returns
(
'label'
)
library_ios_rep
=
stub
()
library_ios_rep
=
stub
()
library_osx_rep
=
stub
()
library_osx_rep
=
stub
()
@installer
.
stubs
(
:
libraries
).
returns
([
library_ios
,
library
_osx
])
@installer
.
stubs
(
:
pod_targets
).
returns
([
pod_target_ios
,
pod_target
_osx
])
@installer
.
stubs
(
:installer_rep
).
returns
(
stub
())
@installer
.
stubs
(
:installer_rep
).
returns
(
stub
())
@installer
.
stubs
(
:library_rep
).
with
(
library
_ios
).
returns
(
library_ios_rep
)
@installer
.
stubs
(
:library_rep
).
with
(
pod_target
_ios
).
returns
(
library_ios_rep
)
@installer
.
stubs
(
:library_rep
).
with
(
library
_osx
).
returns
(
library_osx_rep
)
@installer
.
stubs
(
:library_rep
).
with
(
pod_target
_osx
).
returns
(
library_osx_rep
)
@installer
.
podfile
.
expects
(
:pre_install!
)
@installer
.
podfile
.
expects
(
:pre_install!
)
@spec
.
expects
(
:post_install!
).
with
(
library_ios_rep
)
@spec
.
expects
(
:post_install!
).
with
(
library_ios_rep
)
...
@@ -458,10 +456,10 @@ module Pod
...
@@ -458,10 +456,10 @@ module Pod
it
"returns the hook representation of all the target installers"
do
it
"returns the hook representation of all the target installers"
do
reps
=
@installer
.
send
(
:library_reps
)
reps
=
@installer
.
send
(
:library_reps
)
reps
.
map
(
&
:name
).
sort
.
should
==
[
'Pods
'
,
'Pods
-JSONKit'
].
sort
reps
.
map
(
&
:name
).
sort
.
should
==
[
'Pods-JSONKit'
].
sort
end
end
it
"returns the
librarie
s which use a given Pod"
do
it
"returns the
target
s which use a given Pod"
do
libs
=
@installer
.
send
(
:libraries_using_spec
,
@spec
)
libs
=
@installer
.
send
(
:libraries_using_spec
,
@spec
)
libs
.
map
(
&
:name
).
should
==
[
'Pods-JSONKit'
]
libs
.
map
(
&
:name
).
should
==
[
'Pods-JSONKit'
]
end
end
...
...
spec/unit/library_spec.rb
View file @
ae4e411e
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
module
Pod
module
Pod
describe
Pod
::
Target
do
describe
Pod
::
Aggregate
Target
do
describe
"In general"
do
describe
"In general"
do
before
do
before
do
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
.
link_with_first_target
=
true
@target_definition
.
link_with_first_target
=
true
@lib
=
Target
.
new
(
@target_definition
,
config
.
sandbox
)
@lib
=
Aggregate
Target
.
new
(
@target_definition
,
config
.
sandbox
)
end
end
it
"returns the target_definition that generated it"
do
it
"returns the target_definition that generated it"
do
...
@@ -31,8 +31,7 @@ module Pod
...
@@ -31,8 +31,7 @@ module Pod
before
do
before
do
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
.
link_with_first_target
=
true
@target_definition
.
link_with_first_target
=
true
@lib
=
Target
.
new
(
@target_definition
,
config
.
sandbox
)
@lib
=
AggregateTarget
.
new
(
@target_definition
,
config
.
sandbox
)
@lib
.
support_files_root
=
config
.
sandbox
.
root
@lib
.
client_root
=
config
.
sandbox
.
root
.
dirname
@lib
.
client_root
=
config
.
sandbox
.
root
.
dirname
end
end
...
...
spec/unit/target/aggregate_target_spec.rb
View file @
ae4e411e
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
module
Pod
module
Pod
describe
AggregateTarget
do
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
end
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
"Support files"
do
before
do
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'Pods'
,
nil
)
@target_definition
.
link_with_first_target
=
true
@target
=
AggregateTarget
.
new
(
@target_definition
,
config
.
sandbox
)
@target
.
client_root
=
config
.
sandbox
.
root
.
dirname
end
it
"returns the absolute path of the xcconfig file"
do
@target
.
xcconfig_path
.
to_s
.
should
.
include?
(
'Pods/Pods.xcconfig'
)
end
it
"returns the absolute path of the resources script"
do
@target
.
copy_resources_script_path
.
to_s
.
should
.
include?
(
'Pods/Pods-resources.sh'
)
end
it
"returns the absolute path of the target header file"
do
@target
.
target_environment_header_path
.
to_s
.
should
.
include?
(
'Pods/Pods-environment.h'
)
end
it
"returns the absolute path of the prefix header file"
do
@target
.
prefix_header_path
.
to_s
.
should
.
include?
(
'Pods/Pods-prefix.pch'
)
end
it
"returns the absolute path of the bridge support file"
do
@target
.
bridge_support_path
.
to_s
.
should
.
include?
(
'Pods/Pods.bridgesupport'
)
end
it
"returns the absolute path of the acknowledgements files without extension"
do
@target
.
acknowledgements_basepath
.
to_s
.
should
.
include?
(
'Pods/Pods-acknowledgements'
)
end
#--------------------------------------#
it
"returns the path of the resources script relative to the user project"
do
@target
.
copy_resources_script_relative_path
.
should
==
'${SRCROOT}/Pods/Pods-resources.sh'
end
it
"returns the path of the xcconfig file relative to the user project"
do
@target
.
xcconfig_relative_path
.
should
==
'Pods/Pods.xcconfig'
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 spec consumers for the pod targets"
do
@target
.
spec_consumers
.
should
.
not
==
nil
end
end
end
end
spec/unit/target/pod_target_spec.rb
View file @
ae4e411e
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
module
Pod
module
Pod
describe
PodTarget
do
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
xit
"returns the label for the target"
do
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
end
xit
"returns the consumer of the spec"
do
it
"returns the spec consumers for the pod targets"
do
@pod_target
.
spec_consumers
.
should
.
not
==
nil
end
end
describe
"Support files"
do
it
"returns the absolute path of the xcconfig file"
do
@pod_target
.
xcconfig_path
.
to_s
.
should
.
include
'Pods/Pods-BananaLib.xcconfig'
end
end
it
"returns the absolute path of the target header file"
do
@pod_target
.
target_environment_header_path
.
to_s
.
should
.
include
'Pods/Pods-environment.h'
end
end
end
it
"returns the absolute path of the prefix header file"
do
@pod_target
.
prefix_header_path
.
to_s
.
should
.
include
'Pods/Pods-BananaLib-prefix.pch'
end
it
"returns the absolute path of the bridge support file"
do
@pod_target
.
bridge_support_path
.
to_s
.
should
.
include
'Pods/Pods-BananaLib.bridgesupport'
end
it
"returns the absolute path of the public and private xcconfig files"
do
@pod_target
.
xcconfig_path
.
to_s
.
should
.
include
'Pods/Pods-BananaLib.xcconfig'
@pod_target
.
xcconfig_private_path
.
to_s
.
should
.
include
'Pods/Pods-BananaLib-Private.xcconfig'
end
end
end
end
spec/unit/target_spec.rb
View file @
ae4e411e
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
module
Pod
module
Pod
describe
Target
do
describe
Target
do
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment