Class: Cask::Cmd::Outdated

Inherits:
AbstractCommand show all
Defined in:
brew/Library/Homebrew/cask/cmd/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, run, visible

Methods included from Homebrew::Search

#query_regexp, #search_casks, #search_descriptions, #search_formulae, #search_taps

Methods included from Options

#process_arguments

Constructor Details

#initializeOutdated

Returns a new instance of Outdated



9
10
11
12
# File 'brew/Library/Homebrew/cask/cmd/outdated.rb', line 9

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

Class Method Details

.helpObject



34
35
36
# File 'brew/Library/Homebrew/cask/cmd/outdated.rb', line 34

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

.list_if_outdated(cask, greedy, verbose) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'brew/Library/Homebrew/cask/cmd/outdated.rb', line 21

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



14
15
16
17
18
19
# File 'brew/Library/Homebrew/cask/cmd/outdated.rb', line 14

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