Class: Homebrew::Cmd::Reinstall Private

Inherits:
AbstractCommand show all
Defined in:
cmd/reinstall.rb,
sorbet/rbi/dsl/homebrew/cmd/reinstall.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

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#argsHomebrew::Cmd::Reinstall::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/reinstall.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.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'cmd/reinstall.rb', line 110

def run
  formulae, casks = T.cast(
    args.named.to_resolved_formulae_to_casks,
    [T::Array[Formula], T::Array[Cask::Cask]],
  )

  if args.build_from_source?
    unless DevelopmentTools.installed?
      raise BuildFlagsError.new(["--build-from-source"], bottled: formulae.all?(&:bottled?))
    end

    unless Homebrew::EnvConfig.developer?
      opoo "building from source is not supported!"
      puts "You're on your own. Failures are expected so don't create any issues, please!"
    end
  end

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

  Install.perform_preinstall_checks

  formulae.each do |formula|
    if formula.pinned?
      onoe "#{formula.full_name} is pinned. You must unpin it to reinstall."
      next
    end
    Migrator.migrate_if_needed(formula, force: args.force?)
    Homebrew.reinstall_formula(
      formula,
      flags:                      args.flags_only,
      installed_on_request:       args.named.present?,
      force_bottle:               args.force_bottle?,
      build_from_source_formulae: args.build_from_source_formulae,
      interactive:                args.interactive?,
      keep_tmp:                   args.keep_tmp?,
      debug_symbols:              args.debug_symbols?,
      force:                      args.force?,
      debug:                      args.debug?,
      quiet:                      args.quiet?,
      verbose:                    args.verbose?,
      git:                        args.git?,
    )
    Cleanup.install_formula_clean!(formula)
  end

  Upgrade.check_installed_dependents(
    formulae,
    flags:                      args.flags_only,
    installed_on_request:       args.named.present?,
    force_bottle:               args.force_bottle?,
    build_from_source_formulae: args.build_from_source_formulae,
    interactive:                args.interactive?,
    keep_tmp:                   args.keep_tmp?,
    debug_symbols:              args.debug_symbols?,
    force:                      args.force?,
    debug:                      args.debug?,
    quiet:                      args.quiet?,
    verbose:                    args.verbose?,
  )

  if casks.any?
    Cask::Reinstall.reinstall_casks(
      *casks,
      binaries:       args.binaries?,
      verbose:        args.verbose?,
      force:          args.force?,
      require_sha:    args.require_sha?,
      skip_cask_deps: args.skip_cask_deps?,
      quarantine:     args.quarantine?,
      zap:            args.zap?,
    )
  end

  Cleanup.periodic_clean!

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