Add another Erlang version format.

This commit is contained in:
Mike McQuaid 2012-12-15 19:06:03 +00:00
parent 5ce1caa1f3
commit 7d61bfe88f
2 changed files with 9 additions and 1 deletions

View File

@ -97,6 +97,10 @@ class VersionParsingTests < Test::Unit::TestCase
assert_version_detected 'R15B01', 'https://github.com/erlang/otp/tarball/OTP_R15B01'
end
def test_yet_another_erlang_version_style
assert_version_detected 'R15B03-1', 'https://github.com/erlang/otp/tarball/OTP_R15B03-1'
end
def test_p7zip_version_style
assert_version_detected '9.04',
'http://kent.dl.sourceforge.net/sourceforge/p7zip/p7zip_9.04_src_all.tar.bz2'
@ -211,6 +215,10 @@ class VersionParsingTests < Test::Unit::TestCase
assert_version_detected 'R15B01', 'https://downloads.sf.net/project/machomebrew/Bottles/erlang-R15B01.mountainlion.bottle.tar.gz'
end
def test_yet_another_erlang_bottle_style
assert_version_detected 'R15B03-1', 'https://downloads.sf.net/project/machomebrew/Bottles/erlang-R15B03-1.mountainlion.bottle.tar.gz'
end
def test_old_bottle_style
assert_version_detected '4.7.3', 'https://downloads.sf.net/project/machomebrew/Bottles/qt-4.7.3-bottle.tar.gz'
end

View File

@ -128,7 +128,7 @@ class Version
return m.captures.first unless m.nil?
# e.g. https://github.com/erlang/otp/tarball/OTP_R15B01 (erlang style)
m = /[-_](R\d+[AB]\d*)/.match(spec.to_s)
m = /[-_](R\d+[AB]\d*(-\d+)?)/.match(spec.to_s)
return m.captures.first unless m.nil?
# e.g. boost_1_39_0