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
92c1befe
Commit
92c1befe
authored
Apr 23, 2012
by
Francis Chong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add http downloader - that download repo with http and then decompress them
parent
6559e58a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
0 deletions
+76
-0
repo.rb
lib/cocoapods/command/repo.rb
+1
-0
downloader.rb
lib/cocoapods/downloader.rb
+3
-0
http.rb
lib/cocoapods/downloader/http.rb
+72
-0
No files found.
lib/cocoapods/command/repo.rb
View file @
92c1befe
require
'fileutils'
require
'fileutils'
require
'yaml'
module
Pod
module
Pod
class
Command
class
Command
...
...
lib/cocoapods/downloader.rb
View file @
92c1befe
...
@@ -6,6 +6,7 @@ module Pod
...
@@ -6,6 +6,7 @@ module Pod
autoload
:GitHub
,
'cocoapods/downloader/git'
autoload
:GitHub
,
'cocoapods/downloader/git'
autoload
:Mercurial
,
'cocoapods/downloader/mercurial'
autoload
:Mercurial
,
'cocoapods/downloader/mercurial'
autoload
:Subversion
,
'cocoapods/downloader/subversion'
autoload
:Subversion
,
'cocoapods/downloader/subversion'
autoload
:Http
,
'cocoapods/downloader/http'
extend
Executable
extend
Executable
...
@@ -40,6 +41,8 @@ module Pod
...
@@ -40,6 +41,8 @@ module Pod
Mercurial
.
new
(
target_path
,
url
,
options
)
Mercurial
.
new
(
target_path
,
url
,
options
)
elsif
url
=
options
.
delete
(
:svn
)
elsif
url
=
options
.
delete
(
:svn
)
Subversion
.
new
(
target_path
,
url
,
options
)
Subversion
.
new
(
target_path
,
url
,
options
)
elsif
url
=
options
.
delete
(
:http
)
Http
.
new
(
target_path
,
url
,
options
)
else
else
raise
"Unsupported download strategy `
#{
options
.
inspect
}
'."
raise
"Unsupported download strategy `
#{
options
.
inspect
}
'."
end
end
...
...
lib/cocoapods/downloader/http.rb
0 → 100644
View file @
92c1befe
require
'open-uri'
require
'tempfile'
require
'zlib'
require
'yaml'
module
Pod
class
Downloader
class
Http
<
Downloader
executable
:curl
executable
:unzip
executable
:tar
attr_accessor
:download_file_path
def
download
type
=
options
[
:type
]
||
type_with_url
(
url
)
filename
=
filename_with_type
type
@download_path
=
target_path
+
filename
download_file
@download_path
extract_with_type
@download_path
,
type
end
def
clean
FileUtils
.
rm
@download_path
end
private
def
type_with_url
(
url
)
if
url
=~
/.zip$/
:zip
elsif
url
=~
/.tgz$/
:tgz
elsif
url
=~
/.tar$/
:tar
else
nil
end
end
def
filename_with_type
(
type
=
:zip
)
case
type
when
:zip
"file.zip"
when
:tgz
"file.tgz"
when
:tar
"file.tar"
else
raise
"Pod::Downloader::Http Unsupported file type:
#{
type
}
"
end
end
def
download_file
(
full_filename
)
curl
"-L -o '
#{
full_filename
}
' '
#{
url
}
'"
end
def
extract_with_type
(
full_filename
,
type
=
:zip
)
case
type
when
:zip
unzip
"'
#{
full_filename
}
' -d
#{
target_path
}
"
when
:tgz
tar
"xfz '
#{
full_filename
}
' -d
#{
target_path
}
"
when
:tar
tar
"xf '
#{
full_filename
}
' -d
#{
target_path
}
"
else
raise
"Http Downloader: Unsupported file type"
end
end
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