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
afd42d75
Commit
afd42d75
authored
Nov 14, 2013
by
Joshua Kalpin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SourcesManager] Ignore repos with unreachable sources on update
parent
9f03ab97
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
sources_manager.rb
lib/cocoapods/sources_manager.rb
+14
-2
sources_manager_spec.rb
spec/unit/sources_manager_spec.rb
+5
-0
No files found.
lib/cocoapods/sources_manager.rb
View file @
afd42d75
...
@@ -145,7 +145,7 @@ module Pod
...
@@ -145,7 +145,7 @@ module Pod
raise
Informative
,
"The `
#{
source_name
}
` repo is not a git repo."
unless
git_repo?
(
specified_source
.
repo
)
raise
Informative
,
"The `
#{
source_name
}
` repo is not a git repo."
unless
git_repo?
(
specified_source
.
repo
)
sources
=
[
specified_source
]
sources
=
[
specified_source
]
else
else
sources
=
aggregate
.
all
.
select
{
|
source
|
git_repo?
(
source
.
repo
)
}
sources
=
aggregate
.
all
.
select
{
|
source
|
git_repo?
(
source
.
repo
)
&&
git_remote_reachable?
(
source
.
repo
)
}
end
end
sources
.
each
do
|
source
|
sources
.
each
do
|
source
|
...
@@ -159,12 +159,24 @@ module Pod
...
@@ -159,12 +159,24 @@ module Pod
end
end
end
end
# Returns whether a git repo's remote is reachable.
#
# @param [Pathname] dir
# The directory where the source is stored.
#
# @return [Bool] Whether the given source's remote is reachable.
#
def
git_remote_reachable?
(
dir
)
Dir
.
chdir
(
dir
)
{
`git ls-remote`
}
$?
.
exitstatus
.
zero?
end
# Returns whether a source is a GIT repo.
# Returns whether a source is a GIT repo.
#
#
# @param [Pathname] dir
# @param [Pathname] dir
# The directory where the source is stored.
# The directory where the source is stored.
#
#
# @return [Bool] Wether the given source is a GIT repo.
# @return [Bool] W
h
ether the given source is a GIT repo.
#
#
def
git_repo?
(
dir
)
def
git_repo?
(
dir
)
Dir
.
chdir
(
dir
)
{
`git rev-parse >/dev/null 2>&1`
}
Dir
.
chdir
(
dir
)
{
`git rev-parse >/dev/null 2>&1`
}
...
...
spec/unit/sources_manager_spec.rb
View file @
afd42d75
...
@@ -95,6 +95,11 @@ module Pod
...
@@ -95,6 +95,11 @@ module Pod
UI
.
output
.
should
.
match
/Already up-to-date/
UI
.
output
.
should
.
match
/Already up-to-date/
end
end
it
'returns whether a source has a reachable git remote'
do
SourcesManager
.
git_remote_reachable?
(
repo_make
(
'a_new_repo_that_is_new'
)).
should
.
be
.
false
SourcesManager
.
git_remote_reachable?
(
SourcesManager
.
master_repo_dir
).
should
.
be
.
true
end
it
"returns whether a source is backed by a git repo"
do
it
"returns whether a source is backed by a git repo"
do
SourcesManager
.
git_repo?
(
SourcesManager
.
master_repo_dir
).
should
.
be
.
true
SourcesManager
.
git_repo?
(
SourcesManager
.
master_repo_dir
).
should
.
be
.
true
SourcesManager
.
git_repo?
(
Pathname
.
new
(
'/tmp'
)).
should
.
be
.
false
SourcesManager
.
git_repo?
(
Pathname
.
new
(
'/tmp'
)).
should
.
be
.
false
...
...
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