Commit 5384e9f6 authored by Luke Redpath's avatar Luke Redpath

I think using Tempfile might have been causing some issues on Travis.

We don't need to use Tempfile anyway, we can stick the tarball in the pod root and then delete it.
parent 040f22f7
...@@ -75,13 +75,17 @@ module Pod ...@@ -75,13 +75,17 @@ module Pod
end end
def download_and_extract_tarball(id) def download_and_extract_tarball(id)
Tempfile.open('tarball') do |tmpfile| tmp_path = target_path + "tarball.tar.gz"
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
end end
system "tar zxf #{tmpfile.path} -C #{target_path} --strip-components 1" system "tar zxf #{tmpfile.path} -C #{target_path} --strip-components 1"
end end
FileUtils.rm_f(tmp_path)
end end
end end
end end
......
...@@ -76,6 +76,17 @@ describe "Pod::Downloader" do ...@@ -76,6 +76,17 @@ describe "Pod::Downloader" do
# deliberately keep this assertion as loose as possible for now # deliberately keep this assertion as loose as possible for now
(@pod.root + 'README.md').readlines[0].should =~ /PusherTouch/ (@pod.root + 'README.md').readlines[0].should =~ /PusherTouch/
end end
it 'deletes the downloaded tarball after unpacking it' do
@pod.specification.stubs(:source).returns(
:git => "git://github.com/lukeredpath/libPusher.git", :download_only => true
)
downloader = Pod::Downloader.for_pod(@pod)
VCR.use_cassette('tarballs', :record => :new_episodes) { downloader.download }
(@pod.root + 'tarball.tar.gz').should.not.exist
end
end end
describe "for Mercurial" do describe "for Mercurial" do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment