Class: Homebrew::Cmd::Bundle::InstallSubcommand Private

Inherits:
AbstractSubcommand show all
Defined in:
bundle/subcommand/install.rb

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.

Instance Attribute Summary

Attributes inherited from AbstractSubcommand

#args, #cleanup, #context, #quiet, #targets

Instance Method Summary collapse

Methods inherited from AbstractSubcommand

define, define_all, #initialize, subcommand_name, subcommands_for

Methods included from Utils::Output::Mixin

#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_outdated, #pretty_uninstalled, #pretty_upgradable

Constructor Details

This class inherits a constructor from Homebrew::AbstractSubcommand

Instance Method Details

#dslHomebrew::Bundle::Dsl?

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.

Returns:



94
95
96
97
# File 'bundle/subcommand/install.rb', line 94

def dsl
  @dsl ||= T.let(nil, T.nilable(Homebrew::Bundle::Dsl))
  @dsl
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.



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
85
86
87
88
89
90
91
# File 'bundle/subcommand/install.rb', line 55

def run
  @dsl = Homebrew::Bundle::Brewfile.read(global: context.global, file: context.file)
  result = Homebrew::Bundle::Installer.install!(
    @dsl.entries,
    global:     context.global,
    file:       context.file,
    no_lock:    false,
    no_upgrade: context.no_upgrade,
    verbose:    context.verbose,
    force:      context.force,
    jobs:       context.jobs,
    quiet:      quiet || args.quiet?,
  )

  # Mark Brewfile formulae as installed_on_request to prevent autoremove
  # from removing them when their dependents are uninstalled
  Homebrew::Bundle.mark_as_installed_on_request!(@dsl.entries)

  result || exit(1)

  return unless cleanup

  cleanup_requested = if ENV.fetch("HOMEBREW_BUNDLE_INSTALL_CLEANUP", nil)
    args.global?
  else
    args.cleanup?
  end
  return unless cleanup_requested

  require "bundle/subcommand/cleanup"

  # Don't need to reset cleanup specifically but this resets all the dumper modules.
  Homebrew::Cmd::Bundle::CleanupSubcommand.reset!
  Homebrew::Cmd::Bundle::CleanupSubcommand.cleanup(
    global: context.global, file: context.file, zap: context.zap, force: true, dsl:,
  )
end