Fix lame version, eg. 398-2
Included test this time!
This commit is contained in:
parent
111a75d262
commit
d62fd87436
@ -96,6 +96,9 @@ class Pathname
|
||||
out<<`du -hd0 #{to_s} | cut -d"\t" -f1`.strip
|
||||
end
|
||||
|
||||
# attempts to retrieve the version component of this path, so generally
|
||||
# you'll call it on tarballs or extracted tarball directories, if you add
|
||||
# to this please provide amend the unittest
|
||||
def version
|
||||
if directory?
|
||||
# directories don't have extnames
|
||||
@ -108,7 +111,7 @@ class Pathname
|
||||
# we only support numbered tagged downloads
|
||||
%r[github.com/.*/tarball/((\d\.)+\d)$].match to_s
|
||||
return $1 if $1
|
||||
|
||||
|
||||
# eg. boost_1_39_0
|
||||
/((\d+_)+\d+)$/.match stem
|
||||
return $1.gsub('_', '.') if $1
|
||||
@ -117,6 +120,10 @@ class Pathname
|
||||
# eg. ruby-1.9.1-p243
|
||||
/-((\d+\.)*\d\.\d+-p?\d+)$/.match stem
|
||||
return $1 if $1
|
||||
|
||||
# eg. lame-398-1
|
||||
/-((\d)+-\d)/.match stem
|
||||
return $1 if $1
|
||||
|
||||
# eg. foobar-4.5.1
|
||||
/-((\d+\.)*\d+)$/.match stem
|
||||
|
||||
@ -374,6 +374,11 @@ class BeerTasting <Test::Unit::TestCase
|
||||
assert_equal '0.1.9', d.version
|
||||
end
|
||||
|
||||
def test_lame_version_style
|
||||
f=MockFormula.new 'http://kent.dl.sourceforge.net/sourceforge/lame/lame-398-2.tar.gz'
|
||||
assert_equal '398-2', f.version
|
||||
end
|
||||
|
||||
def test_ruby_version_style
|
||||
f=MockFormula.new 'ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.gz'
|
||||
assert_equal '1.9.1-p243', f.version
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user