Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support LZMA2 compressed tarballs #5

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/cocoapods-downloader/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def type
def should_flatten?
if options.has_key?(:flatten)
true
elsif [:tgz, :tar, :tbz].include?(type)
elsif [:tgz, :tar, :tbz, :txz].include?(type)
true # those archives flatten by default
else
false # all others (actually only .zip) default not to flatten
Expand All @@ -59,6 +59,8 @@ def type_with_url(url)
:tar
elsif url =~ /.(tbz|tar\.bz2)$/
:tbz
elsif url =~ /.(txz|tar\.xz)$/
:txz
else
nil
end
Expand All @@ -74,6 +76,8 @@ def filename_with_type(type=:zip)
"file.tar"
when :tbz
"file.tbz"
when :txz
"file.txz"
else
raise UnsupportedFileTypeError.new "Unsupported file type: #{type}"
end
Expand All @@ -93,6 +97,8 @@ def extract_with_type(full_filename, type=:zip)
tar! "xf '#{full_filename}' -C '#{target_path}'"
when :tbz
tar! "xfj '#{full_filename}' -C '#{target_path}'"
when :txz
tar! "xf '#{full_filename}' -C '#{target_path}'"
else
raise UnsupportedFileTypeError.new "Unsupported file type: #{type}"
end
Expand Down
6 changes: 6 additions & 0 deletions spec/cocoapods-downloaders/http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ module Downloader
downloader.send(:type).should == :tbz
end

it 'detects txz files' do
options = { :http => 'https://file.txz' }
downloader = Downloader.for_target(tmp_folder, options)
downloader.send(:type).should == :txz
end

it 'allows to specify the file type in the sources' do
options = { :http => 'https://file', :type => :zip }
downloader = Downloader.for_target(tmp_folder, options)
Expand Down