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
99a2f74f
Commit
99a2f74f
authored
Mar 22, 2018
by
Muhammed Yavuz Nuzumlalı
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return list of files preserving given pattern order on glob
parent
0778a2aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
15 deletions
+32
-15
path_list.rb
lib/cocoapods/sandbox/path_list.rb
+17
-15
path_list_spec.rb
spec/unit/sandbox/path_list_spec.rb
+15
-0
No files found.
lib/cocoapods/sandbox/path_list.rb
View file @
99a2f74f
...
...
@@ -129,21 +129,23 @@ module Pod
full_list
=
files
end
patterns_array
=
Array
(
patterns
)
exact_matches
=
full_list
&
patterns_array
patterns_array
-=
exact_matches
all_patterns
=
patterns_array
.
map
do
|
pattern
|
if
directory?
(
pattern
)
&&
dir_pattern
pattern
+=
'/'
unless
pattern
.
end_with?
(
'/'
)
pattern
+=
dir_pattern
end
dir_glob_equivalent_patterns
(
pattern
)
end
.
flatten
list
=
exact_matches
unless
all_patterns
.
empty?
list
+=
full_list
.
select
do
|
path
|
all_patterns
.
any?
do
|
p
|
File
.
fnmatch
(
p
,
path
,
File
::
FNM_CASEFOLD
|
File
::
FNM_PATHNAME
)
exact_matches
=
(
full_list
&
patterns_array
).
to_set
unless
patterns_array
.
empty?
list
=
patterns_array
.
flat_map
do
|
pattern
|
if
exact_matches
.
include?
(
pattern
)
pattern
else
if
directory?
(
pattern
)
&&
dir_pattern
pattern
+=
'/'
unless
pattern
.
end_with?
(
'/'
)
pattern
+=
dir_pattern
end
expanded_patterns
=
dir_glob_equivalent_patterns
(
pattern
)
full_list
.
select
do
|
path
|
expanded_patterns
.
any?
do
|
p
|
File
.
fnmatch
(
p
,
path
,
File
::
FNM_CASEFOLD
|
File
::
FNM_PATHNAME
)
end
end
end
end
end
...
...
spec/unit/sandbox/path_list_spec.rb
View file @
99a2f74f
...
...
@@ -199,6 +199,21 @@ module Pod
libBananalib.a
)
end
it
'preserves pattern order'
do
patterns
=
%w(
Classes/BananaPrivate.h
Classes/Banana.h
Classes/Banana.m
)
paths
=
@path_list
.
relative_glob
(
patterns
).
map
(
&
:to_s
)
paths
.
should
==
%w(
Classes/BananaPrivate.h
Classes/Banana.h
Classes/Banana.m
)
end
end
describe
'Reading file system'
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