aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/cask/lib')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/cleanup.rb22
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/doctor.rb2
2 files changed, 7 insertions, 17 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb b/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb
index 9ebccabd0..a62b8d069 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb
@@ -13,29 +13,19 @@ module Hbc
end
def self.run(*args)
- if args.empty?
- default.cleanup!
- else
- default.cleanup(args)
- end
- end
-
- def self.default
- @default ||= new(Hbc.cache, CLI.outdated?)
+ new(*args).run
end
attr_reader :cache_location, :outdated_only
- def initialize(cache_location, outdated_only)
+
+ def initialize(*args, cache_location: Hbc.cache, outdated_only: CLI.outdated?)
+ @args = args
@cache_location = Pathname.new(cache_location)
@outdated_only = outdated_only
end
- def cleanup!
- remove_cache_files
- end
-
- def cleanup(tokens)
- remove_cache_files(*tokens)
+ def run
+ remove_cache_files(*@args)
end
def cache_files
diff --git a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
index 031f78824..11917ae6b 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
@@ -107,7 +107,7 @@ module Hbc
end
def self.render_cached_downloads
- cleanup = CLI::Cleanup.default
+ cleanup = CLI::Cleanup.new
count = cleanup.cache_files.count
size = cleanup.disk_cleanup_size
msg = user_tilde(Hbc.cache.to_s)