aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2009-08-12 13:43:20 +0100
committerMax Howell2009-08-12 13:43:20 +0100
commit355bfc1751a53f35689ea42b40a4211a4f42b641 (patch)
tree1c3ff6c84ffc2f6363d1da123849d94e4f04fea7 /Library
parent0fb03b5516895af8f37206291071009314580cc7 (diff)
downloadbrew-355bfc1751a53f35689ea42b40a4211a4f42b641.tar.bz2
Pathname.version on directories ignores extname
Because directories don't have extensions. Included test
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/pathname+yeast.rb7
-rwxr-xr-xLibrary/Homebrew/unittest.rb6
2 files changed, 13 insertions, 0 deletions
diff --git a/Library/Homebrew/pathname+yeast.rb b/Library/Homebrew/pathname+yeast.rb
index 894c26e4b..30f2a254c 100644
--- a/Library/Homebrew/pathname+yeast.rb
+++ b/Library/Homebrew/pathname+yeast.rb
@@ -87,6 +87,13 @@ class Pathname
end
def version
+ if directory?
+ # directories don't have extnames
+ stem=basename.to_s
+ else
+ stem=self.stem
+ end
+
# github tarballs are special
# we only support numbered tagged downloads
%r[github.com/.*/tarball/((\d\.)+\d)$].match to_s
diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb
index 22e36847a..adbfd4afb 100755
--- a/Library/Homebrew/unittest.rb
+++ b/Library/Homebrew/unittest.rb
@@ -294,4 +294,10 @@ class BeerTasting <Test::Unit::TestCase
assert_equal 1, ARGV.kegs.length
assert_raises(FormulaUnavailableError) { ARGV.formulae }
end
+
+ def test_version_dir
+ d=HOMEBREW_CELLAR+'foo-0.1.9'
+ d.mkpath
+ assert_equal '0.1.9', d.version
+ end
end