From 552dcdc7035d7114d47751d93630e37ae6d5bf24 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 7 Mar 2012 21:30:03 -0500 Subject: Move most bottle stuff to a bottles.rb file. --- Library/Homebrew/extend/ARGV.rb | 6 ++++-- Library/Homebrew/extend/pathname.rb | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'Library/Homebrew/extend') diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index 59a5087e7..25d19e2e7 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -1,3 +1,5 @@ +require 'bottles' + module HomebrewArgvExtension def named @named ||= reject{|arg| arg[0..0] == '-'} @@ -94,12 +96,12 @@ module HomebrewArgvExtension end def build_bottle? - MacOS.bottles_supported? and include? '--build-bottle' + bottles_supported? and include? '--build-bottle' end def build_from_source? flag? '--build-from-source' or ENV['HOMEBREW_BUILD_FROM_SOURCE'] \ - or not MacOS.bottles_supported? or not options_only.empty? + or not bottles_supported? or not options_only.empty? end def flag? flag diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index f05fc9f5f..34f692f28 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -1,4 +1,5 @@ require 'pathname' +require 'bottles' # we enhance pathname to make our code more readable class Pathname @@ -100,9 +101,9 @@ class Pathname # extended to support common double extensions def extname - return $1 if to_s =~ /(\.[a-z]+\.bottle\.tar\.gz)$/ + return $1 if to_s =~ bottle_regex # old brew bottle style - return $1 if to_s =~ /(-bottle\.tar\.gz)$/ + return $1 if to_s =~ old_bottle_regex /(\.(tar|cpio)\.(gz|bz2|xz|Z))$/.match to_s return $1 if $1 return File.extname(to_s) -- cgit v1.2.3