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
0aea0bef
Commit
0aea0bef
authored
May 11, 2012
by
Gwendal Roué
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#221] code cleanup
parent
5a2c29c0
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
23 deletions
+22
-23
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+2
-2
local_pod.rb
lib/cocoapods/local_pod.rb
+2
-2
sandbox.rb
lib/cocoapods/sandbox.rb
+9
-10
target_installer_spec.rb
spec/unit/installer/target_installer_spec.rb
+1
-1
local_pod_spec.rb
spec/unit/local_pod_spec.rb
+3
-3
sandbox_spec.rb
spec/unit/sandbox_spec.rb
+5
-5
No files found.
lib/cocoapods/installer/target_installer.rb
View file @
0aea0bef
...
@@ -73,7 +73,7 @@ module Pod
...
@@ -73,7 +73,7 @@ module Pod
# Indirect HEADER_SEARCH_PATHS, so that configure_build_configurations can override it
# Indirect HEADER_SEARCH_PATHS, so that configure_build_configurations can override it
xcconfig
.
merge!
(
'HEADER_SEARCH_PATHS'
=>
'${PODS_HEADER_SEARCH_PATHS}'
)
xcconfig
.
merge!
(
'HEADER_SEARCH_PATHS'
=>
'${PODS_HEADER_SEARCH_PATHS}'
)
xcconfig
.
merge!
(
'PODS_HEADER_SEARCH_PATHS'
=>
quoted
(
sandbox
.
public_header
_storage
.
search_paths
).
join
(
" "
))
xcconfig
.
merge!
(
'PODS_HEADER_SEARCH_PATHS'
=>
quoted
(
sandbox
.
public_header
s
.
search_paths
).
join
(
" "
))
support_files_group
=
@project
.
group
(
"Targets Support Files"
).
create_group
(
@target_definition
.
label
)
support_files_group
=
@project
.
group
(
"Targets Support Files"
).
create_group
(
@target_definition
.
label
)
support_files_group
.
create_files
(
target_support_files
)
support_files_group
.
create_files
(
target_support_files
)
...
@@ -89,7 +89,7 @@ module Pod
...
@@ -89,7 +89,7 @@ module Pod
config
.
build_settings
[
'OTHER_LDFLAGS'
]
=
''
config
.
build_settings
[
'OTHER_LDFLAGS'
]
=
''
config
.
build_settings
[
'GCC_PREFIX_HEADER'
]
=
@target_definition
.
prefix_header_name
config
.
build_settings
[
'GCC_PREFIX_HEADER'
]
=
@target_definition
.
prefix_header_name
config
.
build_settings
[
'PODS_ROOT'
]
=
'${SRCROOT}'
config
.
build_settings
[
'PODS_ROOT'
]
=
'${SRCROOT}'
config
.
build_settings
[
'PODS_HEADER_SEARCH_PATHS'
]
=
quoted
(
sandbox
.
build_header
_storage
.
search_paths
).
join
(
" "
)
config
.
build_settings
[
'PODS_HEADER_SEARCH_PATHS'
]
=
quoted
(
sandbox
.
build_header
s
.
search_paths
).
join
(
" "
)
end
end
end
end
...
...
lib/cocoapods/local_pod.rb
View file @
0aea0bef
...
@@ -85,10 +85,10 @@ module Pod
...
@@ -85,10 +85,10 @@ module Pod
def
link_headers
def
link_headers
copy_header_mappings
.
each
do
|
namespaced_path
,
files
|
copy_header_mappings
.
each
do
|
namespaced_path
,
files
|
@sandbox
.
build_header
_storage
.
add_files
(
namespaced_path
,
files
)
@sandbox
.
build_header
s
.
add_files
(
namespaced_path
,
files
)
end
end
copy_public_header_mappings
.
each
do
|
namespaced_path
,
files
|
copy_public_header_mappings
.
each
do
|
namespaced_path
,
files
|
@sandbox
.
public_header
_storage
.
add_files
(
namespaced_path
,
files
)
@sandbox
.
public_header
s
.
add_files
(
namespaced_path
,
files
)
end
end
end
end
...
...
lib/cocoapods/sandbox.rb
View file @
0aea0bef
...
@@ -3,17 +3,16 @@ require 'fileutils'
...
@@ -3,17 +3,16 @@ require 'fileutils'
module
Pod
module
Pod
class
Sandbox
class
Sandbox
attr_reader
:root
attr_reader
:root
attr_reader
:build_header
_storage
attr_reader
:build_header
s
attr_reader
:public_header
_storage
attr_reader
:public_header
s
PUBLIC_HEADERS_DIR
=
"Headers"
BUILD_HEADERS_DIR
=
"BuildHeaders"
BUILD_HEADERS_DIR
=
"BuildHeaders"
PUBLIC_HEADERS_DIR
=
"Headers"
def
initialize
(
path
)
def
initialize
(
path
)
@root
=
Pathname
.
new
(
path
)
@root
=
Pathname
.
new
(
path
)
@build_header_storage
=
HeaderStorage
.
new
(
self
,
BUILD_HEADERS_DIR
)
@build_headers
=
HeadersDirectory
.
new
(
self
,
BUILD_HEADERS_DIR
)
@public_header_storage
=
HeaderStorage
.
new
(
self
,
PUBLIC_HEADERS_DIR
)
@public_headers
=
HeadersDirectory
.
new
(
self
,
PUBLIC_HEADERS_DIR
)
FileUtils
.
mkdir_p
(
@root
)
FileUtils
.
mkdir_p
(
@root
)
end
end
...
@@ -26,8 +25,8 @@ module Pod
...
@@ -26,8 +25,8 @@ module Pod
end
end
def
prepare_for_install
def
prepare_for_install
build_header
_storage
.
prepare_for_install
build_header
s
.
prepare_for_install
public_header
_storage
.
prepare_for_install
public_header
s
.
prepare_for_install
end
end
def
podspec_for_name
(
name
)
def
podspec_for_name
(
name
)
...
@@ -45,7 +44,7 @@ module Pod
...
@@ -45,7 +44,7 @@ module Pod
end
end
end
end
class
Header
Storage
class
Header
sDirectory
def
initialize
(
sandbox
,
base_dir
)
def
initialize
(
sandbox
,
base_dir
)
@sandbox
=
sandbox
@sandbox
=
sandbox
@base_dir
=
base_dir
@base_dir
=
base_dir
...
@@ -57,7 +56,7 @@ module Pod
...
@@ -57,7 +56,7 @@ module Pod
end
end
def
add_file
(
namespace_path
,
relative_header_path
)
def
add_file
(
namespace_path
,
relative_header_path
)
namespaced_header_path
=
@sandbox
.
root
+
@base_dir
+
namespace_path
namespaced_header_path
=
root
+
namespace_path
namespaced_header_path
.
mkpath
unless
File
.
exist?
(
namespaced_header_path
)
namespaced_header_path
.
mkpath
unless
File
.
exist?
(
namespaced_header_path
)
source
=
(
@sandbox
.
root
+
relative_header_path
).
relative_path_from
(
namespaced_header_path
)
source
=
(
@sandbox
.
root
+
relative_header_path
).
relative_path_from
(
namespaced_header_path
)
Dir
.
chdir
(
namespaced_header_path
)
{
FileUtils
.
ln_sf
(
source
,
relative_header_path
.
basename
)}
Dir
.
chdir
(
namespaced_header_path
)
{
FileUtils
.
ln_sf
(
source
,
relative_header_path
.
basename
)}
...
...
spec/unit/installer/target_installer_spec.rb
View file @
0aea0bef
...
@@ -51,7 +51,7 @@ describe Pod::Installer::TargetInstaller do
...
@@ -51,7 +51,7 @@ describe Pod::Installer::TargetInstaller do
it
'adds the sandbox header search paths to the xcconfig, with quotes'
do
it
'adds the sandbox header search paths to the xcconfig, with quotes'
do
do_install!
do_install!
@installer
.
xcconfig
.
to_hash
[
'HEADER_SEARCH_PATHS'
].
should
.
include
(
"
\"
#{
@sandbox
.
build_header
_storage
.
search_paths
.
join
(
'" "'
)
}
\"
"
)
@installer
.
xcconfig
.
to_hash
[
'HEADER_SEARCH_PATHS'
].
should
.
include
(
"
\"
#{
@sandbox
.
build_header
s
.
search_paths
.
join
(
'" "'
)
}
\"
"
)
end
end
it
'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it'
do
it
'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it'
do
...
...
spec/unit/local_pod_spec.rb
View file @
0aea0bef
...
@@ -61,7 +61,7 @@ describe Pod::LocalPod do
...
@@ -61,7 +61,7 @@ describe Pod::LocalPod do
it
"can link it's headers into the sandbox"
do
it
"can link it's headers into the sandbox"
do
@pod
.
link_headers
@pod
.
link_headers
expected_header_path
=
@sandbox
.
build_header
_storage
.
root
+
"BananaLib/Banana.h"
expected_header_path
=
@sandbox
.
build_header
s
.
root
+
"BananaLib/Banana.h"
expected_header_path
.
should
.
be
.
symlink
expected_header_path
.
should
.
be
.
symlink
File
.
read
(
expected_header_path
).
should
==
(
@sandbox
.
root
+
@pod
.
header_files
[
0
]).
read
File
.
read
(
expected_header_path
).
should
==
(
@sandbox
.
root
+
@pod
.
header_files
[
0
]).
read
end
end
...
@@ -147,7 +147,7 @@ describe "A Pod::LocalPod, with installed source," do
...
@@ -147,7 +147,7 @@ describe "A Pod::LocalPod, with installed source," do
def
@spec
.
copy_header_mapping
(
from
)
def
@spec
.
copy_header_mapping
(
from
)
Pathname
.
new
(
'ns'
)
+
from
.
basename
Pathname
.
new
(
'ns'
)
+
from
.
basename
end
end
@spec
.
build_header
_storage
.
search_paths
.
should
==
%w{
@spec
.
build_header
s
.
search_paths
.
should
==
%w{
"$(PODS_ROOT)/Headers/SSZipArchive"
"$(PODS_ROOT)/Headers/SSZipArchive"
"$(PODS_ROOT)/Headers/SSZipArchive/ns"
"$(PODS_ROOT)/Headers/SSZipArchive/ns"
}
}
...
@@ -158,7 +158,7 @@ describe "A Pod::LocalPod, with installed source," do
...
@@ -158,7 +158,7 @@ describe "A Pod::LocalPod, with installed source," do
def
@spec
.
copy_header_mapping
(
from
)
def
@spec
.
copy_header_mapping
(
from
)
Pathname
.
new
(
'ns'
)
+
from
.
basename
Pathname
.
new
(
'ns'
)
+
from
.
basename
end
end
@spec
.
build_header
_storage
.
search_paths
.
should
==
%w{
@spec
.
build_header
s
.
search_paths
.
should
==
%w{
"$(PODS_ROOT)/Headers/AnotherRoot"
"$(PODS_ROOT)/Headers/AnotherRoot"
"$(PODS_ROOT)/Headers/AnotherRoot/ns"
"$(PODS_ROOT)/Headers/AnotherRoot/ns"
}
}
...
...
spec/unit/sandbox_spec.rb
View file @
0aea0bef
...
@@ -24,7 +24,7 @@ describe Pod::Sandbox do
...
@@ -24,7 +24,7 @@ describe Pod::Sandbox do
end
end
it
"returns it's headers root"
do
it
"returns it's headers root"
do
@sandbox
.
build_header
_storage
.
root
.
should
==
Pathname
.
new
(
File
.
join
(
TMP_POD_ROOT
,
"Headers"
))
@sandbox
.
build_header
s
.
root
.
should
==
Pathname
.
new
(
File
.
join
(
TMP_POD_ROOT
,
"Headers"
))
end
end
it
"can add namespaced headers to it's header path using symlinks and return the relative path"
do
it
"can add namespaced headers to it's header path using symlinks and return the relative path"
do
...
@@ -32,7 +32,7 @@ describe Pod::Sandbox do
...
@@ -32,7 +32,7 @@ describe Pod::Sandbox do
namespace_path
=
Pathname
.
new
(
"ExampleLib"
)
namespace_path
=
Pathname
.
new
(
"ExampleLib"
)
relative_header_path
=
Pathname
.
new
(
"ExampleLib/Headers/MyHeader.h"
)
relative_header_path
=
Pathname
.
new
(
"ExampleLib/Headers/MyHeader.h"
)
File
.
open
(
@sandbox
.
root
+
relative_header_path
,
"w"
)
{
|
file
|
file
.
write
(
'hello'
)
}
File
.
open
(
@sandbox
.
root
+
relative_header_path
,
"w"
)
{
|
file
|
file
.
write
(
'hello'
)
}
symlink_path
=
@sandbox
.
build_header
_storage
.
add_file
(
namespace_path
,
relative_header_path
)
symlink_path
=
@sandbox
.
build_header
s
.
add_file
(
namespace_path
,
relative_header_path
)
symlink_path
.
should
.
be
.
symlink
symlink_path
.
should
.
be
.
symlink
File
.
read
(
symlink_path
).
should
==
'hello'
File
.
read
(
symlink_path
).
should
==
'hello'
end
end
...
@@ -47,7 +47,7 @@ describe Pod::Sandbox do
...
@@ -47,7 +47,7 @@ describe Pod::Sandbox do
relative_header_paths
.
each
do
|
path
|
relative_header_paths
.
each
do
|
path
|
File
.
open
(
@sandbox
.
root
+
path
,
"w"
)
{
|
file
|
file
.
write
(
'hello'
)
}
File
.
open
(
@sandbox
.
root
+
path
,
"w"
)
{
|
file
|
file
.
write
(
'hello'
)
}
end
end
symlink_paths
=
@sandbox
.
build_header
_storage
.
add_files
(
namespace_path
,
relative_header_paths
)
symlink_paths
=
@sandbox
.
build_header
s
.
add_files
(
namespace_path
,
relative_header_paths
)
symlink_paths
.
each
do
|
path
|
symlink_paths
.
each
do
|
path
|
path
.
should
.
be
.
symlink
path
.
should
.
be
.
symlink
File
.
read
(
path
).
should
==
"hello"
File
.
read
(
path
).
should
==
"hello"
...
@@ -64,7 +64,7 @@ describe Pod::Sandbox do
...
@@ -64,7 +64,7 @@ describe Pod::Sandbox do
relative_header_paths
.
each
do
|
path
|
relative_header_paths
.
each
do
|
path
|
File
.
open
(
@sandbox
.
root
+
path
,
"w"
)
{
|
file
|
file
.
write
(
'hello'
)
}
File
.
open
(
@sandbox
.
root
+
path
,
"w"
)
{
|
file
|
file
.
write
(
'hello'
)
}
end
end
@sandbox
.
build_header
_storage
.
add_files
(
namespace_path
,
relative_header_paths
)
@sandbox
.
build_header
s
.
add_files
(
namespace_path
,
relative_header_paths
)
@sandbox
.
header_search_paths
.
should
.
include
(
"${PODS_ROOT}/Headers/ExampleLib"
)
@sandbox
.
header_search_paths
.
should
.
include
(
"${PODS_ROOT}/Headers/ExampleLib"
)
end
end
...
@@ -74,6 +74,6 @@ describe Pod::Sandbox do
...
@@ -74,6 +74,6 @@ describe Pod::Sandbox do
it
'clears out its headers root when preparing for install'
do
it
'clears out its headers root when preparing for install'
do
@sandbox
.
prepare_for_install
@sandbox
.
prepare_for_install
@sandbox
.
build_header
_storage
.
root
.
should
.
not
.
exist
@sandbox
.
build_header
s
.
root
.
should
.
not
.
exist
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