Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Support extracting .tar.bz2 files #522

Merged
merged 1 commit into from

2 participants

Brad Taylor Fabio Pelosin
Brad Taylor

Chartboost (and likely other sites) distribute source code in bz2
format. Support for recognizing and extracting these files will come in
handy.

Brad Taylor btaylor Support extracting .tar.bz2 files
Chartboost (and likely other sites) distribute source code in bz2
format.  Support for recognizing and extracting these files will come in
handy.
85a9df7
Fabio Pelosin fabiopelosin merged commit 28e3ec4 into from
Fabio Pelosin

Looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 14, 2012
  1. Brad Taylor

    Support extracting .tar.bz2 files

    btaylor authored
    Chartboost (and likely other sites) distribute source code in bz2
    format.  Support for recognizing and extracting these files will come in
    handy.
This page is out of date. Refresh to see the latest.
Showing with 19 additions and 0 deletions.
  1. +6 −0 lib/cocoapods/downloader/http.rb
  2. +13 −0 spec/unit/http_spec.rb
6 lib/cocoapods/downloader/http.rb
View
@@ -33,6 +33,8 @@ def type_with_url(url)
:tgz
elsif url =~ /.tar$/
:tar
+ elsif url =~ /.(tbz|tar\.bz2)$/
+ :tbz
else
nil
end
@@ -46,6 +48,8 @@ def filename_with_type(type=:zip)
"file.tgz"
when :tar
"file.tar"
+ when :tbz
+ "file.tbz"
else
raise UnsupportedFileTypeError.new "Unsupported file type: #{type}"
end
@@ -63,6 +67,8 @@ def extract_with_type(full_filename, type=:zip)
tar! "xfz '#{full_filename}' -C '#{target_path}'"
when :tar
tar! "xf '#{full_filename}' -C '#{target_path}'"
+ when :tbz
+ tar! "xfj '#{full_filename}' -C '#{target_path}'"
else
raise UnsupportedFileTypeError.new "Unsupported file type: #{type}"
end
13 spec/unit/http_spec.rb
View
@@ -33,6 +33,12 @@ def stub_pod_with_source(source_options)
downloader.type.should == :tgz
downloader = Pod::Downloader.for_pod(stub_pod_with_source(
+ :http => 'http://www.kernel.org/pub/linux/kernel/v1.0/linux-1.0.tar.bz2'
+ ))
+ downloader.should.be.instance_of Pod::Downloader::Http
+ downloader.type.should == :tbz
+
+ downloader = Pod::Downloader.for_pod(stub_pod_with_source(
:http => 'https://testflightapp.com/media/sdk-downloads/TestFlightSDK1.0',
:type => :zip
))
@@ -54,6 +60,13 @@ def stub_pod_with_source(source_options)
downloader.expects(:download_file).with(anything())
downloader.expects(:extract_with_type).with(anything(), :tgz).at_least_once
downloader.download
+
+ downloader = Pod::Downloader.for_pod(stub_pod_with_source(
+ :http => 'http://www.kernel.org/pub/linux/kernel/v1.0/linux-1.0.tar.bz2'
+ ))
+ downloader.expects(:download_file).with(anything())
+ downloader.expects(:extract_with_type).with(anything(), :tbz).at_least_once
+ downloader.download
end
it 'should raise error when unsupported filetype is pass' do
Something went wrong with that request. Please try again.