bottle_versions: add perforce bottle detection.

This commit is contained in:
Mike McQuaid 2013-08-03 20:03:40 -07:00
parent cfdd23b3ef
commit b507536f80
2 changed files with 9 additions and 0 deletions

View File

@ -3,6 +3,10 @@ class BottleVersion < Version
spec = Pathname.new(spec) unless spec.is_a? Pathname
stem = spec.stem
# e.g. perforce-2013.1.610569-x86_64
m = /-([\d\.]+-x86(_64)?)/.match(stem)
return m.captures.first unless m.nil?
super
end
end

View File

@ -5,4 +5,9 @@ class BottleVersionParsingTests < Test::Unit::TestCase
def assert_version_detected expected, path
assert_equal expected, BottleVersion.parse(path).to_s
end
def test_perforce_style
assert_version_detected '2013.1.610569-x86_64',
'/usr/local/perforce-2013.1.610569-x86_64.mountain_lion.bottle.tar.gz'
end
end