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
6e785527
Commit
6e785527
authored
Apr 23, 2012
by
Francis Chong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: raise a UnsupportedFileTypeError when unexpected file type is given
parent
f1072e7e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
http.rb
lib/cocoapods/downloader/http.rb
+4
-2
http_spec.rb
spec/unit/http_spec.rb
+16
-0
No files found.
lib/cocoapods/downloader/http.rb
View file @
6e785527
...
...
@@ -6,6 +6,8 @@ require 'yaml'
module
Pod
class
Downloader
class
Http
<
Downloader
class
UnsupportedFileTypeError
<
StandardError
;
end
executable
:curl
executable
:unzip
executable
:tar
...
...
@@ -49,7 +51,7 @@ module Pod
when
:tar
"file.tar"
else
raise
"Pod::Downloader::Http
Unsupported file type:
#{
type
}
"
raise
UnsupportedFileTypeError
.
new
"
Unsupported file type:
#{
type
}
"
end
end
...
...
@@ -66,7 +68,7 @@ module Pod
when
:tar
tar
"xf '
#{
full_filename
}
' -d
#{
target_path
}
"
else
raise
"Http Downloader: Unsupported file type
"
raise
UnsupportedFileTypeError
.
new
"Unsupported file type:
#{
type
}
"
end
end
...
...
spec/unit/http_spec.rb
View file @
6e785527
...
...
@@ -56,4 +56,20 @@ describe Pod::Downloader::Http do
downloader
.
expects
(
:extract_with_type
).
with
(
anything
(),
:tgz
).
at_least_once
downloader
.
download
end
it
'should raise error when unsupported filetype is pass'
do
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0.rar'
))
downloader
.
expects
(
:download
).
raises
(
Pod
::
Downloader
::
Http
::
UnsupportedFileTypeError
)
downloader
.
download
rescue
nil
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0'
,
:type
=>
:rar
))
downloader
.
expects
(
:download
).
raises
(
Pod
::
Downloader
::
Http
::
UnsupportedFileTypeError
)
downloader
.
download
rescue
nil
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