aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2013-07-04 11:21:50 +0100
committerMike McQuaid2013-07-18 09:56:55 -0700
commitc83c386bf99d5643c2f9212dd93cc558b4d9f764 (patch)
tree35bb0af3ba85fcdf6f3b7aa9385f89a5c046f3d1 /Library
parent3d0f8ebe1b16f8fe92a8b2e813f06c7fe0711b53 (diff)
downloadhomebrew-c83c386bf99d5643c2f9212dd93cc558b4d9f764.tar.bz2
Move getting formula names from bottles to method.
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."