source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/compilers.rb | Ruby | bsd-2-clause | 47,751 | main | 6,504 | # typed: strict
# frozen_string_literal: true
module CompilerConstants
# GCC 7 - Ubuntu 18.04 (ESM ends 2028-04-01)
# GCC 8 - RHEL 8 (ELS ends 2032-05-31)
GNU_GCC_VERSIONS = %w[7 8 9 10 11 12 13 14 15].freeze
GNU_GCC_REGEXP = /^gcc-(#{GNU_GCC_VERSIONS.join("|")})$/
COMPILER_SYMBOL_MAP = T.let({
"gc... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/reinstall.rb | Ruby | bsd-2-clause | 47,751 | main | 4,918 | # typed: strict
# frozen_string_literal: true
require "development_tools"
require "messages"
require "utils/output"
# Needed to handle circular require dependency.
# rubocop:disable Lint/EmptyClass
class FormulaInstaller; end
# rubocop:enable Lint/EmptyClass
module Homebrew # rubocop:todo Style/OneClassPerFile
mod... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/sbom.rb | Ruby | bsd-2-clause | 47,751 | main | 14,535 | # typed: strict
# frozen_string_literal: true
require "json"
require "development_tools"
require "utils/curl"
require "utils/output"
# Rather than calling `new` directly, use one of the class methods like {SBOM.create}.
class SBOM
include Utils::Output::Mixin
FILENAME = "sbom.spdx.json"
SCHEMA_FILE = T.let((HO... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/metafiles.rb | Ruby | bsd-2-clause | 47,751 | main | 1,117 | # typed: strict
# frozen_string_literal: true
# Helper for checking if a file is considered a metadata file.
module Metafiles
LICENSES = T.let(Set.new(%w[copying copyright license licence]).freeze, T::Set[String])
# {https://github.com/github/markup#markups}
EXTENSIONS = T.let(Set.new(%w[
.adoc .asc .asciido... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/pour_bottle_check.rb | Ruby | bsd-2-clause | 47,751 | main | 468 | # typed: strict
# frozen_string_literal: true
class PourBottleCheck
include OnSystem::MacOSAndLinux
sig { params(formula: T.class_of(Formula)).void }
def initialize(formula)
@formula = formula
end
sig { params(reason: String).void }
def reason(reason)
@formula.pour_bottle_check_unsatisfied_reason... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/messages.rb | Ruby | bsd-2-clause | 47,751 | main | 2,231 | # typed: strict
# frozen_string_literal: true
require "utils/output"
# A {Messages} object collects messages that may need to be displayed together
# at the end of a multi-step `brew` command run.
class Messages
include ::Utils::Output::Mixin
sig { returns(T::Array[{ package: String, caveats: T.any(String, Cavea... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/ignorable.rb | Ruby | bsd-2-clause | 47,751 | main | 1,648 | # typed: strict
# frozen_string_literal: true
require "warnings"
Warnings.ignore(/warning: callcc is obsolete; use Fiber instead/) do
require "continuation"
end
# Provides the ability to optionally ignore errors raised and continue execution.
module Ignorable
# Marks exceptions which can be ignored and provides
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/missing_formula.rb | Ruby | bsd-2-clause | 47,751 | main | 8,017 | # typed: strict
# frozen_string_literal: true
require "formulary"
require "utils"
require "utils/output"
module Homebrew
# Helper module for checking if there is a reason a formula is missing.
module MissingFormula
extend Utils::Output::Mixin
class << self
sig { params(name: String, silent: T::Bool... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/readline_nonblock.rb | Ruby | bsd-2-clause | 47,751 | main | 435 | # typed: strict
# frozen_string_literal: true
class ReadlineNonblock
sig { params(io: IO).returns(String) }
def self.read(io)
line = +""
buffer = +""
begin
loop do
break if buffer == $INPUT_RECORD_SEPARATOR
io.read_nonblock(1, buffer)
line.concat(buffer)
end
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/software_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 9,822 | # typed: strict
# frozen_string_literal: true
require "resource"
require "download_strategy"
require "checksum"
require "version"
require "options"
require "build_options"
require "dependency_collector"
require "utils/bottles"
require "patch"
require "compilers"
require "macos_version"
require "on_system"
class Softw... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/formula_versions.rb | Ruby | bsd-2-clause | 47,751 | main | 3,183 | # typed: strict
# frozen_string_literal: true
require "formula"
require "utils/output"
# Helper class for traversing a formula's previous versions.
#
# @api internal
class FormulaVersions
include Context
include Utils::Output::Mixin
IGNORED_EXCEPTIONS = [
ArgumentError, NameError, SyntaxError, TypeError, L... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/git_repository.rb | Ruby | bsd-2-clause | 47,751 | main | 4,160 | # typed: strict
# frozen_string_literal: true
require "utils/git"
require "utils/popen"
# Given a {Pathname}, provides methods for querying Git repository information.
# @see Utils::Git
class GitRepository
sig { returns(Pathname) }
attr_reader :pathname
sig { params(pathname: Pathname).void }
def initialize(... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/official_taps.rb | Ruby | bsd-2-clause | 47,751 | main | 415 | # typed: strict
# frozen_string_literal: true
DEPRECATED_OFFICIAL_TAPS = %w[
aliases
apache
binary
bundle
cask-drivers
cask-eid
cask-fonts
cask-versions
command-not-found
completions
devel-only
dupes
emacs
formula-analytics
fuse
games
gui
head-only
linux-fonts
livecheck
nginx
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/description_cache_store.rb | Ruby | bsd-2-clause | 47,751 | main | 5,405 | # typed: strict
# frozen_string_literal: true
require "cache_store"
#
# {DescriptionCacheStore} provides methods to fetch and mutate formula descriptions used
# by the `brew desc` and `brew search` commands.
#
class DescriptionCacheStore < CacheStore
Key = type_member { { fixed: String } }
Value = type_member { {... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/github_packages.rb | Ruby | bsd-2-clause | 47,751 | main | 22,088 | # typed: strict
# frozen_string_literal: true
require "utils/curl"
require "utils/gzip"
require "utils/output"
require "json"
require "zlib"
require "extend/hash/keys"
require "system_command"
# GitHub Packages client.
class GitHubPackages
include Context
include SystemCommand::Mixin
include Utils::Output::Mixi... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/system_command.rb | Ruby | bsd-2-clause | 47,751 | main | 18,721 | # typed: strict
# frozen_string_literal: true
require "plist"
require "shellwords"
require "uri"
require "context"
require "readline_nonblock"
require "utils/timer"
require "utils/output"
# Class for running sub-processes and capturing their output and exit status.
#
# @api internal
class SystemCommand
# Helper fu... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/retryable_download.rb | Ruby | bsd-2-clause | 47,751 | main | 5,287 | # typed: strict
# frozen_string_literal: true
require "bottle"
require "api/json_download"
require "utils/output"
module Homebrew
class RetryableDownload
include Downloadable
include Utils::Output::Mixin
sig { override.returns(T.nilable(T.any(String, URL))) }
def url = downloadable.url
sig { o... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/checksum.rb | Ruby | bsd-2-clause | 47,751 | main | 647 | # typed: strict
# frozen_string_literal: true
# A formula's checksum.
class Checksum
extend Forwardable
sig { returns(String) }
attr_reader :hexdigest
sig { params(hexdigest: String).void }
def initialize(hexdigest)
@hexdigest = T.let(hexdigest.downcase, String)
end
sig { returns(String) }
def i... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/uninstall.rb | Ruby | bsd-2-clause | 47,751 | main | 5,200 | # typed: strict
# frozen_string_literal: true
require "dependents_message"
require "installed_dependents"
require "utils/output"
module Homebrew
# Helper module for uninstalling kegs.
module Uninstall
extend ::Utils::Output::Mixin
sig {
params(
kegs_by_rack: T::Hash[Pathname, T::Arra... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/debrew.rb | Ruby | bsd-2-clause | 47,751 | main | 4,053 | # typed: strict
# frozen_string_literal: true
require "ignorable"
# Helper module for debugging formulae.
module Debrew
# Module for allowing to debug formulae.
module Formula
sig { void }
def install
Debrew.debrew { super }
end
sig { void }
def patch
Debrew.debrew { super }
e... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/download_queue.rb | Ruby | bsd-2-clause | 47,751 | main | 14,184 | # typed: strict
# frozen_string_literal: true
require "downloadable"
require "concurrent/promises"
require "concurrent/executors"
require "concurrent/atomic/atomic_boolean"
require "retryable_download"
require "resource"
require "utils/output"
module Homebrew
# Raised when a download is cancelled cooperatively.
c... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/commands.rb | Ruby | bsd-2-clause | 47,751 | main | 9,335 | # typed: strict
# frozen_string_literal: true
require "homebrew"
# Helper functions for commands.
module Commands
HOMEBREW_CMD_PATH = T.let((HOMEBREW_LIBRARY_PATH/"cmd").freeze, Pathname)
HOMEBREW_DEV_CMD_PATH = T.let((HOMEBREW_LIBRARY_PATH/"dev-cmd").freeze, Pathname)
# If you are going to change anything in b... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/formula_cellar_checks.rb | Ruby | bsd-2-clause | 47,751 | main | 15,570 | # typed: strict
# frozen_string_literal: true
require "utils/shell"
# Checks to perform on a formula's keg (versioned Cellar path).
module FormulaCellarChecks
extend T::Helpers
abstract!
requires_ancestor { Kernel }
sig { abstract.returns(Formula) }
def formula; end
sig { abstract.params(output: T.nila... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/cache_store.rb | Ruby | bsd-2-clause | 47,751 | main | 4,982 | # typed: strict
# frozen_string_literal: true
require "json"
#
# {CacheStoreDatabase} acts as an interface to a persistent storage mechanism
# residing in the `HOMEBREW_CACHE`.
#
class CacheStoreDatabase
extend T::Generic
# Sorbet type members are mutable by design and cannot be frozen.
Key = type_member # rub... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/locale.rb | Ruby | bsd-2-clause | 47,751 | main | 3,718 | # typed: strict
# frozen_string_literal: true
# Representation of a system locale.
#
# Used to compare the system language and languages defined using the cask `language` stanza.
class Locale
# Error when a string cannot be parsed to a `Locale`.
class ParserError < StandardError
end
# ISO 639-1 or ISO 639-2
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/requirement.rb | Ruby | bsd-2-clause | 47,751 | main | 11,159 | # typed: strict
# frozen_string_literal: true
require "dependable"
require "dependency"
require "dependencies"
require "build_environment"
require "utils/output"
# A base class for non-formula requirements needed by formulae.
# A fatal requirement is one that will fail the build if it is not present.
# By default, re... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/downloadable.rb | Ruby | bsd-2-clause | 47,751 | main | 5,473 | # typed: strict
# frozen_string_literal: true
require "url"
require "checksum"
require "download_strategy"
require "utils/output"
module Downloadable
include Context
include Utils::Output::Mixin
extend T::Helpers
abstract!
requires_ancestor { Kernel }
sig { overridable.returns(T.nilable(T.any(String, UR... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/cleaner.rb | Ruby | bsd-2-clause | 47,751 | main | 6,312 | # typed: strict
# frozen_string_literal: true
require "utils/output"
# Cleans a newly installed keg.
# By default:
#
# * removes `.la` files
# * removes `.tbd` files
# * removes `perllocal.pod` files
# * removes `.packlist` files
# * removes empty directories
# * sets permissions on executables
# * removes unresolved... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/requirements.rb | Ruby | bsd-2-clause | 47,751 | main | 276 | # typed: strict
# frozen_string_literal: true
require "requirement"
require "requirements/arch_requirement"
require "requirements/codesign_requirement"
require "requirements/linux_requirement"
require "requirements/macos_requirement"
require "requirements/xcode_requirement" |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/cask.rb | Ruby | bsd-2-clause | 47,751 | main | 542 | # typed: strict
# frozen_string_literal: true
require "cask/artifact"
require "cask/audit"
require "cask/auditor"
require "cask/cache"
require "cask/cask_loader"
require "cask/cask"
require "cask/caskroom"
require "cask/config"
require "cask/exceptions"
require "cask/denylist"
require "cask/download"
require "cask/dsl... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/system_config.rb | Ruby | bsd-2-clause | 47,751 | main | 5,555 | # typed: strict
# frozen_string_literal: true
require "hardware"
require "tap"
require "development_tools"
require "extend/ENV"
require "system_command"
require "git_repository"
# Helper module for querying information about the system configuration.
module SystemConfig
class << self
include SystemCommand::Mixi... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/tap_constants.rb | Ruby | bsd-2-clause | 47,751 | main | 1,918 | # typed: strict
# frozen_string_literal: true
# Match a formula name.
HOMEBREW_TAP_FORMULA_NAME_REGEX = /(?<name>[\w+\-.@]+)/
# Match taps' formulae, e.g. `someuser/sometap/someformula`.
HOMEBREW_TAP_FORMULA_REGEX =
%r{\A(?<user>[^/]+)/(?<repository>[^/]+)/#{HOMEBREW_TAP_FORMULA_NAME_REGEX.source}\Z}
# Match default... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/cask_dependent.rb | Ruby | bsd-2-clause | 47,751 | main | 2,840 | # typed: strict
# frozen_string_literal: true
require "requirement"
# An adapter for casks to provide dependency information in a formula-like interface.
class CaskDependent
# Defines a dependency on another cask
class Requirement < ::Requirement
# Sorbet type members are mutable by design and cannot be froze... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/dependency_collector.rb | Ruby | bsd-2-clause | 47,751 | main | 8,701 | # typed: strict
# frozen_string_literal: true
require "dependency"
require "dependencies"
require "requirement"
require "requirements"
require "cachable"
# A dependency is a formula that another formula needs to install.
# A requirement is something other than a formula that another formula
# needs to be present. Thi... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/mcp_server.rb | Ruby | bsd-2-clause | 47,751 | main | 13,888 | # typed: strict
# frozen_string_literal: true
# This is a standalone Ruby script as MCP servers need a faster startup time
# than a normal Homebrew Ruby command allows.
require_relative "standalone"
require "json"
require "stringio"
module Homebrew
# Provides a Model Context Protocol (MCP) server for Homebrew.
# ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/unpack_strategy.rb | Ruby | bsd-2-clause | 47,751 | main | 6,813 | # typed: strict
# frozen_string_literal: true
require "mktemp"
require "system_command"
require "utils/output"
# Module containing all available strategies for unpacking archives.
module UnpackStrategy
extend T::Helpers
extend Utils::Output::Mixin
include SystemCommand::Mixin
include Utils::Output::Mixin
a... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/mktemp.rb | Ruby | bsd-2-clause | 47,751 | main | 3,410 | # typed: strict
# frozen_string_literal: true
require "utils/output"
# Performs {Formula#mktemp}'s functionality and tracks the results.
# Each instance is only intended to be used once.
# Can also be used to create a temporary directory with the brew instance's group.
class Mktemp
include Utils::Output::Mixin
#... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/build_environment.rb | Ruby | bsd-2-clause | 47,751 | main | 2,564 | # typed: strict
# frozen_string_literal: true
# Settings for the build environment.
class BuildEnvironment
sig { params(settings: Symbol).void }
def initialize(*settings)
@settings = T.let(Set.new(settings), T::Set[Symbol])
end
sig { params(args: T::Enumerable[Symbol]).returns(T.self_type) }
def merge(*... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/simulate_system.rb | Ruby | bsd-2-clause | 47,751 | main | 2,731 | # typed: strict
# frozen_string_literal: true
require "macos_version"
require "utils/bottles"
module Homebrew
# Helper module for simulating different system configurations.
class SimulateSystem
class << self
sig { returns(T.nilable(Symbol)) }
attr_reader :arch
sig { returns(T.nilable(Symbo... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/macos_runner_spec.rb | Ruby | bsd-2-clause | 47,751 | main | 583 | # typed: strict
# frozen_string_literal: true
class MacOSRunnerSpec < T::Struct
const :name, String
const :runner, String
const :timeout, Integer
const :cleanup, T::Boolean
prop :testing_formulae, T::Array[String], default: []
sig {
returns({
name: String,
runner: St... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/dependencies_helpers.rb | Ruby | bsd-2-clause | 47,751 | main | 3,229 | # typed: strict
# frozen_string_literal: true
require "cask_dependent"
# Helper functions for dependencies.
module DependenciesHelpers
def args_includes_ignores(args)
includes = [:required?, :recommended?] # included by default
includes << :implicit? if args.include_implicit?
includes << :build? if args... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/postinstall.rb | Ruby | bsd-2-clause | 47,751 | main | 1,152 | # typed: strict
# frozen_string_literal: true
raise "#{__FILE__} must not be loaded via `require`." if $PROGRAM_NAME != __FILE__
old_trap = trap("INT") { exit! 130 }
require_relative "global"
require "fcntl"
require "utils/socket"
require "cli/parser"
require "cmd/postinstall"
require "json/add/exception"
require "... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/bundle_version.rb | Ruby | bsd-2-clause | 47,751 | main | 4,299 | # typed: strict
# frozen_string_literal: true
require "system_command"
module Homebrew
# Representation of a macOS bundle version, commonly found in `Info.plist` files.
class BundleVersion
include Comparable
extend SystemCommand::Mixin
sig { params(info_plist_path: Pathname).returns(T.nilable(T.atta... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/upgrade.rb | Ruby | bsd-2-clause | 47,751 | main | 18,726 | # typed: strict
# frozen_string_literal: true
require "reinstall"
require "formula_installer"
require "development_tools"
require "messages"
require "cleanup"
require "utils/topological_hash"
require "utils/output"
module Homebrew
# Helper functions for upgrading formulae.
module Upgrade
extend Utils::Output:... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/manpages.rb | Ruby | bsd-2-clause | 47,751 | main | 7,484 | # typed: strict
# frozen_string_literal: true
require "cli/parser"
require "erb"
module Homebrew
# Helper functions for generating homebrew manual.
module Manpages
Variables = Struct.new(
:alumni,
:commands,
:developer_commands,
:environment_variables,
:global_cask_options,
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/diagnostic.rb | Ruby | bsd-2-clause | 47,751 | main | 43,708 | # typed: strict
# frozen_string_literal: true
require "keg"
require "formula"
require "formulary"
require "utils"
require "version"
require "development_tools"
require "utils/shell"
require "utils/output"
require "cask/caskroom"
require "cask/quarantine"
require "git_repository"
require "system_command"
module Homebr... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/installed_dependents.rb | Ruby | bsd-2-clause | 47,751 | main | 2,470 | # typed: strict
# frozen_string_literal: true
require "cask_dependent"
# Helper functions for installed dependents.
module InstalledDependents
module_function
# Given an array of kegs, this method will try to find some other kegs
# or casks that depend on them. If it does, it returns:
#
# - some kegs in th... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/fetch.rb | Ruby | bsd-2-clause | 47,751 | main | 1,119 | # typed: strict
# frozen_string_literal: true
module Homebrew
module Fetch
sig {
params(
formula: Formula,
force_bottle: T::Boolean,
bottle_tag: T.nilable(Symbol),
build_from_source_formulae: T::Array[String],
os: ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/unversioned_cask_checker.rb | Ruby | bsd-2-clause | 47,751 | main | 9,422 | # typed: strict
# frozen_string_literal: true
require "bundle_version"
require "cask/cask"
require "cask/installer"
require "system_command"
require "utils/output"
module Homebrew
# Check unversioned casks for updates by extracting their
# contents and guessing the version from contained files.
class Unversione... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/descriptions.rb | Ruby | bsd-2-clause | 47,751 | main | 5,333 | # typed: strict
# frozen_string_literal: true
require "formula"
require "search"
require "cask/cask_loader"
# Helper class for printing and searching descriptions.
class Descriptions
# Enum for specifying which fields to search.
class SearchField < T::Enum
enums do
# enum values are not mutable, and cal... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/formula_free_port.rb | Ruby | bsd-2-clause | 47,751 | main | 345 | # typed: strict
# frozen_string_literal: true
require "socket"
module Homebrew
# Helper function for finding a free port.
module FreePort
# Returns a free port.
# @api public
sig { returns(Integer) }
def free_port
server = TCPServer.new 0
_, port, = server.addr
server.close
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/api.rb | Ruby | bsd-2-clause | 47,751 | main | 14,071 | # typed: strict
# frozen_string_literal: true
require "api/analytics"
require "api/cask"
require "api/formula"
require "api/internal"
require "api/formula_struct"
require "api/cask_struct"
require "base64"
require "download_queue"
require "utils/output"
module Homebrew
# Helper functions for using Homebrew's formul... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/completions.rb | Ruby | bsd-2-clause | 47,751 | main | 13,056 | # typed: strict
# frozen_string_literal: true
require "utils/link"
require "settings"
require "erb"
module Homebrew
# Helper functions for generating shell completions.
module Completions
extend Utils::Output::Mixin
Variables = Struct.new(
:aliases,
:builtin_command_descriptions,
:compl... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/style.rb | Ruby | bsd-2-clause | 47,751 | main | 16,926 | # typed: strict
# frozen_string_literal: true
require "shellwords"
require "source_location"
require "system_command"
require "tap"
require "utils/output"
module Homebrew
# Helper module for running RuboCop.
module Style
extend Utils::Output::Mixin
extend SystemCommand::Mixin
# Checks style for a lis... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/github_releases.rb | Ruby | bsd-2-clause | 47,751 | main | 1,262 | # typed: strict
# frozen_string_literal: true
require "utils/github"
require "utils/output"
require "json"
# GitHub Releases client.
class GitHubReleases
include Context
include Utils::Output::Mixin
URL_REGEX = %r{https://github\.com/([\w-]+)/([\w-]+)?/releases/download/(.+)}
sig { params(bottles_hash: T::H... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/os.rb | Ruby | bsd-2-clause | 47,751 | main | 2,463 | # typed: strict
# frozen_string_literal: true
require "version"
# Helper functions for querying operating system information.
module OS
# Check whether the operating system is macOS.
#
# @api public
sig { returns(T::Boolean) }
def self.mac?
return false if ENV["HOMEBREW_TEST_GENERIC_OS"]
RbConfig::... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/linkage_checker.rb | Ruby | bsd-2-clause | 47,751 | main | 13,801 | # typed: strict
# frozen_string_literal: true
require "keg"
require "formula"
require "linkage_cache_store"
require "utils/output"
# Check for broken/missing linkage in a formula's keg.
class LinkageChecker
include Utils::Output::Mixin
sig { returns(Keg) }
attr_reader :keg
sig { returns(T.nilable(Formula)) ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/build.rb | Ruby | bsd-2-clause | 47,751 | main | 10,106 | # typed: strict
# frozen_string_literal: true
# This script is loaded by formula_installer as a separate instance.
# Thrown exceptions are propagated back to the parent process over a pipe
raise "#{__FILE__} must not be loaded via `require`." if $PROGRAM_NAME != __FILE__
old_trap = trap("INT") { exit! 130 }
require... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/hardware.rb | Ruby | bsd-2-clause | 47,751 | main | 6,687 | # typed: strict
# frozen_string_literal: true
require "utils/popen"
# Helper module for querying hardware information.
module Hardware
# Helper module for querying CPU information.
class CPU
INTEL_32BIT_ARCHS = [:i386].freeze
INTEL_64BIT_ARCHS = [:x86_64].freeze
INTEL_ARCHS = T.let((INTEL_32BIT_... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/caveats.rb | Ruby | bsd-2-clause | 47,751 | main | 7,258 | # typed: strict
# frozen_string_literal: true
require "utils/service"
# A formula's caveats.
class Caveats
extend Forwardable
sig { returns(Formula) }
attr_reader :formula
sig { params(formula: Formula).void }
def initialize(formula)
@formula = formula
@caveats = T.let(nil, T.nilable(String))
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/install.rb | Ruby | bsd-2-clause | 47,751 | main | 24,456 | # typed: strict
# frozen_string_literal: true
require "diagnostic"
require "fileutils"
require "hardware"
require "development_tools"
require "upgrade"
require "download_queue"
require "utils/output"
module Homebrew
# Helper module for performing (pre-)install checks.
module Install
extend Utils::Output::Mixi... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/dependency.rb | Ruby | bsd-2-clause | 47,751 | main | 14,338 | # typed: strict
# frozen_string_literal: true
require "dependable"
require "utils"
# A dependency on another Homebrew formula.
#
# @api internal
class Dependency
include Dependable
sig { returns(String) }
attr_reader :name
sig { returns(T.nilable(Tap)) }
attr_reader :tap
sig { override.returns(T::Array... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/bump_version_parser.rb | Ruby | bsd-2-clause | 47,751 | main | 2,000 | # typed: strict
# frozen_string_literal: true
module Homebrew
# Class handling architecture-specific version information.
class BumpVersionParser
VERSION_SYMBOLS = [:general, :arm, :intel].freeze
sig { returns(T.nilable(T.any(Version, Cask::DSL::Version))) }
attr_reader :arm, :general, :intel
sig... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/warnings.rb | Ruby | bsd-2-clause | 47,751 | main | 911 | # typed: strict
# frozen_string_literal: true
require "warning"
# Helper module for handling warnings.
module Warnings
COMMON_WARNINGS = T.let({
parser_syntax: [
%r{warning: parser/current is loading parser/ruby\d+, which recognizes},
/warning: \d+\.\d+\.\d+-compliant syntax, but you are running \d+... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/startup.rb | Ruby | bsd-2-clause | 47,751 | main | 340 | # typed: strict
# frozen_string_literal: true
# This file should be the first `require` in all entrypoints of `brew`.
# Bootsnap should be loaded as early as possible.
require_relative "standalone/init"
require_relative "startup/bootsnap"
require_relative "startup/ruby_path"
require "startup/config"
require_relative ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/tab.rb | Ruby | bsd-2-clause | 47,751 | main | 20,144 | # typed: strict
# frozen_string_literal: true
require "cxxstdlib"
require "options"
require "json"
require "development_tools"
require "cachable"
# Rather than calling `new` directly, use one of the class methods like {Tab.create}.
class AbstractTab
extend T::Generic
extend Cachable
extend T::Helpers
# Sorbe... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/pkg_version.rb | Ruby | bsd-2-clause | 47,751 | main | 1,353 | # typed: strict
# frozen_string_literal: true
require "version"
# Combination of a version and a revision.
class PkgVersion
include Comparable
extend Forwardable
REGEX = /\A(.+?)(?:_(\d+))?\z/
private_constant :REGEX
sig { returns(Version) }
attr_reader :version
sig { returns(Integer) }
attr_reader... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/options.rb | Ruby | bsd-2-clause | 47,751 | main | 4,257 | # typed: strict
# frozen_string_literal: true
# A formula option.
class Option
sig { returns(String) }
attr_reader :name
sig { returns(String) }
attr_reader :description, :flag
sig { params(name: String, description: String).void }
def initialize(name, description = "")
@name = name
@flag = T.let... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/development_tools.rb | Ruby | bsd-2-clause | 47,751 | main | 5,499 | # typed: strict
# frozen_string_literal: true
require "version"
# Helper class for gathering information about development tools.
#
# @api public
class DevelopmentTools
class << self
# Locate a development tool.
#
# @api public
sig { params(tool: T.any(String, Symbol)).returns(T.nilable(Pathname)) }... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/readall.rb | Ruby | bsd-2-clause | 47,751 | main | 5,035 | # typed: strict
# frozen_string_literal: true
require "formula"
require "cask/cask_loader"
require "system_command"
require "utils/output"
# Helper module for validating syntax in taps.
module Readall
extend T::Generic
extend Cachable
extend SystemCommand::Mixin
extend Utils::Output::Mixin
# Sorbet type me... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/sandbox.rb | Ruby | bsd-2-clause | 47,751 | main | 11,620 | # typed: strict
# frozen_string_literal: true
require "erb"
require "io/console"
require "pty"
require "tempfile"
require "utils/fork"
require "utils/output"
# Helper class for running a sub-process inside of a sandboxed environment.
class Sandbox
include Utils::Output::Mixin
SANDBOX_EXEC = "/usr/bin/sandbox-exe... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/homebrew.rb | Ruby | bsd-2-clause | 47,751 | main | 3,464 | # typed: strict
# frozen_string_literal: true
require "context"
module Homebrew
extend Context
sig { params(path: T.nilable(T.any(String, Pathname))).returns(T::Boolean) }
def self.require?(path)
return false if path.nil?
if defined?(Warnings)
# Work around require warning when done repeatedly:
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/deprecate_disable.rb | Ruby | bsd-2-clause | 47,751 | main | 4,435 | # typed: strict
# frozen_string_literal: true
# Helper module for handling `disable!` and `deprecate!`.
# @api internal
module DeprecateDisable
module_function
FORMULA_DEPRECATE_DISABLE_REASONS = T.let({
does_not_build: "does not build",
no_license: "has no license",
repo_archived: ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/brew_irb_helpers.rb | Ruby | bsd-2-clause | 47,751 | main | 857 | # typed: strict
# frozen_string_literal: true
# Helper methods for the Homebrew IRB/PRY shell run by `brew irb`
require "formula"
require "formulary"
require "cask/cask_loader"
class String
# @!visibility private
sig { params(args: Integer).returns(Formula) }
def f(*args)
Formulary.factory(self, *args)
e... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/formula_pin.rb | Ruby | bsd-2-clause | 47,751 | main | 1,085 | # typed: strict
# frozen_string_literal: true
require "keg"
# Helper functions for pinning a formula.
class FormulaPin
sig { params(formula: Formula).void }
def initialize(formula)
@formula = formula
end
sig { returns(Pathname) }
def path
HOMEBREW_PINNED_KEGS/@formula.name
end
sig { params(ver... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/dependable.rb | Ruby | bsd-2-clause | 47,751 | main | 2,545 | # typed: strict
# frozen_string_literal: true
require "options"
# Shared functions for classes which can be depended upon.
module Dependable
extend T::Helpers
# Return from an {Dependency.expand} or {Requirement.expand} block to remove
# a dependency/requirement and all of its recursive dependencies from the r... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/resource_auditor.rb | Ruby | bsd-2-clause | 47,751 | main | 9,255 | # typed: strict
# frozen_string_literal: true
require "utils/svn"
module Homebrew
# Auditor for checking common violations in {Resource}s.
class ResourceAuditor
include Utils::Curl
sig { returns(T.nilable(String)) }
attr_reader :name
sig { returns(T.nilable(Version)) }
attr_reader :version
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/version.rb | Ruby | bsd-2-clause | 47,751 | main | 21,059 | # typed: strict
# frozen_string_literal: true
require "version/parser"
# A formula's version.
class Version
include Comparable
sig { params(name: T.any(String, Symbol), full: T::Boolean).returns(Regexp) }
def self.formula_optionally_versioned_regex(name, full: true)
/#{"^" if full}#{Regexp.escape(name)}(@\... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/brew.rb | Ruby | bsd-2-clause | 47,751 | main | 8,039 | # typed: strict
# frozen_string_literal: true
# `HOMEBREW_STACKPROF` should be set via `brew prof --stackprof`, not manually.
if ENV["HOMEBREW_STACKPROF"]
require "rubygems"
require "stackprof"
StackProf.start(mode: :wall, raw: true)
end
raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/formula_info.rb | Ruby | bsd-2-clause | 47,751 | main | 2,262 | # typed: strict
# frozen_string_literal: true
# Formula information drawn from an external `brew info --json` call.
class FormulaInfo
# The whole info structure parsed from the JSON.
sig { returns(T::Hash[String, T.untyped]) }
attr_accessor :info
sig { params(info: T::Hash[String, T.untyped]).void }
def ini... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/utils.rb | Ruby | bsd-2-clause | 47,751 | main | 6,325 | # typed: strict
# frozen_string_literal: true
module Utils
# Removes the rightmost segment from the constant expression in the string.
#
# deconstantize('Net::HTTP') # => "Net"
# deconstantize('::Net::HTTP') # => "::Net"
# deconstantize('String') # => ""
# deconstantize('::String') # => "... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/lazy_object.rb | Ruby | bsd-2-clause | 47,751 | main | 1,286 | # typed: strict
# frozen_string_literal: true
require "delegate"
# An object which lazily evaluates its inner block only once a method is called on it.
class LazyObject < Delegator
sig { params(callable: T.nilable(Proc)).void }
def initialize(&callable)
@__callable__ = T.let(nil, T.nilable(Proc))
@getobj_... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/unlink.rb | Ruby | bsd-2-clause | 47,751 | main | 973 | # typed: strict
# frozen_string_literal: true
module Homebrew
# Provides helper methods for unlinking formulae and kegs with consistent output.
module Unlink
sig { params(formula: Formula, verbose: T::Boolean).void }
def self.unlink_link_overwrite_formulae(formula, verbose: false)
overwrite_formulae ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/install_renamed.rb | Ruby | bsd-2-clause | 47,751 | main | 1,343 | # typed: strict
# frozen_string_literal: true
# Helper module for installing default files.
module InstallRenamed
sig {
params(src: T.any(String, Pathname), new_basename: String,
_block: T.nilable(T.proc.params(src: Pathname, dst: Pathname).returns(T.nilable(Pathname)))).void
}
def install_p(src, ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/global.rb | Ruby | bsd-2-clause | 47,751 | main | 6,610 | # typed: strict
# frozen_string_literal: true
require_relative "startup"
HOMEBREW_HELP_MESSAGE = T.let(ENV.fetch("HOMEBREW_HELP_MESSAGE").freeze, String)
HOMEBREW_API_DEFAULT_DOMAIN = T.let(ENV.fetch("HOMEBREW_API_DEFAULT_DOMAIN").freeze, String)
HOMEBREW_BOTTLE_DEFAULT_DOMAIN = T.let(ENV.fetch("HOMEBREW_BOTTLE_DEFA... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/github_runner_matrix.rb | Ruby | bsd-2-clause | 47,751 | main | 12,673 | # typed: strict
# frozen_string_literal: true
require "test_runner_formula"
require "github_runner"
class GitHubRunnerMatrix
# When bumping newest runner, run e.g. `git log -p --reverse -G "sha256 tahoe"`
# on homebrew/core and tag the first commit with a bottle e.g.
# `git tag 15-sequoia f42c4a659e4da887fc714f... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/formula_name_cask_token_auditor.rb | Ruby | bsd-2-clause | 47,751 | main | 1,013 | # typed: strict
# frozen_string_literal: true
module Homebrew
class FormulaNameCaskTokenAuditor
sig { returns(String) }
attr_reader :token
sig { params(token: String).void }
def initialize(token)
@token = token
end
sig { returns(T::Array[String]) }
def errors
errors = []
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/formula_creator.rb | Ruby | bsd-2-clause | 47,751 | main | 11,172 | # typed: strict
# frozen_string_literal: true
require "digest"
require "erb"
require "utils/github"
require "utils/output"
module Homebrew
# Class for generating a formula from a template.
class FormulaCreator
include Utils::Output::Mixin
sig { returns(String) }
attr_accessor :name
sig { returns... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/settings.rb | Ruby | bsd-2-clause | 47,751 | main | 1,300 | # typed: strict
# frozen_string_literal: true
require "utils/popen"
module Homebrew
# Helper functions for reading and writing settings.
module Settings
sig {
params(setting: T.any(String, Symbol), repo: Pathname)
.returns(T.nilable(String))
}
def self.read(setting, repo: HOMEBREW_REPOSI... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/tap_auditor.rb | Ruby | bsd-2-clause | 47,751 | main | 8,549 | # typed: strict
# frozen_string_literal: true
require "utils"
module Homebrew
# Auditor for checking common violations in {Tap}s.
class TapAuditor
sig { returns(String) }
attr_reader :name
sig { returns(Pathname) }
attr_reader :path
sig { returns(T::Array[String]) }
attr_reader :formula_... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/bottle.rb | Ruby | bsd-2-clause | 47,751 | main | 7,811 | # typed: strict
# frozen_string_literal: true
class Bottle
include Downloadable
class Filename
sig { returns(String) }
attr_reader :name, :tag
sig { returns(PkgVersion) }
attr_reader :version
sig { returns(Integer) }
attr_reader :rebuild
sig { params(formula: Formula, tag: Utils::Bo... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test_runner_formula.rb | Ruby | bsd-2-clause | 47,751 | main | 2,880 | # typed: strict
# frozen_string_literal: true
require "formula"
class TestRunnerFormula
sig { returns(String) }
attr_reader :name
sig { returns(Formula) }
attr_reader :formula
sig { returns(T::Boolean) }
attr_reader :eval_all
sig { params(formula: Formula, eval_all: T::Boolean).void }
def initializ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/cleanup.rb | Ruby | bsd-2-clause | 47,751 | main | 27,401 | # typed: strict
# frozen_string_literal: true
require "utils/bottles"
require "utils/output"
require "installed_dependents"
require "formula"
require "cask/cask_loader"
module Homebrew
# Helper class for cleaning up the Homebrew cache.
class Cleanup
extend Utils::Output::Mixin
include Utils::Output::Mixi... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/executables_db.rb | Ruby | bsd-2-clause | 47,751 | main | 7,621 | # typed: strict
# frozen_string_literal: true
# License: MIT
# The license text can be found in Library/Homebrew/command-not-found/LICENSE
require "formula"
require "formulary"
require "tap"
require "utils/output"
module Homebrew
# ExecutablesDB represents a DB associating formulae to the binaries they
# provide... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/test.rb | Ruby | bsd-2-clause | 47,751 | main | 2,795 | # typed: strict
# frozen_string_literal: true
raise "#{__FILE__} must not be loaded via `require`." if $PROGRAM_NAME != __FILE__
old_trap = trap("INT") { exit! 130 }
require_relative "global"
require "extend/ENV"
require "timeout"
require "formula_assertions"
require "formula_free_port"
require "fcntl"
require "util... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/resource.rb | Ruby | bsd-2-clause | 47,751 | main | 16,009 | # typed: strict
# frozen_string_literal: true
require "downloadable"
require "formula_creator"
require "mktemp"
require "livecheck"
require "on_system"
require "utils/output"
# Resource is the fundamental representation of an external resource. The
# primary formula download, along with other declared resources, are ... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/patch.rb | Ruby | bsd-2-clause | 47,751 | main | 5,181 | # typed: strict
# frozen_string_literal: true
require "resource"
require "erb"
require "utils/output"
# Helper module for creating patches.
module Patch
sig {
params(
strip: T.any(Symbol, String),
src: T.nilable(T.any(Symbol, String)),
block: T.nilable(T.proc.bind(Resource::Patch).void),
... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/help.rb | Ruby | bsd-2-clause | 47,751 | main | 3,784 | # typed: strict
# frozen_string_literal: true
require "cli/parser"
require "commands"
require "utils/output"
module Homebrew
# Helper module for printing help output.
module Help
extend Utils::Output::Mixin
sig {
params(
cmd: T.nilable(String),
empty_argv: T::Boolean,... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/bottle_specification.rb | Ruby | bsd-2-clause | 47,751 | main | 5,475 | # typed: strict
# frozen_string_literal: true
class BottleSpecification
include Utils::Output::Mixin
RELOCATABLE_CELLARS = [:any, :any_skip_relocation].freeze
sig { returns(T.nilable(Tap)) }
attr_accessor :tap
sig { returns(Utils::Bottles::Collector) }
attr_reader :collector
sig { returns(T::Hash[Sym... |
github | Homebrew/brew | https://github.com/Homebrew/brew | Library/Homebrew/PATH.rb | Ruby | bsd-2-clause | 47,751 | main | 2,285 | # typed: strict
# frozen_string_literal: true
require "forwardable"
# Representation of a `*PATH` environment variable.
class PATH
include Enumerable
extend Forwardable
extend T::Generic
delegate each: :@paths
Elem = type_member(:out) { { fixed: String } }
Element = T.type_alias { T.nilable(T.any(Pathna... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.