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
05eea37a
Commit
05eea37a
authored
Sep 29, 2015
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4273 from sguillope/sguillope/handle-add-repo-mkpath-exception
[Repo Command] Handle add repo mkpath exception
parents
585abeb9
d0e07f55
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
7 deletions
+54
-7
CHANGELOG.md
CHANGELOG.md
+5
-0
add.rb
lib/cocoapods/command/repo/add.rb
+40
-7
add_spec.rb
spec/functional/command/repo/add_spec.rb
+9
-0
No files found.
CHANGELOG.md
View file @
05eea37a
...
...
@@ -71,6 +71,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Sylvain Guillopé
](
https://github.com/sguillope
)
[
#3151
](
https://github.com/CocoaPods/CocoaPods/issues/3151
)
*
Gracefully handle exception if creating the repos directory fails due to a
system error like a permission issue.
[
Sylvain Guillopé
](
https://github.com/sguillope
)
[
#4177
](
https://github.com/CocoaPods/CocoaPods/issues/4177
)
## 0.39.0.beta.4 (2015-09-02)
##### Bug Fixes
...
...
lib/cocoapods/command/repo/add.rb
View file @
05eea37a
...
...
@@ -39,16 +39,49 @@ module Pod
def
run
prefix
=
@shallow
?
'Creating shallow clone of'
:
'Cloning'
UI
.
section
(
"
#{
prefix
}
spec repo `
#{
@name
}
` from `
#{
@url
}
`
#{
" (branch `
#{
@branch
}
`)"
if
@branch
}
"
)
do
config
.
repos_dir
.
mkpath
Dir
.
chdir
(
config
.
repos_dir
)
do
command
=
[
'clone'
,
@url
,
@name
]
command
<<
'--depth=1'
if
@shallow
git!
(
command
)
end
Dir
.
chdir
(
dir
)
{
git!
(
'checkout'
,
@branch
)
}
if
@branch
create_repos_dir
clone_repo
checkout_branch
SourcesManager
.
check_version_information
(
dir
)
end
end
private
# Creates the repos directory specified in the configuration by
# `config.repos_dir`.
#
# @return [void]
#
# @raise If the directory cannot be created due to a system error.
#
def
create_repos_dir
config
.
repos_dir
.
mkpath
rescue
=>
e
raise
Informative
,
"Could not create '
#{
config
.
repos_dir
}
', the CocoaPods repo cache directory.
\n
"
\
"
#{
e
.
class
.
name
}
:
#{
e
.
message
}
"
end
# Clones the git spec-repo according to parameters passed to the
# command.
#
# @return [void]
#
def
clone_repo
Dir
.
chdir
(
config
.
repos_dir
)
do
command
=
[
'clone'
,
@url
,
@name
]
command
<<
'--depth=1'
if
@shallow
git!
(
command
)
end
end
# Checks out the branch of the git spec-repo if provided.
#
# @return [void]
#
def
checkout_branch
Dir
.
chdir
(
dir
)
{
git!
(
'checkout'
,
@branch
)
}
if
@branch
end
end
end
end
...
...
spec/functional/command/repo/add_spec.rb
View file @
05eea37a
...
...
@@ -38,5 +38,14 @@ module Pod
`git log --pretty=oneline`
.
strip
.
split
(
"
\n
"
).
size
.
should
==
1
end
end
it
'raises an informative error when the repos directory fails to be created'
do
repos_dir
=
config
.
repos_dir
def
repos_dir
.
mkpath
raise
SystemCallError
,
'Operation not permitted'
end
e
=
lambda
{
run_command
(
'repo'
,
'add'
,
'private'
,
test_repo_path
)
}.
should
.
raise
Informative
e
.
message
.
should
.
match
/Could not create '
#{
tmp_repos_path
}
', the CocoaPods repo cache directory./
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