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

Inherits:
AbstractSubcommand show all
Defined in:
bundle/subcommand/install.rb,
sorbet/rbi/dsl/homebrew/cmd/bundle/install_subcommand.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

Modules: Args

Instance Attribute Summary

Attributes inherited from AbstractSubcommand

#cleanup, #context, #quiet, #targets

Instance Method Summary collapse

Methods inherited from AbstractSubcommand

args_module, command, 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, #opoo_without_github_actions_annotation, #pretty_cannot_install, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_unmarked, #pretty_upgradable, #pretty_warning

Constructor Details

This class inherits a constructor from Homebrew::AbstractSubcommand

Instance Method Details

#argsT.all(Homebrew::Cmd::Bundle::Args, Homebrew::Cmd::Bundle::InstallSubcommand::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/bundle/install_subcommand.rbi', line 10

def args; end

#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:



110
111
112
113
# File 'bundle/subcommand/install.rb', line 110

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.



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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'bundle/subcommand/install.rb', line 57

def run
  cleanup_requested = false
  if cleanup
    cleanup_requested = args.force_cleanup? || Homebrew::EnvConfig.bundle_install_cleanup?
    if args.zap? && !cleanup_requested
      raise UsageError,
            "`--zap` cannot be passed without `--force-cleanup` or `$HOMEBREW_BUNDLE_INSTALL_CLEANUP`."
    end

    if cleanup_requested && !context.force && !args.force_cleanup? && !context.ask
      raise UsageError, "`brew bundle install` cleanup requires `--force`, `--force-cleanup` " \
                        "or `$HOMEBREW_ASK`."
    end
  end

  if args.jobs.present?
    opoo "`--jobs` is ignored: installations use package managers' native batching."
  end

  @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,
    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

  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: context.force || args.force_cleanup?,
    ask: context.ask, dsl:
  )
end