aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/bottles.rb7
-rw-r--r--Library/Homebrew/formulary.rb4
2 files changed, 8 insertions, 3 deletions
diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb
index a15d65e85..60a4dcca0 100644
--- a/Library/Homebrew/bottles.rb
+++ b/Library/Homebrew/bottles.rb
@@ -89,3 +89,10 @@ def bottle_tag
Hardware::CPU.type == :ppc ? Hardware::CPU.family : MacOS.cat
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
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb
index 94d1679c3..34ce76822 100644
--- a/Library/Homebrew/formulary.rb
+++ b/Library/Homebrew/formulary.rb
@@ -59,9 +59,7 @@ class Formulary
class BottleLoader < FormulaLoader
def initialize bottle_name
@bottle_filename = Pathname(bottle_name).realpath
- version = Version.parse(@bottle_filename).to_s
- bottle_basename = @bottle_filename.basename.to_s
- name_without_version = bottle_basename.rpartition("-#{version}").first
+ name_without_version = bottle_filename_formula_name @bottle_filename
if name_without_version.empty?
if ARGV.homebrew_developer?
opoo "Add a new version regex to version.rb to parse this filename."