diff options
Diffstat (limited to 'Library/Homebrew/extend')
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 5edd8b664..600e114a6 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -1,11 +1,13 @@ require 'pathname' -require 'bottles' require 'mach' # we enhance pathname to make our code more readable class Pathname include MachO + BOTTLE_EXTNAME_RX = /(\.[a-z]+\.bottle\.(\d+\.)?tar\.gz)$/ + OLD_BOTTLE_EXTNAME_RX = /((\.[a-z]+)?[\.-]bottle\.tar\.gz)$/ + def install *sources results = [] sources.each do |src| @@ -122,8 +124,10 @@ class Pathname # extended to support common double extensions alias extname_old extname def extname - return $1 if to_s =~ bottle_regex - return $1 if to_s =~ old_bottle_regex + BOTTLE_EXTNAME_RX.match to_s + return $1 if $1 + OLD_BOTTLE_EXTNAME_RX.match to_s + return $1 if $1 /(\.(tar|cpio)\.(gz|bz2|xz|Z))$/.match to_s return $1 if $1 return File.extname(to_s) |
