Move getting formula names from bottles to method.

This commit is contained in:
Mike McQuaid 2013-07-04 11:21:50 +01:00
parent e3a7260c1a
commit 4f2725cde3
2 changed files with 8 additions and 3 deletions

View File

@ -89,3 +89,10 @@ def bottle_tag
Hardware::CPU.type == :ppc ? Hardware::CPU.family : MacOS.cat Hardware::CPU.type == :ppc ? Hardware::CPU.family : MacOS.cat
end end
end end
def bottle_filename_formula_name filename
version = Version.parse(filename).to_s
path = Pathname.new filename
basename = path.basename.to_s
basename.rpartition("-#{version}").first
end

View File

@ -59,9 +59,7 @@ class Formulary
class BottleLoader < FormulaLoader class BottleLoader < FormulaLoader
def initialize bottle_name def initialize bottle_name
@bottle_filename = Pathname(bottle_name).realpath @bottle_filename = Pathname(bottle_name).realpath
version = Version.parse(@bottle_filename).to_s name_without_version = bottle_filename_formula_name @bottle_filename
bottle_basename = @bottle_filename.basename.to_s
name_without_version = bottle_basename.rpartition("-#{version}").first
if name_without_version.empty? if name_without_version.empty?
if ARGV.homebrew_developer? if ARGV.homebrew_developer?
opoo "Add a new version regex to version.rb to parse this filename." opoo "Add a new version regex to version.rb to parse this filename."