From 7d61bfe88f7a6e396eb3addddf0c06e62c5c2175 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 15 Dec 2012 19:06:03 +0000 Subject: [PATCH] Add another Erlang version format. --- Library/Homebrew/test/test_versions.rb | 8 ++++++++ Library/Homebrew/version.rb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/test/test_versions.rb b/Library/Homebrew/test/test_versions.rb index e1566b50e6..f5a7ac8f84 100644 --- a/Library/Homebrew/test/test_versions.rb +++ b/Library/Homebrew/test/test_versions.rb @@ -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 diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index be1ee63c2e..75233c16c1 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -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