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
0e074f75
Commit
0e074f75
authored
May 15, 2016
by
Marc Boquet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PathList] Another try at the re-implementation of read_file_system
parent
768b2c57
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
17 deletions
+9
-17
path_list.rb
lib/cocoapods/sandbox/path_list.rb
+5
-13
NSFetchRequest+Banana.h
...fixtures/banana-unordered/Classes/NSFetchRequest+Banana.h
+0
-0
NSFetchedResultsController+Banana.h
...ana-unordered/Classes/NSFetchedResultsController+Banana.h
+0
-0
path_list_spec.rb
spec/unit/sandbox/path_list_spec.rb
+4
-4
No files found.
lib/cocoapods/sandbox/path_list.rb
View file @
0e074f75
...
@@ -50,20 +50,12 @@ module Pod
...
@@ -50,20 +50,12 @@ module Pod
unless
root
.
exist?
unless
root
.
exist?
raise
Informative
,
"Attempt to read non existent folder `
#{
root
}
`."
raise
Informative
,
"Attempt to read non existent folder `
#{
root
}
`."
end
end
files
=
[]
dirs
=
[]
escaped_root
=
escape_path_for_glob
(
root
)
escaped_root
=
escape_path_for_glob
(
root
)
paths
=
Pathname
.
glob
(
escaped_root
+
'**/*'
,
File
::
FNM_DOTMATCH
)
do
|
path
|
absolute_paths
=
Pathname
.
glob
(
escaped_root
+
'**/*'
,
File
::
FNM_DOTMATCH
)
next
if
path
.
basename
.
to_s
.
match
/\.\.?$/
dirs_and_files
=
absolute_paths
.
reject
{
|
path
|
path
.
basename
.
to_s
=~
/^\.\.?$/
}
relative_path
=
path
.
relative_path_from
(
root
)
dirs
,
files
=
dirs_and_files
.
partition
(
&
:directory?
)
if
path
.
directory?
@dirs
=
dirs
.
map
{
|
dir
|
dir
.
relative_path_from
(
root
).
to_s
}.
sort_by
(
&
:upcase
)
dirs
<<
relative_path
.
to_s
@files
=
files
.
map
{
|
file
|
file
.
relative_path_from
(
root
).
to_s
}.
sort_by
(
&
:upcase
)
else
files
<<
relative_path
.
to_s
end
end
@files
=
files
.
sort_by
(
&
:upcase
)
@dirs
=
dirs
.
sort_by
(
&
:upcase
)
@glob_cache
=
{}
@glob_cache
=
{}
end
end
...
...
spec/fixtures/banana-unordered/Classes/NSFetchRequest+Banana.h
0 → 100644
View file @
0e074f75
spec/fixtures/banana-unordered/Classes/NSFetchedResultsController+Banana.h
0 → 100644
View file @
0e074f75
spec/unit/sandbox/path_list_spec.rb
View file @
0e074f75
...
@@ -168,14 +168,14 @@ module Pod
...
@@ -168,14 +168,14 @@ module Pod
describe
'Reading file system'
do
describe
'Reading file system'
do
it
'orders paths case insensitively'
do
it
'orders paths case insensitively'
do
root
=
fixture
(
'banana-
lib
'
)
root
=
fixture
(
'banana-
unordered
'
)
# Let Pathname.glob result be ordered case-sensitively
# Let Pathname.glob result be ordered case-sensitively
Pathname
.
stubs
(
:glob
).
multiple_yields
(
Pathname
.
new
(
"
#{
root
}
/Classes/NSFetchRequest+Banana.h"
),
Pathname
.
stubs
(
:glob
).
returns
([
Pathname
.
new
(
"
#{
root
}
/Classes/NSFetchRequest+Banana.h"
),
Pathname
.
new
(
"
#{
root
}
/Classes/NSFetchedResultsController+Banana.h"
)
)
Pathname
.
new
(
"
#{
root
}
/Classes/NSFetchedResultsController+Banana.h"
)]
)
File
.
stubs
(
:directory?
).
returns
(
false
)
File
.
stubs
(
:directory?
).
returns
(
false
)
path_list
=
Sandbox
::
PathList
.
new
(
fixture
(
'banana-lib'
)
)
path_list
=
Sandbox
::
PathList
.
new
(
root
)
path_list
.
files
.
should
==
%w(Classes/NSFetchedResultsController+Banana.h Classes/NSFetchRequest+Banana.h)
path_list
.
files
.
should
==
%w(Classes/NSFetchedResultsController+Banana.h Classes/NSFetchRequest+Banana.h)
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