aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMarkus Reiter2017-05-20 03:38:51 +0200
committerMarkus Reiter2017-05-22 02:51:16 +0200
commited6934b95414e69a80ccb430c46e551cf97a30fc (patch)
treefc748dd4f1458e9c2fd7bbb409d7b0323192ef9e /Library
parent24f38a2e8ad3d6d7f39030ee901dcc496a684a5e (diff)
downloadbrew-ed6934b95414e69a80ccb430c46e551cf97a30fc.tar.bz2
Refactor `CLI::Outdated`.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/outdated.rb19
1 files changed, 13 insertions, 6 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/outdated.rb b/Library/Homebrew/cask/lib/hbc/cli/outdated.rb
index 5956f59ac..8eb387df2 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/outdated.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/outdated.rb
@@ -2,19 +2,26 @@ module Hbc
class CLI
class Outdated < Base
def self.run(*args)
- greedy = args.include?("--greedy")
- verbose = ($stdout.tty? || CLI.verbose?) && !args.include?("--quiet")
+ new(*args).run
+ end
+
+ def initialize(*args)
+ @cask_tokens = self.class.cask_tokens_from(args)
+
+ @greedy = args.include?("--greedy")
+ @verbose = ($stdout.tty? || CLI.verbose?) && !args.include?("--quiet")
+ end
- cask_tokens = cask_tokens_from(args)
- casks_to_check = if cask_tokens.empty?
+ def run
+ casks_to_check = if @cask_tokens.empty?
Hbc.installed
else
- cask_tokens.map { |token| CaskLoader.load(token) }
+ @cask_tokens.map(&CaskLoader.public_method(:load))
end
casks_to_check.each do |cask|
odebug "Checking update info of Cask #{cask}"
- list_if_outdated(cask, greedy, verbose)
+ self.class.list_if_outdated(cask, @greedy, @verbose)
end
end