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
587ee30a
Commit
587ee30a
authored
Feb 18, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement disabled specs
parent
82f47ffc
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
158 additions
and
75 deletions
+158
-75
file_references_installer.rb
lib/cocoapods/installer/file_references_installer.rb
+15
-5
pod_source_installer.rb
lib/cocoapods/installer/pod_source_installer.rb
+1
-0
target_installer.rb
lib/cocoapods/installer/target_installer.rb
+1
-1
file_accessor.rb
lib/cocoapods/sandbox/file_accessor.rb
+2
-1
headers_store.rb
lib/cocoapods/sandbox/headers_store.rb
+1
-1
path_list.rb
lib/cocoapods/sandbox/path_list.rb
+15
-13
validator.rb
lib/cocoapods/validator.rb
+15
-6
file_references_installer_spec.rb
spec/unit/installer/file_references_installer_spec.rb
+47
-7
pod_source_installer_spec.rb
spec/unit/installer/pod_source_installer_spec.rb
+45
-22
target_installer_spec.rb
spec/unit/installer/target_installer_spec.rb
+6
-7
installer_spec.rb
spec/unit/installer_spec.rb
+1
-1
validator_spec.rb
spec/unit/validator_spec.rb
+9
-11
No files found.
lib/cocoapods/installer/file_references_installer.rb
View file @
587ee30a
...
...
@@ -105,11 +105,11 @@ module Pod
sandbox
.
public_headers
.
add_search_path
(
headers_sandbox
)
consumer
=
file_accessor
.
spec_consumer
header_mappings
(
headers_sandbox
,
consumer
,
file_accessor
.
headers
,
file_accessor
.
path_list
.
root
).
each
do
|
namespaced_path
,
files
|
header_mappings
(
headers_sandbox
,
consumer
,
file_accessor
.
headers
).
each
do
|
namespaced_path
,
files
|
sandbox
.
build_headers
.
add_files
(
namespaced_path
,
files
)
end
header_mappings
(
headers_sandbox
,
consumer
,
file_accessor
.
public_headers
,
file_accessor
.
path_list
.
root
).
each
do
|
namespaced_path
,
files
|
header_mappings
(
headers_sandbox
,
consumer
,
file_accessor
.
public_headers
).
each
do
|
namespaced_path
,
files
|
sandbox
.
public_headers
.
add_files
(
namespaced_path
,
files
)
end
end
...
...
@@ -131,7 +131,15 @@ module Pod
# Computes the destination sub-directory in the sandbox
#
# @param []
# @param [Pathname] headers_sandbox
# The sandbox where the headers links should be stored for this
# Pod.
#
# @param [Specification::Consumer] consumer
# The consumer for which the headers need to be linked.
#
# @param [Array<Pathname>] headers
# The absolute paths of the headers which need to be mapped.
#
# @return [Hash{Pathname => Array<Pathname>}] A hash containing the
# headers folders as the keys and the absolute paths of the
...
...
@@ -140,7 +148,7 @@ module Pod
# TODO This is being overridden in the RestKit 0.9.4 spec and that
# override should be fixed.
#
def
header_mappings
(
headers_sandbox
,
consumer
,
headers
,
root
)
def
header_mappings
(
headers_sandbox
,
consumer
,
headers
)
dir
=
headers_sandbox
dir
=
dir
+
consumer
.
header_dir
if
consumer
.
header_dir
...
...
@@ -148,7 +156,9 @@ module Pod
headers
.
each
do
|
header
|
sub_dir
=
dir
if
consumer
.
header_mappings_dir
sub_dir
=
sub_dir
+
header
.
relative_path_from
(
consumer
.
header_mappings_dir
).
dirname
header_mappings_dir
=
Pathname
.
new
(
consumer
.
header_mappings_dir
)
relative_path
=
header
.
relative_path_from
(
header_mappings_dir
)
sub_dir
=
sub_dir
+
relative_path
.
dirname
end
mappings
[
sub_dir
]
||=
[]
mappings
[
sub_dir
]
<<
header
...
...
lib/cocoapods/installer/pod_source_installer.rb
View file @
587ee30a
...
...
@@ -279,6 +279,7 @@ module Pod
]
files
.
compact!
files
.
flatten!
files
.
uniq!
files
.
map!
{
|
path
|
path
.
to_s
}
files
.
reject!
{
|
path
|
path
==
""
}
#TODO
files
...
...
lib/cocoapods/installer/target_installer.rb
View file @
587ee30a
...
...
@@ -346,7 +346,7 @@ module Pod
# For more information, see: http://opensource.apple.com/source/libdispatch/libdispatch-228.18/os/object.h
#
# @param [Specification::Consumer] consumer
# The consumer for the specification for wich the compiler flags
# The consumer for the specification for w
h
ich the compiler flags
# are needed.
#
# @return [String] The compiler flags.
...
...
lib/cocoapods/sandbox/file_accessor.rb
View file @
587ee30a
...
...
@@ -160,7 +160,8 @@ module Pod
globs
[
attrbute
]
end
# Matches the given patterns to the file present in the root of the path list.
# Matches the given patterns to the file present in the root of the path
# list.
#
# @param [Array<String, FileList>] patterns
# The patterns to expand.
...
...
lib/cocoapods/sandbox/headers_store.rb
View file @
587ee30a
...
...
@@ -60,7 +60,7 @@ module Pod
# @param [Pathname] relative_header_path
# the path of the header file relative to the sandbox.
#
# @note This method adds the files
are added
to the search paths.
# @note This method adds the files to the search paths.
#
# @return [Pathname]
#
...
...
lib/cocoapods/sandbox/path_list.rb
View file @
587ee30a
...
...
@@ -48,12 +48,12 @@ module Pod
end
root_length
=
root
.
to_s
.
length
+
1
paths
=
Dir
.
glob
(
root
+
"**/*"
,
File
::
FNM_DOTMATCH
)
paths
=
paths
.
reject
{
|
p
|
p
==
"
#{
root
}
/."
||
p
==
"
#{
root
}
/.."
}
dirs
=
paths
.
select
{
|
path
|
File
.
directory?
(
path
)
}
dirs
=
dirs
.
map
{
|
p
|
p
[
root_length
..-
1
]
}
paths
=
paths
.
map
{
|
p
|
p
[
root_length
..-
1
]
}
@files
=
paths
-
dirs
@dirs
=
dirs
.
map
{
|
d
|
d
.
gsub
(
/\/\.\.?$/
,
''
)
}.
uniq
absolute_dirs
=
paths
.
select
{
|
path
|
File
.
directory?
(
path
)
}
relative_dirs
=
absolute_dirs
.
map
{
|
p
|
p
[
root_length
..-
1
]
}
absolute_paths
=
paths
.
reject
{
|
p
|
p
==
"
#{
root
}
/."
||
p
==
"
#{
root
}
/.."
}
relative_paths
=
absolute_
paths
.
map
{
|
p
|
p
[
root_length
..-
1
]
}
@files
=
relative_paths
-
relative_
dirs
@dirs
=
relative_
dirs
.
map
{
|
d
|
d
.
gsub
(
/\/\.\.?$/
,
''
)
}.
uniq
end
#-----------------------------------------------------------------------#
...
...
@@ -82,9 +82,8 @@ module Pod
#
def
relative_glob
(
patterns
,
dir_pattern
=
nil
,
exclude_patterns
=
nil
)
return
[]
if
patterns
.
empty?
patterns
=
[
patterns
]
if
patterns
.
is_a?
String
list
=
patterns
.
map
do
|
pattern
|
list
=
Array
(
patterns
)
.
map
do
|
pattern
|
if
pattern
.
is_a?
(
String
)
pattern
+=
'/'
+
dir_pattern
if
directory?
(
pattern
)
&&
dir_pattern
expanded_patterns
=
dir_glob_equivalent_patterns
(
pattern
)
...
...
@@ -152,15 +151,18 @@ module Pod
else
patterns
=
[
pattern
]
values_by_set
.
each
do
|
set
,
values
|
patterns
=
patterns
.
map
do
|
pattern
|
patterns
=
patterns
.
map
do
|
old_
pattern
|
values
.
map
do
|
value
|
pattern
.
gsub
(
set
,
value
)
old_
pattern
.
gsub
(
set
,
value
)
end
end
.
flatten
end
patterns
end
end
end
# PathList
end
# LocalPod
end
# Pod
#-----------------------------------------------------------------------#
end
end
end
lib/cocoapods/validator.rb
View file @
587ee30a
...
...
@@ -253,8 +253,7 @@ module Pod
UI
.
warn
"Skipping compilation with `xcodebuild' because it can't be found.
\n
"
.
yellow
else
UI
.
message
"
\n
Building with xcodebuild.
\n
"
.
yellow
do
messages
=
[]
output
=
Dir
.
chdir
(
config
.
sandbox_root
)
{
`xcodebuild clean build 2>&1`
}
output
=
Dir
.
chdir
(
config
.
sandbox_root
)
{
xcodebuild
}
UI
.
puts
output
parsed_output
=
parse_xcodebuild_output
(
output
)
parsed_output
.
each
do
|
message
|
...
...
@@ -276,10 +275,10 @@ module Pod
#
def
check_file_patterns
[
:source_files
,
:resources
,
:preserve_paths
].
each
do
|
attr_name
|
attr
=
Specification
::
DSL
.
attributes
.
values
.
find
{
|
attr
|
attr
.
name
==
attr_name
}
# if !attr.empty?(spec)
&& file_accessor.send(attr_name).empty?
#
error "The `#{attr_name}` pattern did not match any file."
#
end
# file_
attr = Specification::DSL.attributes.values.find{|attr| attr.name == attr_name }
if
!
file_accessor
.
spec_consumer
.
send
(
attr_name
).
empty?
&&
file_accessor
.
send
(
attr_name
).
empty?
error
"The `
#{
attr_name
}
` pattern did not match any file."
end
end
unless
file_accessor
.
license
||
spec
.
license
&&
(
spec
.
license
[
:type
]
==
'Public Domain'
||
spec
.
license
[
:text
]
)
...
...
@@ -364,5 +363,15 @@ module Pod
new
.
gsub!
(
/^ */
,
' '
)
end
end
# @return [String] Executes xcodebuild in the current working directory and
# returns its output (bot STDOUT and STDERR).
#
def
xcodebuild
`xcodebuild clean build 2>&1`
end
#-------------------------------------------------------------------------#
end
end
spec/unit/installer/file_references_installer_spec.rb
View file @
587ee30a
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
module
Pod
describe
Installer
::
PodSource
Installer
do
describe
Installer
::
FileReferences
Installer
do
before
do
file_accessor
=
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)
@
file_accessor
=
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)
@library
=
Library
.
new
(
nil
)
@library
.
file_accessors
=
[
file_accessor
]
@library
.
file_accessors
=
[
@
file_accessor
]
@project
=
Project
.
new
(
config
.
sandbox
.
project_path
)
@installer
=
Installer
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
@library
],
@project
)
end
...
...
@@ -54,7 +54,7 @@ module Pod
it
"links the public headers"
do
@installer
.
install!
headers_root
=
config
.
sandbox
.
public_headers
.
root
public_header
=
headers_root
+
'BananaLib/Banana.h'
public_header
=
headers_root
+
'BananaLib/Banana.h'
private_header
=
headers_root
+
'BananaLib/BananaPrivate.h'
public_header
.
should
.
exist
private_header
.
should
.
not
.
exist
...
...
@@ -66,17 +66,57 @@ module Pod
describe
"Private Helpers"
do
xit
"returns the uniqu
e file accessors"
do
it
"returns th
e file accessors"
do
library_1
=
Library
.
new
(
nil
)
library_1
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
library_2
=
Library
.
new
(
nil
)
library_2
.
file_accessors
=
[
fixture_file_accessor
(
'banana-lib/BananaLib.podspec'
)]
installer
=
Installer
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
library_1
,
library_2
],
@project
)
installer
.
send
(
:file_accessors
).
count
.
should
==
1
roots
=
installer
.
send
(
:file_accessors
).
map
{
|
fa
|
fa
.
path_list
.
root
}
roots
.
should
==
[
fixture
(
'banana-lib'
),
fixture
(
'banana-lib'
)]
end
it
"handles libraries empty libraries without file accessors"
do
library_1
=
Library
.
new
(
nil
)
library_1
.
file_accessors
=
[]
installer
=
Installer
::
FileReferencesInstaller
.
new
(
config
.
sandbox
,
[
library_1
],
@project
)
roots
=
installer
.
send
(
:file_accessors
).
should
==
[]
end
xit
"handles libraries without pods and hence without file accessors"
do
it
"returns the header mappings"
do
headers_sandbox
=
Pathname
.
new
(
'BananaLib'
)
consumer
=
@file_accessor
.
spec_consumer
headers
=
[
Pathname
.
new
(
'BananaLib/Banana.h'
)]
mappings
=
@installer
.
send
(
:header_mappings
,
headers_sandbox
,
consumer
,
headers
)
mappings
.
should
==
{
headers_sandbox
=>
[
Pathname
.
new
(
'BananaLib/Banana.h'
)]
}
end
it
"takes into account the header dir specified in the spec"
do
headers_sandbox
=
Pathname
.
new
(
'BananaLib'
)
consumer
=
@file_accessor
.
spec_consumer
headers
=
[
Pathname
.
new
(
'BananaLib/Banana.h'
)]
consumer
.
stubs
(
:header_dir
).
returns
(
'Sub_dir'
)
mappings
=
@installer
.
send
(
:header_mappings
,
headers_sandbox
,
consumer
,
headers
)
mappings
.
should
==
{
(
headers_sandbox
+
'Sub_dir'
)
=>
[
Pathname
.
new
(
'BananaLib/Banana.h'
)]
}
end
it
"takes into account the header mappings dir specified in the spec"
do
headers_sandbox
=
Pathname
.
new
(
'BananaLib'
)
consumer
=
@file_accessor
.
spec_consumer
headers
=
[
Pathname
.
new
(
'BananaLib/sub_dir/dir_1/banana_1.h'
),
Pathname
.
new
(
'BananaLib/sub_dir/dir_2/banana_2.h'
),
]
consumer
.
stubs
(
:header_mappings_dir
).
returns
(
'BananaLib/sub_dir'
)
mappings
=
@installer
.
send
(
:header_mappings
,
headers_sandbox
,
consumer
,
headers
)
mappings
.
should
==
{
(
headers_sandbox
+
'dir_1'
)
=>
[
Pathname
.
new
(
'BananaLib/sub_dir/dir_1/banana_1.h'
)],
(
headers_sandbox
+
'dir_2'
)
=>
[
Pathname
.
new
(
'BananaLib/sub_dir/dir_2/banana_2.h'
)],
}
end
end
...
...
spec/unit/installer/pod_source_installer_spec.rb
View file @
587ee30a
...
...
@@ -154,40 +154,63 @@ module Pod
#--------------------------------------#
describe
"Specifications details"
do
xit
"handles Pods which return different file patterns per platform"
do
end
xit
"handles Pods with multiple subspecs activated"
do
end
end
end
#-------------------------------------------------------------------------#
describe
"Private Helpers"
do
x
it
"returns the clean paths"
do
it
"returns the clean paths"
do
@installer
.
send
(
:download_source
)
@installer
.
send
(
:clean_paths
).
should
==
[]
paths
=
@installer
.
send
(
:clean_paths
)
relative_paths
=
paths
.
map
{
|
p
|
p
.
gsub
(
"
#{
temporary_directory
}
/"
,
''
)}
paths_without_git
=
relative_paths
.
reject
{
|
p
|
p
.
include?
'Pods/BananaLib/.git'
}
paths_without_git
.
sort
.
should
==
[
"Pods/BananaLib/BananaLib.podspec"
,
"Pods/BananaLib/libPusher"
,
"Pods/BananaLib/sub-dir"
,
"Pods/BananaLib/sub-dir/sub-dir-2"
,
"Pods/BananaLib/sub-dir/sub-dir-2/somefile.txt"
]
end
x
it
"returns the used files"
do
it
"returns the used files"
do
@installer
.
send
(
:download_source
)
@installer
.
send
(
:used_files
).
should
==
[]
paths
=
@installer
.
send
(
:used_files
)
relative_paths
=
paths
.
map
{
|
p
|
p
.
gsub
(
"
#{
temporary_directory
}
/"
,
''
)}
relative_paths
.
sort
.
should
==
[
"Pods/BananaLib/Classes/Banana.h"
,
"Pods/BananaLib/Classes/Banana.m"
,
"Pods/BananaLib/Classes/BananaLib.pch"
,
"Pods/BananaLib/Classes/BananaPrivate.h"
,
"Pods/BananaLib/LICENSE"
,
"Pods/BananaLib/README"
,
"Pods/BananaLib/Resources/logo-sidebar.png"
]
end
xit
"returns the header mappings"
do
end
xit
"returns the header mappings including subspecs"
do
it
"handles Pods with multiple file accessors"
do
spec
=
fixture_spec
(
'banana-lib/BananaLib.podspec'
)
spec
.
source
=
{
:git
=>
SpecHelper
.
fixture
(
'banana-lib'
)
}
spec
.
source_files
=
[]
spec
.
ios
.
source_files
=
'Classes/*.h'
spec
.
osx
.
source_files
=
'Classes/*.m'
ios_spec
=
spec
.
dup
osx_spec
=
spec
.
dup
specs_by_platform
=
{
:ios
=>
[
ios_spec
],
:osx
=>
[
osx_spec
]
}
@installer
=
Installer
::
PodSourceInstaller
.
new
(
config
.
sandbox
,
specs_by_platform
)
@installer
.
send
(
:download_source
)
paths
=
@installer
.
send
(
:used_files
)
relative_paths
=
paths
.
map
{
|
p
|
p
.
gsub
(
"
#{
temporary_directory
}
/"
,
''
)}
relative_paths
.
sort
.
should
==
[
"Pods/BananaLib/Classes/Banana.h"
,
"Pods/BananaLib/Classes/Banana.m"
,
"Pods/BananaLib/Classes/BananaLib.pch"
,
"Pods/BananaLib/Classes/BananaPrivate.h"
,
"Pods/BananaLib/LICENSE"
,
"Pods/BananaLib/README"
,
"Pods/BananaLib/Resources/logo-sidebar.png"
]
end
end
...
...
spec/unit/installer/target_installer_spec.rb
View file @
587ee30a
...
...
@@ -48,11 +48,6 @@ module Pod
#--------------------------------------#
xit
"sets the deployment target of the native target"
do
# Test iOS and OS X
# @see https://github.com/CocoaPods/CocoaPods/commit/76b5b7f9c02a4d36425bde745ecd6d7ff289a00d
end
it
'adds the target for the static library to the project'
do
@installer
.
install!
@project
.
targets
.
count
.
should
==
1
...
...
@@ -87,17 +82,21 @@ module Pod
target
.
build_settings
(
'Release'
)[
"VALIDATE_PRODUCT"
].
should
==
"YES"
end
it
"sets
IPHONEOS_DEPLOYMENT_TARGET
for iOS targets"
do
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
MACOSX_DEPLOYMENT_TARGET
for OS X targets"
do
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
...
...
spec/unit/installer_spec.rb
View file @
587ee30a
...
...
@@ -56,7 +56,7 @@ module Pod
@installer
.
install!
end
it
"marks all pods as added if there is no lockfile"
do
x
it
"marks all pods as added if there is no lockfile"
do
true
.
should
.
be
.
true
# @installer.pods_added_from_the_lockfile.should == ['JSONKit']
end
...
...
spec/unit/validator_spec.rb
View file @
587ee30a
...
...
@@ -56,19 +56,17 @@ module Pod
validator
.
validated?
.
should
.
be
.
false
end
unless
skip_xcodebuild?
it
"uses xcodebuild to generate notes and warnings"
do
validator
=
Validator
.
new
(
podspec_path
)
validator
.
stubs
(
:check_file_patterns
)
validator
.
validate
first
=
validator
.
results
.
map
(
&
:to_s
).
first
first
.
should
.
include
"[xcodebuild]"
first
.
should
.
include
"[OS X - iOS]"
validator
.
result_type
.
should
==
:note
end
it
"uses xcodebuild to generate notes and warnings"
do
validator
=
Validator
.
new
(
podspec_path
)
validator
.
stubs
(
:check_file_patterns
)
validator
.
stubs
(
:xcodebuild
).
returns
(
"file.m:1:1: warning: direct access to objective-c's isa is deprecated"
)
validator
.
validate
first
=
validator
.
results
.
map
(
&
:to_s
).
first
first
.
should
.
include
"[xcodebuild]"
validator
.
result_type
.
should
==
:note
end
x
it
"checks for file patterns"
do
it
"checks for file patterns"
do
file
=
write_podspec
(
stub_podspec
(
/s\.source_files = 'JSONKit\.\*'/
,
"s.source_files = 'wrong_paht.*'"
))
validator
=
Validator
.
new
(
file
)
validator
.
stubs
(
:build_pod
)
...
...
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