aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2012-01-12 20:08:35 -0600
committerJack Nagel2012-01-12 20:31:47 -0600
commit749a3538fe74a7d4e85d63687fb49a8e30248ddf (patch)
tree80fc9d09d962f013f08c0de60a584eabc6751cfc /Library
parent7c9a7b42729ae949e5c57fedb8b7d58fda3dc086 (diff)
downloadhomebrew-749a3538fe74a7d4e85d63687fb49a8e30248ddf.tar.bz2
pathname: recognize ".cpio.*" double extensions
Just a cosmetic nicety. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/pathname.rb4
-rw-r--r--Library/Homebrew/test/test_bucket.rb5
2 files changed, 7 insertions, 2 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index 018547ff8..a83ef31af 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -62,9 +62,9 @@ class Pathname
return dst
end
- # extended to support the double extensions .tar.gz, .tar.bz2, and .tar.xz
+ # extended to support common double extensions
def extname
- /(\.tar\.(gz|bz2|xz))$/.match to_s
+ /(\.(tar|cpio)\.(gz|bz2|xz))$/.match to_s
return $1 if $1
return File.extname(to_s)
end
diff --git a/Library/Homebrew/test/test_bucket.rb b/Library/Homebrew/test/test_bucket.rb
index f328dacca..fda9f356f 100644
--- a/Library/Homebrew/test/test_bucket.rb
+++ b/Library/Homebrew/test/test_bucket.rb
@@ -180,6 +180,11 @@ class BeerTasting < Test::Unit::TestCase
assert_equal '.tar.gz', foo1.extname
assert_equal 'foo-0.1', foo1.stem
assert_equal '0.1', foo1.version
+
+ foo1 = HOMEBREW_CACHE/'foo-0.1.cpio.gz'
+ assert_equal '.cpio.gz', foo1.extname
+ assert_equal 'foo-0.1', foo1.stem
+ assert_equal '0.1', foo1.version
end
class MockMockFormula < Struct.new(:name); end