Skip to content

Commit

Permalink
Merge pull request #783 from kbok/master
Browse files Browse the repository at this point in the history
Do not flatten the zip files downloaded via http
  • Loading branch information
alloy committed Feb 7, 2013
2 parents 0be241d + 1599c29 commit 16d018e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions lib/cocoapods/downloader/http.rb
Expand Up @@ -74,12 +74,14 @@ def extract_with_type(full_filename, type=:zip)
raise UnsupportedFileTypeError.new "Unsupported file type: #{type}"
end

# If the archive only contained a folder, move its contents to the target (#727)
contents = target_path.children
contents.delete(full_filename)
entry = contents.first
if contents.count == 1 && entry.directory?
FileUtils.move(entry.children, target_path)
# If the archive is a tarball and it only contained a folder, move its contents to the target (#727)
if [:tgz, :tar, :tbz].include? type
contents = target_path.children
contents.delete(full_filename)
entry = contents.first
if contents.count == 1 && entry.directory?
FileUtils.move(entry.children, target_path)
end
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/functional/downloader_spec.rb
Expand Up @@ -74,8 +74,8 @@ module Pod
downloader = Downloader.for_pod(@pod)
VCR.use_cassette('tarballs', :record => :new_episodes) { downloader.download }

(@pod.root + 'GADSearchRequest.h').should.exist
(@pod.root + 'GADSearchRequest.h').read.strip.should =~ /Google Search Ads iOS SDK/
(@pod.root + 'GoogleAdMobSearchAdsSDK/GADSearchRequest.h').should.exist
(@pod.root + 'GoogleAdMobSearchAdsSDK/GADSearchRequest.h').read.strip.should =~ /Google Search Ads iOS SDK/
end

it "raises if it fails to download" do
Expand Down

0 comments on commit 16d018e

Please sign in to comment.