bottle_version: handle pazpar2 style.

This commit is contained in:
Mike McQuaid 2014-03-24 09:56:14 +00:00
parent 0475dbe5cc
commit e4f291084a
2 changed files with 11 additions and 2 deletions

View File

@ -9,12 +9,16 @@ class BottleVersion < Version
# e.g. x264-r2197.4.mavericks.bottle.tar.gz
# e.g. lz4-r114.mavericks.bottle.tar.gz
m = /(r\d+\.?\d*)/.match(stem)
m = /-(r\d+\.?\d*)/.match(stem)
return m.captures.first unless m.nil?
# e.g. 1.6.39 from pazpar2-1.6.39.mavericks.bottle.tar.gz
m = /-(\d+\.\d+(\.\d+)+)/.match(stem)
return m.captures.first unless m.nil?
# e.g. ssh-copy-id-6.2p2.mountain_lion.bottle.tar.gz
# e.g. icu4c-52.1.mountain_lion.bottle.tar.gz
m = /(\d+\.(\d)+(p(\d)+)?)/.match(stem)
m = /-(\d+\.(\d)+(p(\d)+)?)/.match(stem)
return m.captures.first unless m.nil?
super

View File

@ -30,4 +30,9 @@ class BottleVersionParsingTests < Test::Unit::TestCase
assert_version_detected 'r114',
'/usr/local/lz4-r114.mavericks.bottle.tar.gz'
end
def test_pazpar2_style
assert_version_detected '1.6.39',
'/usr/local/pazpar2-1.6.39.mavericks.bottle.tar.gz'
end
end