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
ae94566f
Commit
ae94566f
authored
Jun 19, 2015
by
Vincent Isambart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move caching from FileAccessor to PathList
parent
9e0b0762
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
file_accessor.rb
lib/cocoapods/sandbox/file_accessor.rb
+1
-3
path_list.rb
lib/cocoapods/sandbox/path_list.rb
+7
-1
No files found.
lib/cocoapods/sandbox/file_accessor.rb
View file @
ae94566f
...
@@ -39,7 +39,6 @@ module Pod
...
@@ -39,7 +39,6 @@ module Pod
@path_list
=
PathList
.
new
(
path_list
)
@path_list
=
PathList
.
new
(
path_list
)
end
end
@spec_consumer
=
spec_consumer
@spec_consumer
=
spec_consumer
@paths_for_attribute
=
{
false
=>
{},
true
=>
{}
}
unless
@spec_consumer
unless
@spec_consumer
raise
Informative
,
'Attempt to initialize File Accessor without a specification consumer.'
raise
Informative
,
'Attempt to initialize File Accessor without a specification consumer.'
...
@@ -277,14 +276,13 @@ module Pod
...
@@ -277,14 +276,13 @@ module Pod
# @return [Array<Pathname>] the paths.
# @return [Array<Pathname>] the paths.
#
#
def
paths_for_attribute
(
attribute
,
include_dirs
=
false
)
def
paths_for_attribute
(
attribute
,
include_dirs
=
false
)
return
@paths_for_attribute
[
include_dirs
][
attribute
]
if
@paths_for_attribute
[
include_dirs
][
attribute
]
file_patterns
=
spec_consumer
.
send
(
attribute
)
file_patterns
=
spec_consumer
.
send
(
attribute
)
options
=
{
options
=
{
:exclude_patterns
=>
spec_consumer
.
exclude_files
,
:exclude_patterns
=>
spec_consumer
.
exclude_files
,
:dir_pattern
=>
GLOB_PATTERNS
[
attribute
],
:dir_pattern
=>
GLOB_PATTERNS
[
attribute
],
:include_dirs
=>
include_dirs
,
:include_dirs
=>
include_dirs
,
}
}
@paths_for_attribute
[
include_dirs
][
attribute
]
=
expanded_paths
(
file_patterns
,
options
)
expanded_paths
(
file_patterns
,
options
)
end
end
# Matches the given patterns to the file present in the root of the path
# Matches the given patterns to the file present in the root of the path
...
...
lib/cocoapods/sandbox/path_list.rb
View file @
ae94566f
...
@@ -21,6 +21,7 @@ module Pod
...
@@ -21,6 +21,7 @@ module Pod
#
#
def
initialize
(
root
)
def
initialize
(
root
)
@root
=
root
@root
=
root
@glob_cache
=
{}
end
end
# @return [Array<String>] The list of absolute the path of all the files
# @return [Array<String>] The list of absolute the path of all the files
...
@@ -46,6 +47,7 @@ module Pod
...
@@ -46,6 +47,7 @@ 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
@glob_cache
=
{}
root_length
=
root
.
to_s
.
length
+
1
root_length
=
root
.
to_s
.
length
+
1
escaped_root
=
escape_path_for_glob
(
root
)
escaped_root
=
escape_path_for_glob
(
root
)
paths
=
Dir
.
glob
(
escaped_root
+
'**/*'
,
File
::
FNM_DOTMATCH
)
paths
=
Dir
.
glob
(
escaped_root
+
'**/*'
,
File
::
FNM_DOTMATCH
)
...
@@ -101,6 +103,10 @@ module Pod
...
@@ -101,6 +103,10 @@ module Pod
def
relative_glob
(
patterns
,
options
=
{})
def
relative_glob
(
patterns
,
options
=
{})
return
[]
if
patterns
.
empty?
return
[]
if
patterns
.
empty?
cache_key
=
options
.
merge
(
:patterns
=>
patterns
)
cached_value
=
@glob_cache
[
cache_key
]
return
cached_value
if
cached_value
dir_pattern
=
options
[
:dir_pattern
]
dir_pattern
=
options
[
:dir_pattern
]
exclude_patterns
=
options
[
:exclude_patterns
]
exclude_patterns
=
options
[
:exclude_patterns
]
include_dirs
=
options
[
:include_dirs
]
include_dirs
=
options
[
:include_dirs
]
...
@@ -133,7 +139,7 @@ module Pod
...
@@ -133,7 +139,7 @@ module Pod
exclude_options
=
{
:dir_pattern
=>
'**/*'
,
:include_dirs
=>
include_dirs
}
exclude_options
=
{
:dir_pattern
=>
'**/*'
,
:include_dirs
=>
include_dirs
}
list
-=
relative_glob
(
exclude_patterns
,
exclude_options
)
list
-=
relative_glob
(
exclude_patterns
,
exclude_options
)
end
end
list
@glob_cache
[
cache_key
]
=
list
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