brew-pull: avoid the "var = ... rescue nil" dance

This commit is contained in:
Jack Nagel 2014-07-05 17:44:14 -05:00
parent 01dc9c4900
commit 4ab696e4f2

View File

@ -80,7 +80,6 @@ ARGV.named.each do |arg|
changed_formulae = [] changed_formulae = []
if tap_dir if tap_dir
formula_dir = %w[Formula HomebrewFormula].find { |d| tap_dir.join(d).directory? } || "" formula_dir = %w[Formula HomebrewFormula].find { |d| tap_dir.join(d).directory? } || ""
else else
@ -95,9 +94,12 @@ ARGV.named.each do |arg|
# Don't try and do anything to removed files. # Don't try and do anything to removed files.
if status == "A" || status == "M" if status == "A" || status == "M"
name = File.basename(filename, ".rb") name = File.basename(filename, ".rb")
formula = Formula[name] rescue nil
next unless formula begin
changed_formulae << formula changed_formulae << Formula[name]
rescue FormulaUnavailableError
next
end
end end
end end