diff options
| author | Jack Nagel | 2013-05-15 12:45:35 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-05-15 12:56:58 -0500 |
| commit | 717de9c6a7750227a6b9576764a9a90ec5a20311 (patch) | |
| tree | 4db99b213cf4a523b8b981385da06f470a7286c4 | |
| parent | eb759a41ef261c8aed3e0e95ed51af3e007ee5a7 (diff) | |
| download | homebrew-717de9c6a7750227a6b9576764a9a90ec5a20311.tar.bz2 | |
cleanup: factor out unqualified cleanup code
| -rw-r--r-- | Library/Homebrew/cmd/cleanup.rb | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb index 257b451f0..8e57b7341 100644 --- a/Library/Homebrew/cmd/cleanup.rb +++ b/Library/Homebrew/cmd/cleanup.rb @@ -7,26 +7,28 @@ module Homebrew extend self def cleanup if ARGV.named.empty? - if HOMEBREW_CELLAR.directory? - HOMEBREW_CELLAR.children.each do |rack| - begin - cleanup_formula Formula.factory(rack.basename.to_s) if rack.directory? - rescue FormulaUnavailableError - # Don't complain about directories from DIY installs - end - end - end - clean_cache - # seems like a good time to do some additional cleanup - unless ARGV.dry_run? - Homebrew.prune - rm_DS_Store - end + cleanup_all else - ARGV.formulae.each do |f| - cleanup_formula f + ARGV.formulae.each { |f| cleanup_formula(f) } + end + end + + def cleanup_all + if HOMEBREW_CELLAR.directory? + HOMEBREW_CELLAR.children.each do |rack| + begin + cleanup_formula Formula.factory(rack.basename.to_s) if rack.directory? + rescue FormulaUnavailableError + # Don't complain about directories from DIY installs + end end end + clean_cache + # seems like a good time to do some additional cleanup + unless ARGV.dry_run? + Homebrew.prune + rm_DS_Store + end end def cleanup_formula f |
