Top Level Namespace

Defined Under Namespace

Modules: BottleAPI, Cachable, Cask, Commands, Context, Debrew, Dependable, DependenciesHelpers, DeprecateDisable, DiskUsageExtension, ELFShim, EnvActivation, EnvVar, Formatter, FormulaCellarChecks, FormulaClassUnavailableErrorModule, FormulaUnreadableErrorModule, Formulary, GitHub, GitRepositoryExtension, Hardware, HashValidator, Homebrew, Ignorable, InstallRenamed, InstalledDependents, Kernel, Language, MachOShim, Metafiles, OS, OnOS, Patch, Predicable, PyPI, Readall, ReleaseNotes, Repology, RuboCop, SPDX, Searchable, SharedAudits, SharedEnvExtension, Stdenv, Superenv, SystemConfig, TimeRemaining, Tty, UnpackStrategy, Utils, Warnings Classes: AbstractDownloadStrategy, AbstractFileDownloadStrategy, ArchRequirement, Archive, BazaarDownloadStrategy, Bottle, BottleDisableReason, BottleFormulaUnavailableError, BottleSpecification, Build, BuildEnvironment, BuildError, BuildFlagsError, BuildOptions, CVSDownloadStrategy, CacheStore, CacheStoreDatabase, CannotInstallFormulaError, CaskDependent, CaskLock, Caveats, Checksum, ChecksumMismatchError, ChecksumMissingError, ChildProcessError, Cleaner, CodesignRequirement, CompilerFailure, CompilerSelectionError, CompilerSelector, CoreTap, CoreTapFormulaUnavailableError, CurlApacheMirrorDownloadStrategy, CurlDownloadStrategy, CurlDownloadStrategyError, CurlGitHubPackagesDownloadStrategy, CurlPostDownloadStrategy, CxxStdlib, DATAPatch, Dependencies, Dependency, DependencyCollector, DeprecatedOption, DescriptionCacheStore, Descriptions, DownloadError, DownloadStrategyDetector, DuplicateResourceError, EmbeddedPatch, ErrorDuringExecution, ExternalPatch, Formula, FormulaAmbiguousPythonError, FormulaClassUnavailableError, FormulaConflict, FormulaConflictError, FormulaInfo, FormulaInstallationAlreadyAttemptedError, FormulaInstaller, FormulaLock, FormulaOrCaskUnavailableError, FormulaOrCaskUnspecifiedError, FormulaPin, FormulaSpecificationError, FormulaUnavailableError, FormulaUnknownPythonError, FormulaUnreadableError, FormulaUnspecifiedError, FormulaValidationError, FormulaVersions, FossilDownloadStrategy, GitDownloadStrategy, GitHubArtifactDownloadStrategy, GitHubGitDownloadStrategy, GitHubPackages, GitHubReleases, HeadSoftwareSpec, HeadVersion, IO, IgnoreDirectiveDocstringParser, Keg, KegOnlyReason, KegUnspecifiedError, LazyObject, LinkageCacheStore, LinkageChecker, LinuxRequirement, Livecheck, LocalBottleDownloadStrategy, Locale, LockFile, MacOSRequirement, MacOSVersionError, MercurialDownloadStrategy, Messages, MethodDeprecatedError, Migrator, MissingApplyError, MissingEnvironmentVariables, Mktemp, Module, MultipleVersionsInstalledError, NoSuchKegError, NoUnzipCurlDownloadStrategy, NotAKegError, OperationInProgressError, Option, Options, PATH, Pathname, PkgVersion, PourBottleCheck, PrettyListing, Reporter, ReporterHub, Requirement, Requirements, Resource, ResourceMissingError, ResourceStageContext, Sandbox, ShebangDetectionError, SoftwareSpec, String, StringInreplaceExtension, StringPatch, SubversionDownloadStrategy, Symbol, SystemCommand, Tab, Tap, TapAlreadyTappedError, TapConfig, TapDependency, TapFormulaAmbiguityError, TapFormulaClassUnavailableError, TapFormulaOrCaskUnavailableError, TapFormulaUnavailableError, TapFormulaUnreadableError, TapFormulaWithOldnameAmbiguityError, TapRemoteMismatchError, TapUnavailableError, URL, UnbottledError, UnsatisfiedRequirements, UsageError, User, VCSDownloadStrategy, Version, XcodeRequirement

Constant Summary collapse

TEST_TIMEOUT_SECONDS =
5 * 60
HOMEBREW_BOTTLE_DEFAULT_DOMAIN =
ENV["HOMEBREW_BOTTLE_DEFAULT_DOMAIN"]
HOMEBREW_BREW_DEFAULT_GIT_REMOTE =
ENV["HOMEBREW_BREW_DEFAULT_GIT_REMOTE"]
HOMEBREW_CORE_DEFAULT_GIT_REMOTE =
ENV["HOMEBREW_CORE_DEFAULT_GIT_REMOTE"]
HOMEBREW_DEFAULT_CACHE =
ENV["HOMEBREW_DEFAULT_CACHE"]
HOMEBREW_DEFAULT_LOGS =
ENV["HOMEBREW_DEFAULT_LOGS"]
HOMEBREW_DEFAULT_TEMP =
ENV["HOMEBREW_DEFAULT_TEMP"]
HOMEBREW_REQUIRED_RUBY_VERSION =
ARGV.first.freeze
HOMEBREW_PRODUCT =
ENV["HOMEBREW_PRODUCT"]
HOMEBREW_VERSION =
ENV["HOMEBREW_VERSION"]
HOMEBREW_WWW =
"https://brew.sh"
HOMEBREW_USER_AGENT_CURL =
ENV["HOMEBREW_USER_AGENT_CURL"]
HOMEBREW_USER_AGENT_RUBY =
"#{ENV["HOMEBREW_USER_AGENT"]} ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
HOMEBREW_USER_AGENT_FAKE_SAFARI =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 " \
"(KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
HOMEBREW_DEFAULT_PREFIX =
"/usr/local"
HOMEBREW_DEFAULT_REPOSITORY =
"#{HOMEBREW_DEFAULT_PREFIX}/Homebrew"
HOMEBREW_MACOS_ARM_DEFAULT_PREFIX =
"/opt/homebrew"
HOMEBREW_MACOS_ARM_DEFAULT_REPOSITORY =
HOMEBREW_MACOS_ARM_DEFAULT_PREFIX
HOMEBREW_LINUX_DEFAULT_PREFIX =
"/home/linuxbrew/.linuxbrew"
HOMEBREW_LINUX_DEFAULT_REPOSITORY =
"#{HOMEBREW_LINUX_DEFAULT_PREFIX}/Homebrew"
HOMEBREW_PULL_API_REGEX =
%r{https://api\.github\.com/repos/([\w-]+)/([\w-]+)?/pulls/(\d+)}.freeze
HOMEBREW_PULL_OR_COMMIT_URL_REGEX =
%r[https://github\.com/([\w-]+)/([\w-]+)?/(?:pull/(\d+)|commit/[0-9a-fA-F]{4,40})].freeze
HOMEBREW_BOTTLES_EXTNAME_REGEX =
/\.([a-z0-9_]+)\.bottle\.(?:(\d+)\.)?tar\.gz$/.freeze
ORIGINAL_PATHS =
PATH.new(ENV["HOMEBREW_PATH"]).map do |p|
  Pathname.new(p).expand_path
rescue
  nil
end.compact.freeze
HOMEBREW_PATCHELF_RB_WRITE =

Enables patchelf.rb write support.

ENV["HOMEBREW_NO_PATCHELF_RB_WRITE"].blank?.freeze
BUG_REPORTS_URL =
"https://github.com/Homebrew/homebrew-cask#reporting-bugs"
COMMAND_DESC_WIDTH =
80
OPTION_DESC_WIDTH =
43
HIDDEN_DESC_PLACEHOLDER =
"@@HIDDEN@@"
FORMULA_COMPONENT_PRECEDENCE_LIST =
[
  [{ name: :include,   type: :method_call }],
  [{ name: :desc,      type: :method_call }],
  [{ name: :homepage,  type: :method_call }],
  [{ name: :url,       type: :method_call }],
  [{ name: :mirror,    type: :method_call }],
  [{ name: :version,   type: :method_call }],
  [{ name: :sha256,    type: :method_call }],
  [{ name: :license, type: :method_call }],
  [{ name: :revision, type: :method_call }],
  [{ name: :version_scheme, type: :method_call }],
  [{ name: :head,      type: :method_call }],
  [{ name: :stable,    type: :block_call }],
  [{ name: :livecheck, type: :block_call }],
  [{ name: :bottle,    type: :block_call }],
  [{ name: :pour_bottle?, type: :block_call }],
  [{ name: :head,      type: :block_call }],
  [{ name: :bottle,    type: :method_call }],
  [{ name: :keg_only,  type: :method_call }],
  [{ name: :option,    type: :method_call }],
  [{ name: :deprecated_option, type: :method_call }],
  [{ name: :disable!, type: :method_call }],
  [{ name: :deprecate!, type: :method_call }],
  [{ name: :depends_on, type: :method_call }],
  [{ name: :uses_from_macos, type: :method_call }],
  [{ name: :on_macos, type: :block_call }],
  [{ name: :on_linux, type: :block_call }],
  [{ name: :conflicts_with, type: :method_call }],
  [{ name: :skip_clean, type: :method_call }],
  [{ name: :cxxstdlib_check, type: :method_call }],
  [{ name: :link_overwrite, type: :method_call }],
  [{ name: :fails_with, type: :method_call }, { name: :fails_with, type: :block_call }],
  [{ name: :go_resource, type: :block_call }, { name: :resource, type: :block_call }],
  [{ name: :patch, type: :method_call }, { name: :patch, type: :block_call }],
  [{ name: :needs, type: :method_call }],
  [{ name: :install, type: :method_definition }],
  [{ name: :post_install, type: :method_definition }],
  [{ name: :caveats, type: :method_definition }],
  [{ name: :plist_options, type: :method_call }, { name: :plist, type: :method_definition }],
  [{ name: :test, type: :block_call }],
].freeze
OFFICIAL_CASK_TAPS =
%w[
  cask
  versions
].freeze
OFFICIAL_CMD_TAPS =
{
  "homebrew/aliases"           => ["alias", "unalias"],
  "homebrew/autoupdate"        => ["autoupdate"],
  "homebrew/bundle"            => ["bundle"],
  "homebrew/command-not-found" => ["command-not-found-init", "which-formula", "which-update"],
  "homebrew/test-bot"          => ["test-bot"],
  "homebrew/services"          => ["services"],
}.freeze
DEPRECATED_OFFICIAL_TAPS =
%w[
  apache
  binary
  cask-eid
  completions
  devel-only
  dupes
  emacs
  fuse
  games
  gui
  head-only
  livecheck
  nginx
  php
  python
  science
  tex
  versions
  x11
].freeze
HOMEBREW_TAP_FORMULA_REGEX =

Match taps’ formulae, e.g. someuser/sometap/someformula

%r{^([\w-]+)/([\w-]+)/([\w+-.@]+)$}.freeze
HOMEBREW_TAP_CASK_REGEX =

Match taps’ casks, e.g. someuser/sometap/somecask

%r{^([\w-]+)/([\w-]+)/([a-z0-9\-]+)$}.freeze
HOMEBREW_TAP_DIR_REGEX =

Match taps’ directory paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap

%r{#{Regexp.escape(HOMEBREW_LIBRARY.to_s)}/Taps/(?<user>[\w-]+)/(?<repo>[\w-]+)}.freeze
HOMEBREW_TAP_PATH_REGEX =

Match taps’ formula paths, e.g. HOMEBREW_LIBRARY/Taps/someuser/sometap/someformula

Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source).freeze
HOMEBREW_CASK_TAP_CASK_REGEX =

Match official taps’ casks, e.g. homebrew/cask/somecask or homebrew/cask-versions/somecask

%r{^(?:([Cc]askroom)/(cask|versions)|(homebrew)/(cask|cask-[\w-]+))/([\w+-.]+)$}.freeze
HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX =
/^(home|linux)brew-/.freeze
BOTTLE_ERB =
<<-EOS
  bottle do
    <% if [HOMEBREW_BOTTLE_DEFAULT_DOMAIN.to_s,
           "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}/bottles"].exclude?(root_url) %>
    root_url "<%= root_url %>"<% if root_url_using.present? %>,
      using: <%= root_url_using %>
    <% end %>
    <% end %>
    <% if rebuild.positive? %>
    rebuild <%= rebuild %>
    <% end %>
    <% sha256_lines.each do |line| %>
    <%= line %>
    <% end %>
  end
EOS
MAXIMUM_STRING_MATCHES =
100
GZIP_BUFFER_SIZE =
64 * 1024
[
  %r{#{Regexp.escape(HOMEBREW_LIBRARY)}/Homebrew/os/(mac|linux)/pkgconfig},
].freeze
HOMEBREW_BREW_FILE =

Path to bin/brew main executable in HOMEBREW_PREFIX

Pathname(ENV["HOMEBREW_BREW_FILE"]).freeze
HOMEBREW_PREFIX =

Where we link under

Pathname(EnvVar["HOMEBREW_PREFIX"]).freeze
HOMEBREW_REPOSITORY =

Where .git is found

Pathname(EnvVar["HOMEBREW_REPOSITORY"]).freeze
HOMEBREW_LIBRARY =

Where we store most of Homebrew, taps, and various metadata

Pathname(EnvVar["HOMEBREW_LIBRARY"]).freeze
HOMEBREW_SHIMS_PATH =

Where shim scripts for various build and SCM tools are stored

(HOMEBREW_LIBRARY/"Homebrew/shims").freeze
HOMEBREW_DATA_PATH =

Where external data that has been incorporated into Homebrew is stored

(HOMEBREW_LIBRARY/"Homebrew/data").freeze
HOMEBREW_LINKED_KEGS =

Where we store symlinks to currently linked kegs

(HOMEBREW_PREFIX/"var/homebrew/linked").freeze
HOMEBREW_PINNED_KEGS =

Where we store symlinks to currently version-pinned kegs

(HOMEBREW_PREFIX/"var/homebrew/pinned").freeze
HOMEBREW_LOCKS =

Where we store lock files

(HOMEBREW_PREFIX/"var/homebrew/locks").freeze
HOMEBREW_CELLAR =

Where we store built products

Pathname(EnvVar["HOMEBREW_CELLAR"]).freeze
HOMEBREW_CACHE =

Where downloads (bottles, source tarballs, etc.) are cached

Pathname(EnvVar["HOMEBREW_CACHE"]).freeze
HOMEBREW_CACHE_FORMULA =

Where formulae installed via URL are cached

(HOMEBREW_CACHE/"Formula").freeze
HOMEBREW_LOGS =

Where build, postinstall, and test logs of formulae are written to

Pathname(EnvVar["HOMEBREW_LOGS"]).expand_path.freeze
HOMEBREW_TEMP =

Must use /tmp instead of TMPDIR because long paths break Unix domain sockets

Pathname(EnvVar["HOMEBREW_TEMP"]).yield_self do |tmp|
  tmp.mkpath unless tmp.exist?
  tmp.realpath
end.freeze
HOMEBREW_RUBY_EXEC_ARGS =

The Ruby path and args to use for forked Ruby calls

[
  RUBY_PATH,
  ENV["HOMEBREW_RUBY_WARNINGS"],
].freeze
RUBY_PATH =
Pathname.new(RbConfig.ruby).freeze
RUBY_BIN =
RUBY_PATH.dirname.freeze
HOMEBREW_LIBRARY_PATH =
Pathname(__dir__).parent.realpath.freeze

Instance Method Summary collapse

Methods included from SystemCommand::Mixin

#system_command, #system_command!

Methods included from Utils::Curl

curl, curl_args, curl_check_http_content, curl_download, curl_executable, curl_http_content_headers_and_checksum, curl_output, curl_with_workarounds, http_status_ok?, parse_headers, url_protected_by_cloudflare?, url_protected_by_incapsula?

Instance Method Details

#gem(name) ⇒ Object

Explicitly prevent sorbet-runtime from being loaded.

Raises:

  • (Gem::LoadError)


5
6
7
8
9
# File 'standalone/sorbet.rb', line 5

def gem(name, *)
  raise Gem::LoadError if name == "sorbet-runtime"

  super
end

#initObject



4
5
6
7
8
9
10
# File 'yard/templates/default/docstring/html/setup.rb', line 4

def init
  super

  return if sections.empty?

  sections[:index].place(:internal).before(:private)
end

#internalObject



12
13
14
# File 'yard/templates/default/docstring/html/setup.rb', line 12

def internal
  erb(:internal) if object.has_tag?(:api) && object.tag(:api).text == "internal"
end

#with_monkey_patchObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
70
71
72
73
74
75
76
# File 'dev-cmd/extract.rb', line 10

def with_monkey_patch
  BottleSpecification.class_eval do
    alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
    define_method(:method_missing) { |*| }
  end

  Module.class_eval do
    alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
    define_method(:method_missing) { |*| }
  end

  Resource.class_eval do
    alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
    define_method(:method_missing) { |*| }
  end

  DependencyCollector.class_eval do
    alias_method :old_parse_symbol_spec, :parse_symbol_spec if method_defined?(:parse_symbol_spec)
    define_method(:parse_symbol_spec) { |*| }
  end

  if defined?(DependencyCollector::Compat)
    DependencyCollector::Compat.class_eval do
      alias_method :old_parse_string_spec, :parse_string_spec if method_defined?(:parse_string_spec)
      define_method(:parse_string_spec) { |*| }
    end
  end

  yield
ensure
  BottleSpecification.class_eval do
    if method_defined?(:old_method_missing)
      alias_method :method_missing, :old_method_missing
      undef :old_method_missing
    end
  end

  Module.class_eval do
    if method_defined?(:old_method_missing)
      alias_method :method_missing, :old_method_missing
      undef :old_method_missing
    end
  end

  Resource.class_eval do
    if method_defined?(:old_method_missing)
      alias_method :method_missing, :old_method_missing
      undef :old_method_missing
    end
  end

  DependencyCollector.class_eval do
    if method_defined?(:old_parse_symbol_spec)
      alias_method :parse_symbol_spec, :old_parse_symbol_spec
      undef :old_parse_symbol_spec
    end
  end

  if defined?(DependencyCollector::Compat)
    DependencyCollector::Compat.class_eval do
      if method_defined?(:old_parse_string_spec)
        alias_method :parse_string_spec, :old_parse_string_spec
        undef :old_parse_string_spec
      end
    end
  end
end