Class: Homebrew::DevCmd::Unpack Private

Inherits:
AbstractCommand show all
Includes:
FileUtils
Defined in:
dev-cmd/unpack.rb,
sorbet/rbi/dsl/homebrew/dev_cmd/unpack.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?

Methods included from Utils::Output::Mixin

#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#argsHomebrew::DevCmd::Unpack::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/dev_cmd/unpack.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.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'dev-cmd/unpack.rb', line 44

def run
  formulae_and_casks = if args.casks?
    args.named.to_formulae_and_casks(only: :cask)
  elsif args.formulae?
    args.named.to_formulae_and_casks(only: :formula)
  else
    args.named.to_formulae_and_casks
  end

  if (dir = args.destdir)
    unpack_dir = Pathname.new(dir).expand_path
    unpack_dir.mkpath
  else
    unpack_dir = Pathname.pwd
  end

  odie "Cannot write to #{unpack_dir}" unless unpack_dir.writable?

  formulae_and_casks.each do |formula_or_cask|
    if formula_or_cask.is_a?(Cask::Cask)
      unpack_cask(formula_or_cask, unpack_dir)
    elsif (formula = T.cast(formula_or_cask, Formula))
      unpack_formula(formula, unpack_dir)
    end
  end
end