Class: Hbc::CLI::Outdated

Inherits:
AbstractCommand show all
Defined in:
Library/Homebrew/cask/lib/hbc/cli/outdated.rb

Instance Attribute Summary

Attributes inherited from AbstractCommand

#args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractCommand

abstract?, command_name, needs_init?, run, visible

Methods included from Options

included, #process_arguments

Constructor Details

#initializeOutdated

Returns a new instance of Outdated



7
8
9
10
# File 'Library/Homebrew/cask/lib/hbc/cli/outdated.rb', line 7

def initialize(*)
  super
  self.verbose = ($stdout.tty? || verbose?) && !quiet?
end

Class Method Details

.helpObject



32
33
34
# File 'Library/Homebrew/cask/lib/hbc/cli/outdated.rb', line 32

def self.help
  "list the outdated installed Casks"
end

.list_if_outdated(cask, greedy, verbose) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'Library/Homebrew/cask/lib/hbc/cli/outdated.rb', line 19

def self.list_if_outdated(cask, greedy, verbose)
  return unless cask.outdated?(greedy)

  if verbose
    outdated_versions = cask.outdated_versions(greedy)
    outdated_info   = "#{cask.token} (#{outdated_versions.join(", ")})"
    current_version = cask.version.to_s
    puts "#{outdated_info} != #{current_version}"
  else
    puts cask.token
  end
end

Instance Method Details

#runObject



12
13
14
15
16
17
# File 'Library/Homebrew/cask/lib/hbc/cli/outdated.rb', line 12

def run
  casks(alternative: -> { Hbc.installed }).each do |cask|
    odebug "Checking update info of Cask #{cask}"
    self.class.list_if_outdated(cask, greedy?, verbose?)
  end
end