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
e9642d7c
Commit
e9642d7c
authored
Mar 29, 2014
by
Alex Rothenberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup pod directory when download fails (probably due to a network error)
Fixes #1482
parent
b09f0dae
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
pod_source_installer.rb
lib/cocoapods/installer/pod_source_installer.rb
+4
-0
pod_source_installer_spec.rb
spec/unit/installer/pod_source_installer_spec.rb
+17
-0
No files found.
lib/cocoapods/installer/pod_source_installer.rb
View file @
e9642d7c
...
@@ -63,6 +63,10 @@ module Pod
...
@@ -63,6 +63,10 @@ module Pod
def
install!
def
install!
download_source
unless
predownloaded?
||
local?
download_source
unless
predownloaded?
||
local?
run_prepare_command
run_prepare_command
rescue
=>
e
UI
.
notice
(
"Error installing
#{
root_spec
.
name
}
"
)
clean!
raise
end
end
# Cleans the installations if appropriate.
# Cleans the installations if appropriate.
...
...
spec/unit/installer/pod_source_installer_spec.rb
View file @
e9642d7c
...
@@ -61,6 +61,23 @@ module Pod
...
@@ -61,6 +61,23 @@ module Pod
}
}
end
end
it
"cleans up directory when an error occurs during download"
do
config
.
sandbox
.
store_head_pod
(
'BananaLib'
)
pod_folder
=
config
.
sandbox
.
root
+
'BananaLib'
partially_downloaded_file
=
pod_folder
+
'partially_downloaded_file'
mock_downloader
=
Object
.
new
mock_downloader
.
define_singleton_method
(
:download_head
)
do
FileUtils
.
mkdir_p
(
pod_folder
)
FileUtils
.
touch
(
partially_downloaded_file
)
raise
(
"some network error"
)
end
@installer
.
stubs
(
:downloader
).
returns
(
mock_downloader
)
lambda
{
@installer
.
install!
}.
should
.
raise
(
RuntimeError
).
message
.
should
.
equal
(
'some network error'
)
partially_downloaded_file
.
should
.
not
.
exist
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