Remove duplicated logic from FromUrlLoader
This commit is contained in:
parent
2bf1f93721
commit
633f29af5d
@ -143,23 +143,10 @@ class Formulary
|
|||||||
super formula, HOMEBREW_CACHE_FORMULA/File.basename(uri.path)
|
super formula, HOMEBREW_CACHE_FORMULA/File.basename(uri.path)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Downloads the formula's .rb file
|
def load_file
|
||||||
def fetch
|
HOMEBREW_CACHE_FORMULA.mkpath
|
||||||
begin
|
FileUtils.rm_f(path)
|
||||||
have_klass = Formulary.formula_class_defined? class_name
|
curl url, "-o", path
|
||||||
rescue NameError
|
|
||||||
raise FormulaUnavailableError.new(name)
|
|
||||||
end
|
|
||||||
|
|
||||||
unless have_klass
|
|
||||||
HOMEBREW_CACHE_FORMULA.mkpath
|
|
||||||
FileUtils.rm path.to_s, :force => true
|
|
||||||
curl url, '-o', path.to_s
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_formula(spec)
|
|
||||||
fetch
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user