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
792e387c
Commit
792e387c
authored
Mar 31, 2012
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove methods from Specification that have moved to LocalPod.
parent
04843c3d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
182 deletions
+97
-182
specification.rb
lib/cocoapods/specification.rb
+0
-70
local_pod_spec.rb
spec/unit/local_pod_spec.rb
+97
-1
specification_spec.rb
spec/unit/specification_spec.rb
+0
-111
No files found.
lib/cocoapods/specification.rb
View file @
792e387c
...
...
@@ -298,46 +298,6 @@ module Pod
end
end
# Returns all resource files of this pod, but relative to the
# project pods root.
def
expanded_resources
files
=
{}
resources
.
each
do
|
platform
,
patterns
|
patterns
.
each
do
|
pattern
|
pattern
=
pod_destroot
+
pattern
pattern
.
glob
.
each
do
|
file
|
(
files
[
platform
]
||=
[])
<<
file
.
relative_path_from
(
config
.
project_pods_root
)
end
end
end
files
end
# Returns all source files of this pod including header files,
# but relative to the project pods root.
#
# If the pattern is the path to a directory, the pattern will
# automatically glob for c, c++, Objective-C, and Objective-C++
# files.
def
expanded_source_files
files
=
{}
source_files
.
each
do
|
platform
,
patterns
|
patterns
.
each
do
|
pattern
|
pattern
=
pod_destroot
+
pattern
pattern
=
pattern
+
'*.{h,m,mm,c,cpp}'
if
pattern
.
directory?
pattern
.
glob
.
each
do
|
file
|
(
files
[
platform
]
||=
[])
<<
file
.
relative_path_from
(
config
.
project_pods_root
)
end
end
end
files
end
# Returns only the header files of this pod.
def
header_files
expanded_source_files
.
each
{
|
_
,
files
|
files
.
select!
{
|
f
|
f
.
extname
==
'.h'
}
}
end
# This method takes a header path and returns the location it should have
# in the pod's header dir.
#
...
...
@@ -348,36 +308,6 @@ module Pod
from
.
basename
end
# See copy_header_mapping.
def
copy_header_mappings_for_files
(
header_files
)
header_files
.
inject
({})
do
|
mappings
,
from
|
from_without_prefix
=
from
.
relative_path_from
(
pod_destroot_name
)
to
=
header_dir
+
copy_header_mapping
(
from_without_prefix
)
(
mappings
[
to
.
dirname
]
||=
[])
<<
from
mappings
end
end
def
copy_header_mappings
header_files
.
inject
({})
do
|
hash
,
(
platform
,
files
)
|
hash
[
platform
]
=
copy_header_mappings_for_files
(
files
)
hash
end
end
def
copy_header_destinations
copy_header_mappings
.
map
{
|
_
,
mappings
|
mappings
.
keys
}.
flatten
.
uniq
end
# Returns a list of search paths where the pod's headers can be found. This
# includes the pod's header dir root and any other directories that might
# have been added by overriding the copy_header_mapping/copy_header_mappings
# methods.
def
header_search_paths
dirs
=
[
header_dir
]
+
copy_header_destinations
dirs
.
map
{
|
dir
|
%{"$(PODS_ROOT)/Headers/#{dir}"}
}
end
def
to_s
"
#{
name
}
(
#{
version
}
)"
end
...
...
spec/unit/local_pod_spec.rb
View file @
792e387c
...
...
@@ -78,5 +78,101 @@ describe Pod::LocalPod do
target
.
expects
(
:add_source_file
).
with
(
anything
,
anything
,
"-d some_flag"
)
@pod
.
add_to_target
(
target
)
end
end
# TODO: This is really what a LocalPod now represents
# Which probably means most of this functionality should move there
#describe "A Pod::Specification, with installed source," do
#before do
#config.project_pods_root = fixture('integration')
#podspec = fixture('spec-repos/master/SSZipArchive/0.1.0/SSZipArchive.podspec')
#@spec = Pod::Specification.from_file(podspec)
#@destroot = fixture('integration/SSZipArchive')
#end
#after do
#config.project_pods_root = nil
#end
#it "returns the list of files that the source_files pattern expand to" do
#files = @destroot.glob('**/*.{h,c,m}')
#files = files.map { |file| file.relative_path_from(config.project_pods_root) }
#@spec.expanded_source_files[:ios].sort.should == files.sort
#end
#it "returns the list of headers" do
#files = @destroot.glob('**/*.h')
#files = files.map { |file| file.relative_path_from(config.project_pods_root) }
#@spec.header_files[:ios].sort.should == files.sort
#end
#it "returns a hash of mappings from the pod's destroot to its header dirs, which by default is just the pod's header dir" do
#@spec.copy_header_mappings[:ios].size.should == 1
#@spec.copy_header_mappings[:ios][Pathname.new('SSZipArchive')].sort.should == %w{
#SSZipArchive.h
#minizip/crypt.h
#minizip/ioapi.h
#minizip/mztools.h
#minizip/unzip.h
#minizip/zip.h
#}.map { |f| Pathname.new("SSZipArchive/#{f}") }.sort
#end
#it "allows for customization of header mappings by overriding copy_header_mapping" do
#def @spec.copy_header_mapping(from)
#Pathname.new('ns') + from.basename
#end
#@spec.copy_header_mappings[:ios].size.should == 1
#@spec.copy_header_mappings[:ios][Pathname.new('SSZipArchive/ns')].sort.should == %w{
#SSZipArchive.h
#minizip/crypt.h
#minizip/ioapi.h
#minizip/mztools.h
#minizip/unzip.h
#minizip/zip.h
#}.map { |f| Pathname.new("SSZipArchive/#{f}") }.sort
#end
#it "returns a hash of mappings with a custom header dir prefix" do
#@spec.header_dir = 'AnotherRoot'
#@spec.copy_header_mappings[:ios][Pathname.new('AnotherRoot')].sort.should == %w{
#SSZipArchive.h
#minizip/crypt.h
#minizip/ioapi.h
#minizip/mztools.h
#minizip/unzip.h
#minizip/zip.h
#}.map { |f| Pathname.new("SSZipArchive/#{f}") }.sort
#end
#it "returns the user header search paths" do
#def @spec.copy_header_mapping(from)
#Pathname.new('ns') + from.basename
#end
#@spec.header_search_paths.should == %w{
#"$(PODS_ROOT)/Headers/SSZipArchive"
#"$(PODS_ROOT)/Headers/SSZipArchive/ns"
#}
#end
#it "returns the user header search paths with a custom header dir prefix" do
#@spec.header_dir = 'AnotherRoot'
#def @spec.copy_header_mapping(from)
#Pathname.new('ns') + from.basename
#end
#@spec.header_search_paths.should == %w{
#"$(PODS_ROOT)/Headers/AnotherRoot"
#"$(PODS_ROOT)/Headers/AnotherRoot/ns"
#}
#end
#it "returns the list of files that the resources pattern expand to" do
#@spec.expanded_resources.should == {}
#@spec.resource = 'LICEN*'
#@spec.expanded_resources[:ios].map(&:to_s).should == %w{ SSZipArchive/LICENSE }
#@spec.expanded_resources[:osx].map(&:to_s).should == %w{ SSZipArchive/LICENSE }
#@spec.resources = 'LICEN*', 'Readme.*'
#@spec.expanded_resources[:ios].map(&:to_s).should == %w{ SSZipArchive/LICENSE SSZipArchive/Readme.markdown }
#@spec.expanded_resources[:osx].map(&:to_s).should == %w{ SSZipArchive/LICENSE SSZipArchive/Readme.markdown }
#end
#end
spec/unit/specification_spec.rb
View file @
792e387c
...
...
@@ -144,103 +144,6 @@ describe "A Pod::Specification that's part of another pod's source" do
#end
end
# TODO: This is really what a LocalPod now represents
# Which probably means most of this functionality should move there
describe
"A Pod::Specification, with installed source,"
do
before
do
config
.
project_pods_root
=
fixture
(
'integration'
)
podspec
=
fixture
(
'spec-repos/master/SSZipArchive/0.1.0/SSZipArchive.podspec'
)
@spec
=
Pod
::
Specification
.
from_file
(
podspec
)
@destroot
=
fixture
(
'integration/SSZipArchive'
)
end
after
do
config
.
project_pods_root
=
nil
end
it
"returns the list of files that the source_files pattern expand to"
do
files
=
@destroot
.
glob
(
'**/*.{h,c,m}'
)
files
=
files
.
map
{
|
file
|
file
.
relative_path_from
(
config
.
project_pods_root
)
}
@spec
.
expanded_source_files
[
:ios
].
sort
.
should
==
files
.
sort
end
it
"returns the list of headers"
do
files
=
@destroot
.
glob
(
'**/*.h'
)
files
=
files
.
map
{
|
file
|
file
.
relative_path_from
(
config
.
project_pods_root
)
}
@spec
.
header_files
[
:ios
].
sort
.
should
==
files
.
sort
end
it
"returns a hash of mappings from the pod's destroot to its header dirs, which by default is just the pod's header dir"
do
@spec
.
copy_header_mappings
[
:ios
].
size
.
should
==
1
@spec
.
copy_header_mappings
[
:ios
][
Pathname
.
new
(
'SSZipArchive'
)].
sort
.
should
==
%w{
SSZipArchive.h
minizip/crypt.h
minizip/ioapi.h
minizip/mztools.h
minizip/unzip.h
minizip/zip.h
}
.
map
{
|
f
|
Pathname
.
new
(
"SSZipArchive/
#{
f
}
"
)
}.
sort
end
it
"allows for customization of header mappings by overriding copy_header_mapping"
do
def
@spec
.
copy_header_mapping
(
from
)
Pathname
.
new
(
'ns'
)
+
from
.
basename
end
@spec
.
copy_header_mappings
[
:ios
].
size
.
should
==
1
@spec
.
copy_header_mappings
[
:ios
][
Pathname
.
new
(
'SSZipArchive/ns'
)].
sort
.
should
==
%w{
SSZipArchive.h
minizip/crypt.h
minizip/ioapi.h
minizip/mztools.h
minizip/unzip.h
minizip/zip.h
}
.
map
{
|
f
|
Pathname
.
new
(
"SSZipArchive/
#{
f
}
"
)
}.
sort
end
it
"returns a hash of mappings with a custom header dir prefix"
do
@spec
.
header_dir
=
'AnotherRoot'
@spec
.
copy_header_mappings
[
:ios
][
Pathname
.
new
(
'AnotherRoot'
)].
sort
.
should
==
%w{
SSZipArchive.h
minizip/crypt.h
minizip/ioapi.h
minizip/mztools.h
minizip/unzip.h
minizip/zip.h
}
.
map
{
|
f
|
Pathname
.
new
(
"SSZipArchive/
#{
f
}
"
)
}.
sort
end
it
"returns the user header search paths"
do
def
@spec
.
copy_header_mapping
(
from
)
Pathname
.
new
(
'ns'
)
+
from
.
basename
end
@spec
.
header_search_paths
.
should
==
%w{
"$(PODS_ROOT)/Headers/SSZipArchive"
"$(PODS_ROOT)/Headers/SSZipArchive/ns"
}
end
it
"returns the user header search paths with a custom header dir prefix"
do
@spec
.
header_dir
=
'AnotherRoot'
def
@spec
.
copy_header_mapping
(
from
)
Pathname
.
new
(
'ns'
)
+
from
.
basename
end
@spec
.
header_search_paths
.
should
==
%w{
"$(PODS_ROOT)/Headers/AnotherRoot"
"$(PODS_ROOT)/Headers/AnotherRoot/ns"
}
end
it
"returns the list of files that the resources pattern expand to"
do
@spec
.
expanded_resources
.
should
==
{}
@spec
.
resource
=
'LICEN*'
@spec
.
expanded_resources
[
:ios
].
map
(
&
:to_s
).
should
==
%w{ SSZipArchive/LICENSE }
@spec
.
expanded_resources
[
:osx
].
map
(
&
:to_s
).
should
==
%w{ SSZipArchive/LICENSE }
@spec
.
resources
=
'LICEN*'
,
'Readme.*'
@spec
.
expanded_resources
[
:ios
].
map
(
&
:to_s
).
should
==
%w{ SSZipArchive/LICENSE SSZipArchive/Readme.markdown }
@spec
.
expanded_resources
[
:osx
].
map
(
&
:to_s
).
should
==
%w{ SSZipArchive/LICENSE SSZipArchive/Readme.markdown }
end
end
describe
"A Pod::Specification, in general,"
do
before
do
@spec
=
Pod
::
Spec
.
new
...
...
@@ -400,20 +303,6 @@ describe "A Pod::Specification with :local source" do
it
"it returns the expanded local path"
do
@spec
.
local_path
.
should
==
fixture
(
"integration/JSONKit"
)
end
it
"returns the list of files that the source_files pattern expand to within the local path"
do
files
=
fixture
(
"integration/JSONKit"
).
glob
(
'**/*.{h,m}'
)
files
=
files
.
map
{
|
file
|
file
.
relative_path_from
(
config
.
project_pods_root
)
}
@spec
.
expanded_source_files
[
:ios
].
sort
.
should
==
files
.
sort
@spec
.
expanded_source_files
[
:osx
].
sort
.
should
==
files
.
sort
end
it
"returns the list of headers that the source_files pattern expand to within the local path"
do
files
=
fixture
(
"integration/JSONKit"
).
glob
(
'**/*.{h}'
)
files
=
files
.
map
{
|
file
|
file
.
relative_path_from
(
config
.
project_pods_root
)
}
@spec
.
header_files
[
:ios
].
sort
.
should
==
files
.
sort
@spec
.
header_files
[
:osx
].
sort
.
should
==
files
.
sort
end
end
describe
"A Pod::Specification, concerning its attributes that support different values per platform,"
do
...
...
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