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
f675cf22
Commit
f675cf22
authored
Oct 27, 2015
by
Muhammed Yavuz Nuzumlali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate index for each source if it does not exist during search
parent
f6f51505
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
20 deletions
+19
-20
sources_manager.rb
lib/cocoapods/sources_manager.rb
+19
-20
No files found.
lib/cocoapods/sources_manager.rb
View file @
f675cf22
...
@@ -155,18 +155,16 @@ module Pod
...
@@ -155,18 +155,16 @@ module Pod
# @return [Hash{String => Hash{String => Array<String>}}] The up to date search data.
# @return [Hash{String => Hash{String => Array<String>}}] The up to date search data.
#
#
def
updated_search_index
def
updated_search_index
index
=
stored_search_index
index
=
stored_search_index
||
{}
unless
index
all
.
each
do
|
source
|
# Create index from scratch
source_name
=
source
.
name
UI
.
puts
'Creating search index..'
unless
index
[
source_name
]
index
=
{}
UI
.
print
"Creating search index for spec repo '
#{
source_name
}
'.."
all
.
each
do
|
source
|
source_name
=
source
.
name
index
[
source_name
]
=
aggregate
.
generate_search_index_for_source
(
source
)
index
[
source_name
]
=
aggregate
.
generate_search_index_for_source
(
source
)
UI
.
puts
" Done!"
end
end
save_search_index
(
index
)
UI
.
puts
'Search index creation done!'
end
end
save_search_index
(
index
)
index
index
end
end
...
@@ -219,28 +217,28 @@ module Pod
...
@@ -219,28 +217,28 @@ module Pod
# @param [Hash{Source => Array<String>}] changed_spec_paths
# @param [Hash{Source => Array<String>}] changed_spec_paths
# A hash containing changed specification paths for each source.
# A hash containing changed specification paths for each source.
def
update_search_index_if_needed
(
changed_spec_paths
)
def
update_search_index_if_needed
(
changed_spec_paths
)
search_index
=
nil
search_index
=
stored_search_index
return
unless
search_index
changed_spec_paths
.
each_pair
do
|
source
,
spec_paths
|
changed_spec_paths
.
each_pair
do
|
source
,
spec_paths
|
source_name
=
source
.
name
index_for_source
=
search_index
[
source
.
name
]
next
unless
spec_paths
.
length
>
0
next
unless
index_for_source
&&
spec_paths
.
length
>
0
search_index
=
stored_search_index
updated_pods
=
source
.
pods_for_specification_paths
(
spec_paths
)
updated_pods
=
source
.
pods_for_specification_paths
(
spec_paths
)
new_index
=
aggregate
.
generate_search_index_for_changes_in_source
(
source
,
spec_paths
)
new_index
=
aggregate
.
generate_search_index_for_changes_in_source
(
source
,
spec_paths
)
next
unless
search_index
&&
search_index
[
source_name
]
# First traverse search_index and update existing words
# First traverse search_index and update existing words
# Removed traversed words from new_index after adding to search_index,
# Removed traversed words from new_index after adding to search_index,
# so that only non existing words will remain in new_index after enumeration completes.
# so that only non existing words will remain in new_index after enumeration completes.
search_index
[
source_name
]
.
each_pair
do
|
word
,
_
|
index_for_source
.
each_pair
do
|
word
,
_
|
if
new_index
[
word
]
if
new_index
[
word
]
search_index
[
source_name
]
[
word
]
|=
new_index
[
word
]
index_for_source
[
word
]
|=
new_index
[
word
]
else
else
search_index
[
source_name
]
[
word
]
-=
updated_pods
index_for_source
[
word
]
-=
updated_pods
end
end
end
end
# Now add non existing words remained in new_index to search_index
# Now add non existing words remained in new_index to search_index
search_index
[
source_name
]
.
merge!
(
new_index
)
index_for_source
.
merge!
(
new_index
)
end
end
save_search_index
(
search_index
)
if
search_index
save_search_index
(
search_index
)
end
end
# Updates search index for changed pods in background
# Updates search index for changed pods in background
...
@@ -271,7 +269,8 @@ module Pod
...
@@ -271,7 +269,8 @@ module Pod
changed_spec_paths
=
{}
changed_spec_paths
=
{}
sources
.
each
do
|
source
|
sources
.
each
do
|
source
|
UI
.
section
"Updating spec repo `
#{
source
.
name
}
`"
do
UI
.
section
"Updating spec repo `
#{
source
.
name
}
`"
do
changed_spec_paths
[
source
]
=
source
.
update
(
show_output
&&
!
config
.
verbose?
)
changed_source_paths
=
source
.
update
(
show_output
&&
!
config
.
verbose?
)
changed_spec_paths
[
source
]
=
changed_source_paths
if
changed_source_paths
.
count
>
0
check_version_information
(
source
.
repo
)
check_version_information
(
source
.
repo
)
end
end
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