Class: Homebrew::Cmd::UpgradeCmd Private

Inherits:
AbstractCommand show all
Defined in:
cmd/upgrade.rb,
sorbet/rbi/dsl/homebrew/cmd/upgrade_cmd.rbi

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Defined Under Namespace

Classes: Args

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, dev_cmd?, #initialize, parser, ruby_cmd?

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#argsHomebrew::Cmd::UpgradeCmd::Args

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



10
# File 'sorbet/rbi/dsl/homebrew/cmd/upgrade_cmd.rbi', line 10

def args; end

#runvoid

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'cmd/upgrade.rb', line 122

def run
  if args.build_from_source? && args.named.empty?
    raise ArgumentError, "--build-from-source requires at least one formula"
  end

  formulae, casks = args.named.to_resolved_formulae_to_casks
  # If one or more formulae are specified, but no casks were
  # specified, we want to make note of that so we don't
  # try to upgrade all outdated casks.
  only_upgrade_formulae = formulae.present? && casks.blank?
  only_upgrade_casks = casks.present? && formulae.blank?

  formulae = Homebrew::Attestation.sort_formulae_for_install(formulae) if Homebrew::Attestation.enabled?

  upgrade_outdated_formulae(formulae) unless only_upgrade_casks
  upgrade_outdated_casks(casks) unless only_upgrade_formulae

  Cleanup.periodic_clean!(dry_run: args.dry_run?)

  Homebrew.messages.display_messages(display_times: args.display_times?)
end