Fix: Flatten extracted archives analogous to cocoapods-downloader #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a universal package contains a single tar archive, this archive will automatically be extracted. This is great, however for tar archives (among others) it's common that they contain a single directory with the same name as the tar file (without the
.tar
or.tar.gz
extension). Theextract_with_type
function defined in thecocoapods-downloader
module usually takes care of extracting the children of such folders, in order to create the correct structure for installing the CocoaPod. However, for this to work, we have to set some properties/options before callingextract_with_type
:filename
: This property is used by theextract_with_type
function to distinguish the archive from the extracted directory (see https://github.com/CocoaPods/cocoapods-downloader/blob/master/lib/cocoapods-downloader/remote_file.rb#L109).type
: Whether an extracted directory should be flattened is decided according to the type of its corresponding archive. If we don't set the type explicitly,cocoapods-downloader
will determine the type automatically from theurl
property, which in case of universal packages, does not contain the.tar
or any other archive type extension. We therefore need to set the type explicitly for the flattening to work (see https://github.com/CocoaPods/cocoapods-downloader/blob/master/lib/cocoapods-downloader/remote_file.rb#L52 and https://github.com/CocoaPods/cocoapods-downloader/blob/master/lib/cocoapods-downloader/remote_file.rb#L30)