Class: Homebrew::Cmd::Outdated

Inherits:
AbstractCommand show all
Defined in:
cmd/outdated.rb

Instance Attribute Summary

Attributes inherited from AbstractCommand

#args

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, #initialize, parser

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#runvoid

This method returns an undefined value.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'cmd/outdated.rb', line 50

def run
  case json_version(args.json)
  when :v1
    odie "`brew outdated --json=v1` is no longer supported. Use brew outdated --json=v2 instead."
  when :v2, :default
    formulae, casks = if args.formula?
      [outdated_formulae, []]
    elsif args.cask?
      [[], outdated_casks]
    else
      outdated_formulae_casks
    end

    json = {
      "formulae" => json_info(formulae),
      "casks"    => json_info(casks),
    }
    puts JSON.pretty_generate(json)

    outdated = formulae + casks

  else
    outdated = if args.formula?
      outdated_formulae
    elsif args.cask?
      outdated_casks
    else
      outdated_formulae_casks.flatten
    end

    print_outdated(outdated)
  end

  Homebrew.failed = args.named.present? && outdated.present?
end