aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2013-07-04 11:21:50 +0100
committerMike McQuaid2013-07-18 09:56:55 -0700
commit4f2725cde35e0a9f528a8aedd265c6ff85c8e067 (patch)
tree1dfd423c58dff82c4e16e357c5b7a1e19d78104c
parente3a7260c1a18a0c67322bdaabe381e3132f26224 (diff)
downloadbrew-4f2725cde35e0a9f528a8aedd265c6ff85c8e067.tar.bz2
Move getting formula names from bottles to method.
-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."