cleanup: rename variable

This commit is contained in:
Jack Nagel 2013-05-15 12:45:38 -05:00
parent b26c502f79
commit 5b5bb57865

View File

@ -62,18 +62,18 @@ module Homebrew extend self
def cleanup_cache def cleanup_cache
return unless HOMEBREW_CACHE.directory? return unless HOMEBREW_CACHE.directory?
HOMEBREW_CACHE.children.select(&:file?).each do |pn| HOMEBREW_CACHE.children.select(&:file?).each do |file|
version = pn.version version = file.version
name = pn.basename.to_s.match(/(.*)-(#{version})/).captures.first rescue nil name = file.basename.to_s.match(/(.*)-(#{version})/).captures.first rescue nil
if name and version if name and version
f = Formula.factory(name) rescue nil f = Formula.factory(name) rescue nil
old_bottle = bottle_file_outdated? f, pn old_bottle = bottle_file_outdated? f, file
if (f and f.version > version) or (ARGV.switch? "s" and (f and (not f.installed?))) or old_bottle if (f and f.version > version) or (ARGV.switch? "s" and (f and (not f.installed?))) or old_bottle
if ARGV.dry_run? if ARGV.dry_run?
puts "Would remove: #{pn}" puts "Would remove: #{file}"
else else
puts "Removing: #{pn}..." puts "Removing: #{file}..."
rm pn rm file
end end
end end
end end