aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2014-03-07 17:23:44 -0600
committerJack Nagel2014-03-07 17:30:39 -0600
commit29a869de2f6174f191aefced785efc80603cab5e (patch)
tree1d26139052c071577077bbe175e858c060f0b3e3 /Library
parent44a94143e16549ed59f142ee4a1b63b1b6119ac3 (diff)
downloadhomebrew-29a869de2f6174f191aefced785efc80603cab5e.tar.bz2
FormulaLoader: pull shared behavior into superclass
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formulary.rb23
1 files changed, 8 insertions, 15 deletions
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb
index 9ad2e0944..8baf95b1b 100644
--- a/Library/Homebrew/formulary.rb
+++ b/Library/Homebrew/formulary.rb
@@ -38,8 +38,9 @@ class Formulary
attr_reader :path
# Gets the formula instance.
- # Subclasses must define this.
- def get_formula; end
+ def get_formula
+ klass.new(name, path)
+ end
# Return the Class for this formula, `require`-ing it if
# it has not been parsed before.
@@ -89,9 +90,9 @@ class Formulary
end
def get_formula
- formula = klass.new(name, path)
+ formula = super
formula.local_bottle_path = @bottle_filename
- return formula
+ formula
end
end
@@ -101,10 +102,6 @@ class Formulary
@name = name
@path = Formula.path(name)
end
-
- def get_formula
- klass.new(name, path)
- end
end
# Loads formulae from disk using a path
@@ -117,10 +114,6 @@ class Formulary
@path = Pathname.new(path).expand_path
@name = @path.stem
end
-
- def get_formula
- klass.new(name, path)
- end
end
# Loads formulae from URLs
@@ -143,7 +136,8 @@ class Formulary
end
def get_formula
- return klass.new(name, path)
+ fetch
+ super
end
end
@@ -155,7 +149,7 @@ class Formulary
end
def get_formula
- klass.new(name, path)
+ super
rescue FormulaUnavailableError => e
raise TapFormulaUnavailableError.new(e.name)
end
@@ -171,7 +165,6 @@ class Formulary
# If a URL is passed, download to the cache and install
if ref =~ %r[(https?|ftp)://]
f = FromUrlLoader.new(ref)
- f.fetch
elsif ref =~ Pathname::BOTTLE_EXTNAME_RX
f = BottleLoader.new(ref)
else