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
d00517d5
Commit
d00517d5
authored
Apr 27, 2012
by
Francis Chong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure pod removes the .git directory when cleaning (using github downloader)
parent
819d1eb0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
git.rb
lib/cocoapods/downloader/git.rb
+9
-5
downloader_spec.rb
spec/functional/downloader_spec.rb
+13
-1
No files found.
lib/cocoapods/downloader/git.rb
View file @
d00517d5
...
@@ -60,13 +60,21 @@ module Pod
...
@@ -60,13 +60,21 @@ module Pod
end
end
def
clean
def
clean
# no-op
if
download_only?
FileUtils
.
rm_f
(
tmp_path
)
else
super
end
end
end
def
tarball_url_for
(
id
)
def
tarball_url_for
(
id
)
original_url
,
username
,
reponame
=
*
(
url
.
match
(
/[:\/]([\w\-]+)\/([\w\-]+)\.git/
).
to_a
)
original_url
,
username
,
reponame
=
*
(
url
.
match
(
/[:\/]([\w\-]+)\/([\w\-]+)\.git/
).
to_a
)
"https://github.com/
#{
username
}
/
#{
reponame
}
/tarball/
#{
id
}
"
"https://github.com/
#{
username
}
/
#{
reponame
}
/tarball/
#{
id
}
"
end
end
def
tmp_path
target_path
+
"tarball.tar.gz"
end
private
private
...
@@ -75,8 +83,6 @@ module Pod
...
@@ -75,8 +83,6 @@ module Pod
end
end
def
download_and_extract_tarball
(
id
)
def
download_and_extract_tarball
(
id
)
tmp_path
=
target_path
+
"tarball.tar.gz"
File
.
open
(
tmp_path
,
"w+"
)
do
|
tmpfile
|
File
.
open
(
tmp_path
,
"w+"
)
do
|
tmpfile
|
open
tarball_url_for
(
id
)
do
|
archive
|
open
tarball_url_for
(
id
)
do
|
archive
|
tmpfile
.
write
Zlib
::
GzipReader
.
new
(
archive
).
read
tmpfile
.
write
Zlib
::
GzipReader
.
new
(
archive
).
read
...
@@ -84,8 +90,6 @@ module Pod
...
@@ -84,8 +90,6 @@ module Pod
system
"tar xf
#{
tmpfile
.
path
}
-C
#{
target_path
}
--strip-components 1"
system
"tar xf
#{
tmpfile
.
path
}
-C
#{
target_path
}
--strip-components 1"
end
end
FileUtils
.
rm_f
(
tmp_path
)
end
end
end
end
end
end
...
...
spec/functional/downloader_spec.rb
View file @
d00517d5
...
@@ -84,9 +84,21 @@ describe "Pod::Downloader" do
...
@@ -84,9 +84,21 @@ describe "Pod::Downloader" do
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
VCR
.
use_cassette
(
'tarballs'
,
:record
=>
:new_episodes
)
{
downloader
.
download
}
VCR
.
use_cassette
(
'tarballs'
,
:record
=>
:new_episodes
)
{
downloader
.
download
}
downloader
.
clean
(
@pod
.
root
+
'tarball.tar.gz'
).
should
.
not
.
exist
(
@pod
.
root
+
'tarball.tar.gz'
).
should
.
not
.
exist
end
end
it
"removes the .git directory when cleaning"
do
@pod
.
specification
.
stubs
(
:source
).
returns
(
:git
=>
"git://github.com/lukeredpath/libPusher.git"
,
:download_only
=>
false
)
downloader
=
Pod
::
Downloader
.
for_pod
(
@pod
)
downloader
.
download
downloader
.
clean
(
@pod
.
root
+
'.git'
).
should
.
not
.
exist
end
end
end
describe
"for Mercurial"
do
describe
"for Mercurial"
do
...
...
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