Class: Homebrew::Cmd::Prefix Private

Inherits:
AbstractCommand show all
Includes:
FileUtils
Defined in:
sorbet/rbi/dsl/homebrew/cmd/prefix.rbi,
cmd/--prefix.rb

Overview

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.

DO NOT EDIT MANUALLY This is an autogenerated file for dynamic methods in Homebrew::Cmd::Prefix. Please instead update this file by running bin/tapioca dsl Homebrew::Cmd::Prefix.

Defined Under Namespace

Classes: Args

Constant Summary collapse

UNBREWED_EXCLUDE_FILES =

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

%w[.DS_Store].freeze
UNBREWED_EXCLUDE_PATHS =

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

%w[
  */.keepme
  .github/*
  bin/brew
  completions/zsh/_brew
  docs/*
  lib/gdk-pixbuf-2.0/*
  lib/gio/*
  lib/node_modules/*
  lib/python[23].[0-9]/*
  lib/python3.[0-9][0-9]/*
  lib/pypy/*
  lib/pypy3/*
  lib/ruby/gems/[12].*
  lib/ruby/site_ruby/[12].*
  lib/ruby/vendor_ruby/[12].*
  manpages/brew.1
  share/pypy/*
  share/pypy3/*
  share/info/dir
  share/man/whatis
  share/mime/*
  texlive/*
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, dev_cmd?, #initialize, parser

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Class Method Details

.command_nameString

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:



39
# File 'cmd/--prefix.rb', line 39

def self.command_name = "--prefix"

Instance Method Details

#argsHomebrew::Cmd::Prefix::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.



9
# File 'sorbet/rbi/dsl/homebrew/cmd/prefix.rbi', line 9

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.

Raises:



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
# File 'cmd/--prefix.rb', line 61

def run
  raise UsageError, "`--installed` requires a formula argument." if args.installed? && args.no_named?

  if args.unbrewed?
    raise UsageError, "`--unbrewed` does not take a formula argument." unless args.no_named?

    list_unbrewed
  elsif args.no_named?
    puts HOMEBREW_PREFIX
  else
    formulae = args.named.to_resolved_formulae
    prefixes = formulae.filter_map do |f|
      next nil if args.installed? && !f.opt_prefix.exist?

      # this case will be short-circuited by brew.sh logic for a single formula
      f.opt_prefix
    end
    puts prefixes
    if args.installed?
      missing_formulae = formulae.reject(&:optlinked?)
                                 .map(&:name)
      return if missing_formulae.blank?

      raise NotAKegError, <<~EOS
        The following formulae are not installed:
        #{missing_formulae.join(" ")}
      EOS
    end
  end
end