Pathname.version on directories ignores extname

Because directories don't have extensions.

Included test
This commit is contained in:
Max Howell 2009-08-12 13:43:20 +01:00
parent 0fb03b5516
commit 355bfc1751
2 changed files with 13 additions and 0 deletions

View File

@ -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

View File

@ -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