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
f1072e7e
Commit
f1072e7e
authored
Apr 23, 2012
by
Francis Chong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup http downloader, add spec
parent
be0ee35a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
4 deletions
+66
-4
http.rb
lib/cocoapods/downloader/http.rb
+7
-4
http_spec.rb
spec/unit/http_spec.rb
+59
-0
No files found.
lib/cocoapods/downloader/http.rb
View file @
f1072e7e
...
@@ -10,16 +10,19 @@ module Pod
...
@@ -10,16 +10,19 @@ module Pod
executable
:unzip
executable
:unzip
executable
:tar
executable
:tar
attr_accessor
:
download_file
_path
attr_accessor
:
filename
,
:download
_path
def
download
def
download
type
=
options
[
:type
]
||
type_with_url
(
url
)
@filename
=
filename_with_type
type
filename
=
filename_with_type
type
@download_path
=
target_path
+
@filename
@download_path
=
target_path
+
filename
download_file
@download_path
download_file
@download_path
extract_with_type
@download_path
,
type
extract_with_type
@download_path
,
type
end
end
def
type
options
[
:type
]
||
type_with_url
(
url
)
end
def
clean
def
clean
FileUtils
.
rm
@download_path
FileUtils
.
rm
@download_path
end
end
...
...
spec/unit/http_spec.rb
0 → 100644
View file @
f1072e7e
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
def
stub_pod_with_source
(
source_options
)
specification
=
stub
(
:part_of_other_pod?
=>
false
,
:source
=>
source_options
)
stub
(
'pod'
)
do
stubs
(
:root
).
returns
(
temporary_sandbox
.
root
)
stubs
(
:specification
).
returns
(
specification
)
end
end
describe
Pod
::
Downloader
::
Http
do
it
'should find download file type'
do
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0.zip'
))
downloader
.
should
.
be
.
instance_of
Pod
::
Downloader
::
Http
downloader
.
type
.
should
==
:zip
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0.tar'
))
downloader
.
should
.
be
.
instance_of
Pod
::
Downloader
::
Http
downloader
.
type
.
should
==
:tar
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0.tgz'
))
downloader
.
should
.
be
.
instance_of
Pod
::
Downloader
::
Http
downloader
.
type
.
should
==
:tgz
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0'
,
:type
=>
:zip
))
downloader
.
should
.
be
.
instance_of
Pod
::
Downloader
::
Http
downloader
.
type
.
should
==
:zip
end
it
'should download file and extract it with proper type'
do
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0.zip'
))
downloader
.
expects
(
:download_file
).
with
(
anything
())
downloader
.
expects
(
:extract_with_type
).
with
(
anything
(),
:zip
).
at_least_once
downloader
.
download
downloader
=
Pod
::
Downloader
.
for_pod
(
stub_pod_with_source
(
:http
=>
'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0.tgz'
))
downloader
.
expects
(
:download_file
).
with
(
anything
())
downloader
.
expects
(
:extract_with_type
).
with
(
anything
(),
:tgz
).
at_least_once
downloader
.
download
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