2013-08-03 20:02:10 -07:00
|
|
|
class BottleVersion < Version
|
|
|
|
def self._parse spec
|
|
|
|
spec = Pathname.new(spec) unless spec.is_a? Pathname
|
|
|
|
stem = spec.stem
|
|
|
|
|
2014-02-22 17:14:51 +00:00
|
|
|
# e.g. perforce-2013.1.610569-x86_64.mountain_lion.bottle.tar.gz
|
2013-08-03 20:03:40 -07:00
|
|
|
m = /-([\d\.]+-x86(_64)?)/.match(stem)
|
|
|
|
return m.captures.first unless m.nil?
|
|
|
|
|
2014-02-22 17:15:15 +00:00
|
|
|
# e.g. x264-r2197.4.mavericks.bottle.tar.gz
|
2014-03-17 10:35:53 +00:00
|
|
|
# e.g. lz4-r114.mavericks.bottle.tar.gz
|
|
|
|
m = /(r\d+\.?\d*)/.match(stem)
|
2014-02-22 17:15:15 +00:00
|
|
|
return m.captures.first unless m.nil?
|
|
|
|
|
2014-02-22 17:14:51 +00:00
|
|
|
# e.g. ssh-copy-id-6.2p2.mountain_lion.bottle.tar.gz
|
|
|
|
# e.g. icu4c-52.1.mountain_lion.bottle.tar.gz
|
2013-10-11 08:40:08 +01:00
|
|
|
m = /(\d+\.(\d)+(p(\d)+)?)/.match(stem)
|
2013-08-03 20:03:58 -07:00
|
|
|
return m.captures.first unless m.nil?
|
|
|
|
|
2013-08-03 20:02:10 -07:00
|
|
|
super
|
|
|
|
end
|
|
|
|
end
|