aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/bottle_version.rb
blob: 0711dc3494b90e564300b9a919e44fc0345446b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class BottleVersion < Version
  def self._parse spec
    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?

    # e.g. ssh-copy-id-6.2p2.bottle.tar.gz
    # e.g. icu4c-52.1.bottle.tar.gz
    m = /(\d+\.(\d)+(p(\d)+)?)/.match(stem)
    return m.captures.first unless m.nil?

    super
  end
end