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
750dfe2a
Commit
750dfe2a
authored
Oct 24, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename DirList to PathList
parent
72dd54bb
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
26 deletions
+39
-26
CHANGELOG.md
CHANGELOG.md
+13
-0
local_pod.rb
lib/cocoapods/local_pod.rb
+5
-5
path_list.rb
lib/cocoapods/local_pod/path_list.rb
+6
-6
path_list_spec.rb
spec/unit/local_pod/path_list_spec.rb
+15
-15
No files found.
CHANGELOG.md
View file @
750dfe2a
## Branch 0.17
###### TODO
-
Add
`s.exclude_source_files`
and related attributes to the specification class.
###### Enhancements
-
Added PathList class.
-
Added Podfile to the Pods project.
[
#476
](
https://github.com/CocoaPods/CocoaPods/issues/476
)
## Master
[
CocoaPods
](
https://github.com/CocoaPods/CocoaPods/compare/0.16.0.rc2...master
)
•
[
Xcodeproj
](
https://github.com/CocoaPods/Xcodeproj/compare/0.4.0.rc1...master
)
...
...
lib/cocoapods/local_pod.rb
View file @
750dfe2a
...
...
@@ -21,7 +21,7 @@ module Pod
# returns absolute paths.
#
class
LocalPod
autoload
:
DirList
,
'cocoapods/local_pod/dir
_list'
autoload
:
PathList
,
'cocoapods/local_pod/path
_list'
# @return [Specification] The specification that describes the pod.
#
...
...
@@ -95,8 +95,8 @@ module Pod
@sandbox
.
root
+
top_specification
.
name
end
def
dir
_list
@
dir_list
||=
Dir
List
.
new
(
root
)
def
path
_list
@
path_list
||=
Path
List
.
new
(
root
)
end
# @return [String] A string representation of the pod which indicates if
...
...
@@ -161,7 +161,7 @@ module Pod
def
clean!
clean_paths
.
each
{
|
path
|
FileUtils
.
rm_rf
(
path
)
}
@cleaned
=
true
dir
_list
.
read_file_system
path
_list
.
read_file_system
end
# Finds the absolute paths, including hidden ones, of the files
...
...
@@ -577,7 +577,7 @@ module Pod
result
=
[]
result
<<
dir
_list
.
glob
(
glob_patterns
,
dir_pattern
,
exclude_patterns
)
result
<<
path
_list
.
glob
(
glob_patterns
,
dir_pattern
,
exclude_patterns
)
result
<<
file_lists
.
map
do
|
file_list
|
file_list
.
prepend_patterns
(
root
)
...
...
lib/cocoapods/local_pod/
dir
_list.rb
→
lib/cocoapods/local_pod/
path
_list.rb
View file @
750dfe2a
module
Pod
class
LocalPod
# The {
Dir
List} class is designed to perform multiple glob matches against
# The {
Path
List} class is designed to perform multiple glob matches against
# a given directory. Basically, it generates a list of all the children
# paths and matches the globs patterns against them, resulting in just
# one access to the file system.
#
# @note A {
Dir
List} once it has generated the list of the paths this is
# @note A {
Path
List} once it has generated the list of the paths this is
# updated only if explicitly requested by calling
# {
Dir
List#read_file_system}
# {
Path
List#read_file_system}
#
class
Dir
List
class
Path
List
# @return [Pathname] The root of the list whose files and directories
# are used to perform the matching operations.
#
attr_accessor
:root
# @param [Pathname] root The root of the
Dir
List.
# @param [Pathname] root The root of the
Path
List.
#
def
initialize
(
root
)
@root
=
root
...
...
@@ -150,6 +150,6 @@ module Pod
patterns
end
end
end
#
Dir
List
end
#
Path
List
end
# LocalPod
end
# Pod
spec/unit/local_pod/
dir_list
.rb
→
spec/unit/local_pod/
path_list_spec
.rb
View file @
750dfe2a
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
describe
Pod
::
LocalPod
::
Dir
List
do
describe
Pod
::
LocalPod
::
Path
List
do
before
do
@
dir_list
=
Pod
::
LocalPod
::
Dir
List
.
new
(
fixture
(
'banana-lib'
))
@
path_list
=
Pod
::
LocalPod
::
Path
List
.
new
(
fixture
(
'banana-lib'
))
end
it
"creates the list of all the files"
do
files
=
@
dir
_list
.
files
files
=
@
path
_list
.
files
files
.
reject!
do
|
f
|
f
.
include?
(
'libPusher'
)
||
f
.
include?
(
'.git'
)
||
f
.
include?
(
'DS_Store'
)
end
...
...
@@ -20,7 +20,7 @@ describe Pod::LocalPod::DirList do
end
it
"creates theh list of the directories"
do
dirs
=
@
dir
_list
.
dirs
dirs
=
@
path
_list
.
dirs
dirs
.
reject!
do
|
f
|
f
.
include?
(
'libPusher'
)
||
f
.
include?
(
'.git'
)
end
...
...
@@ -28,55 +28,55 @@ describe Pod::LocalPod::DirList do
end
it
"detects a directory"
do
@
dir
_list
.
directory?
(
'classes'
).
should
==
true
@
path
_list
.
directory?
(
'classes'
).
should
==
true
end
it
"doesn't reports as a directory a file"
do
@
dir
_list
.
directory?
(
'Classes/Banana.m'
).
should
==
false
@
path
_list
.
directory?
(
'Classes/Banana.m'
).
should
==
false
end
it
"can glob the root for a given pattern"
do
paths
=
@
dir
_list
.
relative_glob
(
'Classes/*.{h,m}'
).
map
(
&
:to_s
)
paths
=
@
path
_list
.
relative_glob
(
'Classes/*.{h,m}'
).
map
(
&
:to_s
)
paths
.
should
==
%w| Classes/Banana.h Classes/Banana.m |
end
it
"supports the `**` glob pattern"
do
paths
=
@
dir
_list
.
relative_glob
(
'Classes/**/*.{h,m}'
).
map
(
&
:to_s
)
paths
=
@
path
_list
.
relative_glob
(
'Classes/**/*.{h,m}'
).
map
(
&
:to_s
)
paths
.
should
==
%w| Classes/Banana.h Classes/Banana.m |
end
it
"supports an optional pattern for globbing directories"
do
paths
=
@
dir
_list
.
relative_glob
(
'Classes'
,
'*.{h,m}'
).
map
(
&
:to_s
)
paths
=
@
path
_list
.
relative_glob
(
'Classes'
,
'*.{h,m}'
).
map
(
&
:to_s
)
paths
.
should
==
%w| Classes/Banana.h Classes/Banana.m |
end
it
"can return the absolute paths from glob"
do
paths
=
@
dir
_list
.
glob
(
'Classes/*.{h,m}'
)
paths
=
@
path
_list
.
glob
(
'Classes/*.{h,m}'
)
paths
.
all?
{
|
p
|
p
.
absolute?
}.
should
==
true
end
it
"can return the relative paths from glob"
do
paths
=
@
dir
_list
.
relative_glob
(
'Classes/*.{h,m}'
)
paths
=
@
path
_list
.
relative_glob
(
'Classes/*.{h,m}'
)
paths
.
any?
{
|
p
|
p
.
absolute?
}.
should
==
false
end
it
"expands a pattern into all the combinations of Dir#glob literals"
do
patterns
=
@
dir
_list
.
dir_glob_equivalent_patterns
(
'{file1,file2}.{h,m}'
)
patterns
=
@
path
_list
.
dir_glob_equivalent_patterns
(
'{file1,file2}.{h,m}'
)
patterns
.
sort
.
should
==
%w| file1.h file1.m file2.h file2.m |
end
it
"returns the original patter if there are no Dir#glob expansions"
do
patterns
=
@
dir
_list
.
dir_glob_equivalent_patterns
(
'file*.*'
)
patterns
=
@
path
_list
.
dir_glob_equivalent_patterns
(
'file*.*'
)
patterns
.
sort
.
should
==
%w| file*.* |
end
it
"expands `**`"
do
patterns
=
@
dir
_list
.
dir_glob_equivalent_patterns
(
'Classes/**/file.m'
)
patterns
=
@
path
_list
.
dir_glob_equivalent_patterns
(
'Classes/**/file.m'
)
patterns
.
sort
.
should
==
%w| Classes/**/file.m Classes/file.m |
end
it
"supports a combination of `**` and literals"
do
patterns
=
@
dir
_list
.
dir_glob_equivalent_patterns
(
'Classes/**/file.{h,m}'
)
patterns
=
@
path
_list
.
dir_glob_equivalent_patterns
(
'Classes/**/file.{h,m}'
)
patterns
.
sort
.
should
==
%w| Classes/**/file.h Classes/**/file.m Classes/file.h Classes/file.m |
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