repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/mac/language/java.rb | Library/Homebrew/extend/os/mac/language/java.rb | module Language
module Java
def self.java_home_cmd(version = nil)
version_flag = " --version #{version}" if version
"/usr/libexec/java_home#{version_flag}"
end
def self.java_home(version = nil)
cmd = Language::Java.java_home_cmd(version)
Pathname.new Utils.popen_read(cmd).chomp
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/requirements/x11_requirement.rb | Library/Homebrew/extend/os/requirements/x11_requirement.rb | if OS.mac?
require "extend/os/mac/requirements/x11_requirement"
elsif OS.linux?
require "extend/os/linux/requirements/x11_requirement"
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/requirements/java_requirement.rb | Library/Homebrew/extend/os/requirements/java_requirement.rb | if OS.mac?
require "extend/os/mac/requirements/java_requirement"
elsif OS.linux?
require "extend/os/linux/requirements/java_requirement"
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/requirements/osxfuse_requirement.rb | Library/Homebrew/extend/os/requirements/osxfuse_requirement.rb | if OS.mac?
require "extend/os/mac/requirements/osxfuse_requirement"
elsif OS.linux?
require "extend/os/linux/requirements/osxfuse_requirement"
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/keg_relocate.rb | Library/Homebrew/extend/os/linux/keg_relocate.rb | class Keg
def relocate_dynamic_linkage(relocation)
# Patching the dynamic linker of glibc breaks it.
return if name == "glibc"
# Patching patchelf using itself fails with "Text file busy" or SIGBUS.
return if name == "patchelf"
elf_files.each do |file|
file.ensure_writable do
chang... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/cleaner.rb | Library/Homebrew/extend/os/linux/cleaner.rb | class Cleaner
private
def executable_path?(path)
path.elf? || path.text_executable?
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/compilers.rb | Library/Homebrew/extend/os/linux/compilers.rb | class CompilerSelector
def gnu_gcc_versions
v = Formulary.factory("gcc").version.to_s.slice(/\d/)
GNU_GCC_VERSIONS - [v] + [v]
rescue FormulaUnavailableError
GNU_GCC_VERSIONS
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/diagnostic.rb | Library/Homebrew/extend/os/linux/diagnostic.rb | require "tempfile"
require "utils/shell"
require "os/linux/diagnostic"
require "os/linux/glibc"
require "os/linux/kernel"
module Homebrew
module Diagnostic
class Checks
def supported_configuration_checks
%w[
check_glibc_minimum_version
check_kernel_minimum_version
].free... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/tap.rb | Library/Homebrew/extend/os/linux/tap.rb | class CoreTap < Tap
def default_remote
if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
"https://github.com/Homebrew/homebrew-core".freeze
else
"https://github.com/Linuxbrew/homebrew-core".freeze
end
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/system_config.rb | Library/Homebrew/extend/os/linux/system_config.rb | require "formula"
require "os/linux/glibc"
class SystemConfig
class << self
def host_os_version
if which("lsb_release")
description = `lsb_release -d`.chomp.sub("Description:\t", "")
codename = `lsb_release -c`.chomp.sub("Codename:\t", "")
"#{description} (#{codename})"
elsif ... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/formula_cellar_checks.rb | Library/Homebrew/extend/os/linux/formula_cellar_checks.rb | module FormulaCellarChecks
def valid_library_extension?(filename)
generic_valid_library_extension?(filename) || filename.basename.to_s.include?(".so.")
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/dependency_collector.rb | Library/Homebrew/extend/os/linux/dependency_collector.rb | class DependencyCollector
def java_dep_if_needed(tags)
req = JavaRequirement.new(tags)
begin
dep = Dependency.new("openjdk", tags)
return dep if dep.installed?
return req if req.satisfied?
dep
rescue FormulaUnavailableError
req
end
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/software_spec.rb | Library/Homebrew/extend/os/linux/software_spec.rb | class BottleSpecification
def skip_relocation?
false
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/linkage_checker.rb | Library/Homebrew/extend/os/linux/linkage_checker.rb | class LinkageChecker
# Libraries provided by glibc and gcc.
SYSTEM_LIBRARY_WHITELIST = %w[
ld-linux-x86-64.so.2
libanl.so.1
libc.so.6
libcrypt.so.1
libdl.so.2
libm.so.6
libmvec.so.1
libnsl.so.1
libpthread.so.0
libresolv.so.2
librt.so.1
libutil.so.1
libgcc_s.so.1
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/install.rb | Library/Homebrew/extend/os/linux/install.rb | module Homebrew
module Install
module_function
DYNAMIC_LINKERS = [
"/lib64/ld-linux-x86-64.so.2",
"/lib/ld-linux.so.3",
"/lib/ld-linux.so.2",
"/lib/ld-linux-aarch64.so.1",
"/lib/ld-linux-armhf.so.3",
"/system/bin/linker64",
"/system/bin/linker",
].freeze
def... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/development_tools.rb | Library/Homebrew/extend/os/linux/development_tools.rb | class DevelopmentTools
class << self
def locate(tool)
(@locate ||= {}).fetch(tool) do |key|
@locate[key] = if (path = HOMEBREW_PREFIX/"bin/#{tool}").executable?
path
elsif File.executable?(path = "/usr/bin/#{tool}")
Pathname.new path
end
end
end
def... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/hardware/cpu.rb | Library/Homebrew/extend/os/linux/hardware/cpu.rb | module Hardware
class CPU
class << self
def cpuinfo
@cpuinfo ||= File.read("/proc/cpuinfo")
end
def family
return :arm if arm?
return :ppc if ppc?
return :dunno unless intel?
# See https://software.intel.com/en-us/articles/intel-architecture-and-processo... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/utils/bottles.rb | Library/Homebrew/extend/os/linux/utils/bottles.rb | module Utils
class Bottles
class << self
def tag
@linux_kernel_version ||= Version.new Utils.popen_read("uname -r")
if @linux_kernel_version >= "2.6.32"
"#{ENV["HOMEBREW_PROCESSOR"]}_#{ENV["HOMEBREW_SYSTEM"]}"
else
"#{ENV["HOMEBREW_PROCESSOR"]}_#{ENV["HOMEBREW_SYS... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/requirements/x11_requirement.rb | Library/Homebrew/extend/os/linux/requirements/x11_requirement.rb | require "requirement"
class X11Requirement < Requirement
alias old_message message
def message
old_message + <<~EOS
To install it, run:
brew install linuxbrew/xorg/xorg
EOS
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/requirements/java_requirement.rb | Library/Homebrew/extend/os/linux/requirements/java_requirement.rb | require "language/java"
class JavaRequirement < Requirement
env do
env_java_common
env_oracle_jdk
end
def possible_javas
javas = []
javas << Pathname.new(ENV["JAVA_HOME"])/"bin/java" if ENV["JAVA_HOME"]
%w[jdk jdk@8 jdk@7].each do |formula_name|
begin
java = Formula[formula_nam... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/requirements/osxfuse_requirement.rb | Library/Homebrew/extend/os/linux/requirements/osxfuse_requirement.rb | require "requirement"
class OsxfuseRequirement < Requirement
download "https://github.com/libfuse/libfuse"
satisfy(build_env: false) do
next true if libfuse_formula_exists? && Formula["libfuse"].installed?
includedirs = %w[
/usr/include
/usr/local/include
]
next true if (includedirs.m... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/extend/pathname.rb | Library/Homebrew/extend/os/linux/extend/pathname.rb | require "os/linux/elf"
class Pathname
prepend ELFShim
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/extend/ENV/std.rb | Library/Homebrew/extend/os/linux/extend/ENV/std.rb | module Stdenv
def setup_build_environment(formula = nil)
generic_setup_build_environment(formula)
prepend_path "CPATH", HOMEBREW_PREFIX/"include"
prepend_path "LIBRARY_PATH", HOMEBREW_PREFIX/"lib"
prepend_path "LD_RUN_PATH", HOMEBREW_PREFIX/"lib"
return unless formula
prepend_path "CPATH", f... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/extend/ENV/super.rb | Library/Homebrew/extend/os/linux/extend/ENV/super.rb | module Superenv
alias x11? x11
# @private
def self.bin
(HOMEBREW_SHIMS_PATH/"linux/super").realpath
end
# @private
def setup_build_environment(formula = nil)
generic_setup_build_environment(formula)
self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O2"
self["HOMEBREW_DYNAMIC_LINKER"] = determine_dyna... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/linux/extend/ENV/shared.rb | Library/Homebrew/extend/os/linux/extend/ENV/shared.rb | module SharedEnvExtension
# @private
def effective_arch
if ARGV.build_bottle?
ARGV.bottle_arch || Hardware.oldest_cpu
else
:native
end
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/extend/ENV/std.rb | Library/Homebrew/extend/os/extend/ENV/std.rb | if OS.mac?
require "extend/os/mac/extend/ENV/std"
elsif OS.linux?
require "extend/os/linux/extend/ENV/std"
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/extend/ENV/super.rb | Library/Homebrew/extend/os/extend/ENV/super.rb | if OS.mac?
require "extend/os/mac/extend/ENV/super"
elsif OS.linux?
require "extend/os/linux/extend/ENV/super"
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/extend/ENV/shared.rb | Library/Homebrew/extend/os/extend/ENV/shared.rb | if OS.mac?
require "extend/os/mac/extend/ENV/shared"
elsif OS.linux?
require "extend/os/linux/extend/ENV/shared"
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/os/language/java.rb | Library/Homebrew/extend/os/language/java.rb | require "extend/os/mac/language/java" if OS.mac?
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/ENV/std.rb | Library/Homebrew/extend/ENV/std.rb | require "hardware"
require "extend/ENV/shared"
# @private
module Stdenv
include SharedEnvExtension
# @private
SAFE_CFLAGS_FLAGS = "-w -pipe".freeze
# @private
def setup_build_environment(formula = nil)
super
self["HOMEBREW_ENV"] = "std"
PATH.new(ENV["HOMEBREW_PATH"]).each { |p| prepend_path "... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/ENV/super.rb | Library/Homebrew/extend/ENV/super.rb | require "extend/ENV/shared"
require "development_tools"
# ### Why `superenv`?
#
# 1. Only specify the environment we need (NO LDFLAGS for cmake)
# 2. Only apply compiler specific options when we are calling that compiler
# 3. Force all incpaths and libpaths into the cc instantiation (less bugs)
# 4. Cater toolchain us... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/extend/ENV/shared.rb | Library/Homebrew/extend/ENV/shared.rb | require "compilers"
require "development_tools"
# Homebrew extends Ruby's `ENV` to make our code more readable.
# Implemented in {SharedEnvExtension} and either {Superenv} or
# {Stdenv} (depending on the build mode).
# @see Superenv
# @see Stdenv
# @see https://www.rubydoc.info/stdlib/Env Ruby's ENV API
module SharedE... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/air.rb | Library/Homebrew/unpack_strategy/air.rb | # frozen_string_literal: true
module UnpackStrategy
class Air
include UnpackStrategy
using Magic
def self.extensions
[".air"]
end
def self.can_extract?(path)
mime_type = "application/vnd.adobe.air-application-installer-package+zip"
path.magic_number.match?(/.{59}#{Regexp.esca... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/executable.rb | Library/Homebrew/unpack_strategy/executable.rb | require_relative "uncompressed"
module UnpackStrategy
class Executable < Uncompressed
using Magic
def self.extensions
[".sh", ".bash"]
end
def self.can_extract?(path)
path.magic_number.match?(/\A#!\s*\S+/n) ||
path.magic_number.match?(/\AMZ/n)
end
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/mercurial.rb | Library/Homebrew/unpack_strategy/mercurial.rb | require_relative "directory"
module UnpackStrategy
class Mercurial < Directory
using Magic
def self.can_extract?(path)
super && (path/".hg").directory?
end
private
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "hg",
args: ["--cwd", pat... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/directory.rb | Library/Homebrew/unpack_strategy/directory.rb | module UnpackStrategy
class Directory
include UnpackStrategy
using Magic
def self.extensions
[]
end
def self.can_extract?(path)
path.directory?
end
private
def extract_to_dir(unpack_dir, basename:, verbose:)
path.children.each do |child|
system_command! "... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/jar.rb | Library/Homebrew/unpack_strategy/jar.rb | require_relative "uncompressed"
module UnpackStrategy
class Jar < Uncompressed
using Magic
def self.extensions
[".apk", ".jar"]
end
def self.can_extract?(path)
return false unless Zip.can_extract?(path)
# Check further if the ZIP is a JAR/WAR.
path.zipinfo.include?("META-IN... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/compress.rb | Library/Homebrew/unpack_strategy/compress.rb | require_relative "tar"
module UnpackStrategy
class Compress < Tar
using Magic
def self.extensions
[".Z"]
end
def self.can_extract?(path)
path.magic_number.match?(/\A\037\235/n)
end
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/p7zip.rb | Library/Homebrew/unpack_strategy/p7zip.rb | module UnpackStrategy
class P7Zip
include UnpackStrategy
using Magic
def self.extensions
[".7z"]
end
def self.can_extract?(path)
path.magic_number.match?(/\A7z\xBC\xAF\x27\x1C/n)
end
def dependencies
@dependencies ||= [Formula["p7zip"]]
end
private
def e... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/pax.rb | Library/Homebrew/unpack_strategy/pax.rb | module UnpackStrategy
class Pax
include UnpackStrategy
using Magic
def self.extensions
[".pax"]
end
def self.can_extract?(_path)
false
end
private
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "pax",
args: ["-rf", pa... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/tar.rb | Library/Homebrew/unpack_strategy/tar.rb | module UnpackStrategy
class Tar
include UnpackStrategy
using Magic
def self.extensions
[
".tar",
".tbz", ".tbz2", ".tar.bz2",
".tgz", ".tar.gz",
".tlzma", ".tar.lzma",
".txz", ".tar.xz"
]
end
def self.can_extract?(path)
return true if pa... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/cab.rb | Library/Homebrew/unpack_strategy/cab.rb | module UnpackStrategy
class Cab
include UnpackStrategy
using Magic
def self.extensions
[".cab"]
end
def self.can_extract?(path)
path.magic_number.match?(/\AMSCF/n)
end
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "cabextract",
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/subversion.rb | Library/Homebrew/unpack_strategy/subversion.rb | require_relative "directory"
module UnpackStrategy
class Subversion < Directory
using Magic
def self.can_extract?(path)
super && (path/".svn").directory?
end
private
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "svn",
args: ["export",... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/bazaar.rb | Library/Homebrew/unpack_strategy/bazaar.rb | require_relative "directory"
module UnpackStrategy
class Bazaar < Directory
using Magic
def self.can_extract?(path)
super && (path/".bzr").directory?
end
private
def extract_to_dir(unpack_dir, basename:, verbose:)
super
# The export command doesn't work on checkouts (see htt... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/bzip2.rb | Library/Homebrew/unpack_strategy/bzip2.rb | module UnpackStrategy
class Bzip2
include UnpackStrategy
using Magic
def self.extensions
[".bz2"]
end
def self.can_extract?(path)
path.magic_number.match?(/\ABZh/n)
end
private
def extract_to_dir(unpack_dir, basename:, verbose:)
FileUtils.cp path, unpack_dir/base... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/lha.rb | Library/Homebrew/unpack_strategy/lha.rb | module UnpackStrategy
class Lha
include UnpackStrategy
using Magic
def self.extensions
[".lha", ".lzh"]
end
def self.can_extract?(path)
path.magic_number.match?(/\A..-(lh0|lh1|lz4|lz5|lzs|lh\\40|lhd|lh2|lh3|lh4|lh5)-/n)
end
def dependencies
@dependencies ||= [Formula[... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/zip.rb | Library/Homebrew/unpack_strategy/zip.rb | module UnpackStrategy
class Zip
include UnpackStrategy
using Magic
def self.extensions
[".zip"]
end
def self.can_extract?(path)
path.magic_number.match?(/\APK(\003\004|\005\006)/n)
end
private
def extract_to_dir(unpack_dir, basename:, verbose:)
quiet_flags = verb... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/cvs.rb | Library/Homebrew/unpack_strategy/cvs.rb | require_relative "directory"
module UnpackStrategy
class Cvs < Directory
using Magic
def self.can_extract?(path)
super && (path/"CVS").directory?
end
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/rar.rb | Library/Homebrew/unpack_strategy/rar.rb | module UnpackStrategy
class Rar
include UnpackStrategy
using Magic
def self.extensions
[".rar"]
end
def self.can_extract?(path)
path.magic_number.match?(/\ARar!/n)
end
def dependencies
@dependencies ||= [Formula["unrar"]]
end
private
def extract_to_dir(u... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/lua_rock.rb | Library/Homebrew/unpack_strategy/lua_rock.rb | require_relative "uncompressed"
module UnpackStrategy
class LuaRock < Uncompressed
using Magic
def self.extensions
[".rock"]
end
def self.can_extract?(path)
return false unless Zip.can_extract?(path)
# Check further if the ZIP is a LuaRocks package.
path.zipinfo.grep(%r{\A[... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/gzip.rb | Library/Homebrew/unpack_strategy/gzip.rb | module UnpackStrategy
class Gzip
include UnpackStrategy
using Magic
def self.extensions
[".gz"]
end
def self.can_extract?(path)
path.magic_number.match?(/\A\037\213/n)
end
private
def extract_to_dir(unpack_dir, basename:, verbose:)
FileUtils.cp path, unpack_dir/b... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/otf.rb | Library/Homebrew/unpack_strategy/otf.rb | require_relative "uncompressed"
module UnpackStrategy
class Otf < Uncompressed
using Magic
def self.extensions
[".otf"]
end
def self.can_extract?(path)
path.magic_number.match?(/\AOTTO/n)
end
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/xz.rb | Library/Homebrew/unpack_strategy/xz.rb | module UnpackStrategy
class Xz
include UnpackStrategy
using Magic
def self.extensions
[".xz"]
end
def self.can_extract?(path)
path.magic_number.match?(/\A\xFD7zXZ\x00/n)
end
def dependencies
@dependencies ||= [Formula["xz"]]
end
private
def extract_to_di... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/uncompressed.rb | Library/Homebrew/unpack_strategy/uncompressed.rb | module UnpackStrategy
class Uncompressed
include UnpackStrategy
def extract_nestedly(extension_only: false, **options)
extract(**options)
end
private
def extract_to_dir(unpack_dir, basename:, verbose:)
FileUtils.cp path, unpack_dir/basename, preserve: true, verbose: verbose
end
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/dmg.rb | Library/Homebrew/unpack_strategy/dmg.rb | require "tempfile"
module UnpackStrategy
class Dmg
include UnpackStrategy
module Bom
DMG_METADATA = Set.new %w[
.background
.com.apple.timemachine.donotpresent
.com.apple.timemachine.supported
.DocumentRevisions-V100
.DS_Store
.fseventsd
.MobileB... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/fossil.rb | Library/Homebrew/unpack_strategy/fossil.rb | module UnpackStrategy
class Fossil
include UnpackStrategy
using Magic
def self.extensions
[]
end
def self.can_extract?(path)
return false unless path.magic_number.match?(/\ASQLite format 3\000/n)
# Fossil database is made up of artifacts, so the `artifact` table must exist.
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/xar.rb | Library/Homebrew/unpack_strategy/xar.rb | module UnpackStrategy
class Xar
include UnpackStrategy
using Magic
def self.extensions
[".xar"]
end
def self.can_extract?(path)
path.magic_number.match?(/\Axar!/n)
end
private
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "xar",
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/microsoft_office_xml.rb | Library/Homebrew/unpack_strategy/microsoft_office_xml.rb | require_relative "uncompressed"
module UnpackStrategy
class MicrosoftOfficeXml < Uncompressed
using Magic
def self.extensions
[
".doc", ".docx",
".ppt", ".pptx",
".xls", ".xlsx"
]
end
def self.can_extract?(path)
return false unless Zip.can_extract?(path)
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/pkg.rb | Library/Homebrew/unpack_strategy/pkg.rb | require_relative "uncompressed"
module UnpackStrategy
class Pkg < Uncompressed
using Magic
def self.extensions
[".pkg", ".mkpg"]
end
def self.can_extract?(path)
path.extname.match?(/\A.m?pkg\Z/) &&
(path.directory? || path.magic_number.match?(/\Axar!/n))
end
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/self_extracting_executable.rb | Library/Homebrew/unpack_strategy/self_extracting_executable.rb | require_relative "generic_unar"
module UnpackStrategy
class SelfExtractingExecutable < GenericUnar
using Magic
def self.extensions
[]
end
def self.can_extract?(path)
path.magic_number.match?(/\AMZ/n) &&
path.file_type.include?("self-extracting archive")
end
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/generic_unar.rb | Library/Homebrew/unpack_strategy/generic_unar.rb | module UnpackStrategy
class GenericUnar
include UnpackStrategy
using Magic
def self.extensions
[]
end
def self.can_extract?(_path)
false
end
def dependencies
@dependencies ||= [Formula["unar"]]
end
private
def extract_to_dir(unpack_dir, basename:, verbos... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/git.rb | Library/Homebrew/unpack_strategy/git.rb | require_relative "directory"
module UnpackStrategy
class Git < Directory
using Magic
def self.can_extract?(path)
super && (path/".git").directory?
end
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/ttf.rb | Library/Homebrew/unpack_strategy/ttf.rb | require_relative "uncompressed"
module UnpackStrategy
class Ttf < Uncompressed
using Magic
def self.extensions
[".ttc", ".ttf"]
end
def self.can_extract?(path)
# TrueType Font
path.magic_number.match?(/\A\000\001\000\000\000/n) ||
# Truetype Font Collection
path.ma... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/lzip.rb | Library/Homebrew/unpack_strategy/lzip.rb | module UnpackStrategy
class Lzip
include UnpackStrategy
using Magic
def self.extensions
[".lz"]
end
def self.can_extract?(path)
path.magic_number.match?(/\ALZIP/n)
end
def dependencies
@dependencies ||= [Formula["lzip"]]
end
private
def extract_to_dir(un... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/sit.rb | Library/Homebrew/unpack_strategy/sit.rb | require_relative "generic_unar"
module UnpackStrategy
class Sit < GenericUnar
using Magic
def self.extensions
[".sit"]
end
def self.can_extract?(path)
path.magic_number.match?(/\AStuffIt/n)
end
end
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/unpack_strategy/lzma.rb | Library/Homebrew/unpack_strategy/lzma.rb | module UnpackStrategy
class Lzma
include UnpackStrategy
using Magic
def self.extensions
[".lzma"]
end
def self.can_extract?(path)
path.magic_number.match?(/\A\]\000\000\200\000/n)
end
def extract_to_dir(unpack_dir, basename:, verbose:)
FileUtils.cp path, unpack_dir/ba... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/language/python.rb | Library/Homebrew/language/python.rb | require "language/python_virtualenv_constants"
module Language
module Python
def self.major_minor_version(python)
version = /\d\.\d/.match `#{python} --version 2>&1`
return unless version
Version.create(version.to_s)
end
def self.homebrew_site_packages(python = "python3.7")
HOME... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/language/python_virtualenv_constants.rb | Library/Homebrew/language/python_virtualenv_constants.rb | PYTHON_VIRTUALENV_URL =
"https://github.com/pypa/virtualenv/archive/16.2.0.tar.gz".freeze
PYTHON_VIRTUALENV_SHA256 =
"448def1220df9960e6d18fb5424107ffb1249eb566a5a311257860ab6b52b3fd".freeze
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/language/node.rb | Library/Homebrew/language/node.rb | module Language
module Node
def self.npm_cache_config
"cache=#{HOMEBREW_CACHE}/npm_cache"
end
def self.pack_for_installation
# Homebrew assumes the buildpath/testpath will always be disposable
# and from npm 5.0.0 the logic changed so that when a directory is
# fed to `npm install... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/language/go.rb | Library/Homebrew/language/go.rb | require "resource"
module Language
module Go
# Given a set of resources, stages them to a gopath for
# building go software.
# The resource names should be the import name of the package,
# e.g. `resource "github.com/foo/bar"`
def self.stage_deps(resources, target)
if resources.empty?
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/language/java.rb | Library/Homebrew/language/java.rb | module Language
module Java
def self.java_home_cmd(_ = nil)
# macOS provides /usr/libexec/java_home, but Linux does not.
raise NotImplementedError
end
def self.java_home(version = nil)
req = JavaRequirement.new [*version]
raise UnsatisfiedRequirements, req.message unless req.satis... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/language/haskell.rb | Library/Homebrew/language/haskell.rb | module Language
module Haskell
module Cabal
def self.included(base)
# use llvm-gcc on Lion or below, as when building GHC)
base.fails_with(:clang) if MacOS.version <= :lion
end
def cabal_sandbox(options = {})
pwd = Pathname.pwd
home = options[:home] || pwd
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
if ENV["COVERAGE"] == "true"
require "simplecov"
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
]
SimpleCov.start do
add_filter "spec"
end
end
require "tty"
require "tty-file"
require "fileutils"
require "shellwords"
r... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/integration/add_namespaced_spec.rb | spec/integration/add_namespaced_spec.rb | # frozen_string_literal: true
RSpec.describe "teletype add", type: :sandbox do
it "adds a command to namespaced application" do
app_name = "cli-app"
silent_run("teletype new #{app_name} --test rspec")
output = <<-OUT
create spec/integration/server_spec.rb
create spec/unit/server_spec.rb
... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/integration/new_spec.rb | spec/integration/new_spec.rb | # frozen_string_literal: true
RSpec.describe "teletype new", type: :sandbox do
def ci_line(name)
bundler_ver = Gem::Version.new(Bundler::VERSION)
ver = Gem::Version.new("2.2.0")
bundler_ver < ver ? "create #{name}/.travis.yml\n " : ""
end
it "generates cli application" do
app_name = "newcl... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/integration/start_spec.rb | spec/integration/start_spec.rb | RSpec.describe 'teletype' do
xit "prints available commands and global options" do
command = "teletype"
out = `#{command}`
expect(out).to eq(<<-OUT)
#{TTY::CLI.top_banner}Commands:
teletype add COMMAND_NAME [OPTIONS] # Add a command to the command line app.
teletype help [COMMAND] # De... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/integration/new_test_spec.rb | spec/integration/new_test_spec.rb | # frozen_string_literal: true
RSpec.describe "teletype new --test", type: :sandbox do
it "generates a rspec test setup" do
command = "teletype new newcli --test rspec"
`#{command}`
expect(File.exist?("newcli/spec/unit/.gitkeep"))
expect(File.exist?("newcli/spec/support/.gitkeep"))
expect(File.ex... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/integration/new_author_spec.rb | spec/integration/new_author_spec.rb | # frozen_string_literal: true
RSpec.describe "`teletype new --author` command", type: :sandbox do
it "sets an author" do
app_name = "newcli"
command = "teletype new #{app_name} --author 'Author A'"
`#{command}`
license = ::File.binread("newcli/LICENSE.txt")
expect(license).to include("Author A")... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/integration/new_license_spec.rb | spec/integration/new_license_spec.rb | # frozen_string_literal: true
RSpec.describe "teletype new --license", type: :sandbox do
it "generates a MIT license file" do
app_name = "newcli"
command = "teletype new #{app_name} --license mit --author 'Piotr Murach'"
`#{command}`
license = File.binread("newcli/LICENSE.txt")
gemspec = File.bi... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/integration/new_namespaced_spec.rb | spec/integration/new_namespaced_spec.rb | # frozen_string_literal: true
RSpec.describe "teletype new namespaced", type: :sandbox do
def ci_line(name)
bundler_ver = Gem::Version.new(Bundler::VERSION)
ver = Gem::Version.new("2.2.0")
bundler_ver < ver ? "create #{name}/.travis.yml\n " : ""
end
it "generates cli application namespaced" do... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/integration/add_force_spec.rb | spec/integration/add_force_spec.rb | # frozen_string_literal: true
RSpec.describe "`teletype add --force` command", type: :sandbox do
it "forces adding already existing command" do
app_path = "newcli"
cli_template = <<-EOS
require "thor"
module Newcli
class CLI < Thor
desc 'config', 'Set and unset configuration information'
method_op... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/integration/add_desc_args_spec.rb | spec/integration/add_desc_args_spec.rb | # frozen_string_literal: true
RSpec.describe "`teletype add --desc --args` command", type: :sandbox do
it "adds command with description and custom arguments" do
app_path = "newcli"
cli_template = <<-EOS
require "thor"
module Newcli
class CLI < Thor
end
end
EOS
dir = {
app_path => [
... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/integration/add_spec.rb | spec/integration/add_spec.rb | # frozen_string_literal: true
RSpec.describe "`teletype add` command", type: :sandbox do
it "shows an error when add is used outside a project directory" do
app_name = "notcli"
FileUtils.mkdir(app_name)
within_dir(app_name) do
command = "teletype add test --no-color"
output = <<-EOO
ERROR: ... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/integration/add_subcommand_spec.rb | spec/integration/add_subcommand_spec.rb | # frozen_string_literal: true
RSpec.describe "`teletype add` subcommad", type: :sandbox do
it "adds a new subcommand" do
app_name = "newcli"
silent_run("teletype new #{app_name} --test rspec")
output = <<-OUT
create spec/integration/config_spec.rb
create spec/integration/config/set_spec.rb... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/unit/gemspec_spec.rb | spec/unit/gemspec_spec.rb | # frozen_string_literal: true
require "tty/gemspec"
RSpec.describe TTY::Gemspec, "#read" do
it "reads gemspec's content" do
gemspec_path = fixtures_path("foo-0.0.1.gemspec")
gemspec = described_class.new
gemspec.read(gemspec_path)
expect(gemspec.content).to eq(::File.binread(gemspec_path))
expe... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/unit/tty_spec.rb | spec/unit/tty_spec.rb | # frozen_string_literal: true
RSpec.describe TTY do
let(:object) { described_class }
it { expect(object.plugins).to be_instance_of(TTY::Plugins) }
context 'when module' do
it 'decorates class' do
klass = Class.new { include TTY }
expect(klass).to respond_to(:plugins)
end
end
end # TTY
| ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/unit/cmd_spec.rb | spec/unit/cmd_spec.rb | # frozen_string_literal: true
require "tty/cmd"
RSpec.describe TTY::Cmd do
describe "#command_path" do
it "finds path for a top level command " do
stub_const("Commands::FooBarCommand", Class.new(TTY::Cmd))
expect(Commands::FooBarCommand.new.command_path).to eq("foo_bar")
end
it "finds path ... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/unit/plugins/load_from_spec.rb | spec/unit/plugins/load_from_spec.rb | # frozen_string_literal: true
RSpec.describe TTY::Plugins, '#load_from' do
it "loads gems with a specific pattern" do
plugins = TTY::Plugins.new
gemspec_path = fixtures_path('foo-0.0.1.gemspec')
plugins.load_from(gemspec_path, /^tty-(.*)/)
expect(plugins.to_a.map(&:name)).to eq([
'tty-command'... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/unit/plugins/activate_spec.rb | spec/unit/plugins/activate_spec.rb | # frozen_string_literal: true
RSpec.describe TTY::Plugins, '#activate' do
it "activates all plugins" do
plugin = double(:plugin, :enabled? => false, :load! => true)
plugins = TTY::Plugins.new
allow(plugins).to receive(:plugins).and_return([plugin, plugin])
plugins.activate
expect(plugin).to hav... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/unit/plugins/plugin/load_spec.rb | spec/unit/plugins/plugin/load_spec.rb | # frozen_string_literal: true
RSpec.describe TTY::Plugin, '#load!' do
let(:gem) { Gem::Specification.new('tty-console', '3.1.3')}
it "loads a gem" do
plugin = TTY::Plugin.new('tty-console', gem)
allow(plugin).to receive(:require).with('tty-console').and_return(true)
plugin.load!
expect(plugin... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/spec/unit/plugins/plugin/new_spec.rb | spec/unit/plugins/plugin/new_spec.rb | # frozen_string_literal: true
RSpec.describe TTY::Plugin, '#new' do
let(:gem) { Gem::Specification.new('tty-console', '3.1.3')}
subject(:plugin) { described_class.new('tty-console', gem) }
it { expect(plugin.name).to eq('tty-console') }
it { expect(plugin.gem).to eq(gem) }
it { expect(plugin.enabled?).t... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/lib/tty.rb | lib/tty.rb | # frozen_string_literal: true
require_relative "tty/cli"
require_relative "tty/plugins"
require_relative "tty/version"
module TTY
GEMSPEC_PATH = ::File.expand_path("#{::File.dirname(__FILE__)}/../tty.gemspec")
class << self
def included(base)
base.send :extend, ClassMethods
end
end
module Clas... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/lib/tty/plugins.rb | lib/tty/plugins.rb | # frozen_string_literal: true
require_relative "plugins/plugin"
module TTY
# A class responsible for managing plugins installation
class Plugins
include Enumerable
attr_reader :plugins
# Initialize the Plugins
#
# @api public
def initialize
@plugins = []
end
# Iterate over... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/lib/tty/gemspec_dependency.rb | lib/tty/gemspec_dependency.rb | # frozen_string_literal: true
module TTY
class GemspecDependency
attr_reader :name, :version, :comment
def self.optional(name, version, comment)
new(name, version, comment: comment, optional: true)
end
def initialize(name, version, comment: nil, optional: false)
@name = name
@vers... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/lib/tty/version.rb | lib/tty/version.rb | # frozen_string_literal: true
module TTY
VERSION = "0.10.0"
end # TTY
| ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/lib/tty/cmd.rb | lib/tty/cmd.rb | # frozen_string_literal: true
require "forwardable"
require_relative "path_helpers"
module TTY
class Cmd
extend Forwardable
include PathHelpers
def_delegators :command, :run
def_delegators "Thor::Util", :snake_case
# Execute this command
#
# @api public
def execute(*)
raise... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/lib/tty/path_helpers.rb | lib/tty/path_helpers.rb | # frozen_string_literal: true
require "pathname"
module TTY
module PathHelpers
# The root path of the app running this command
#
# @return [Pathname]
#
# @api public
def root_path
@root_path ||= Pathname.pwd
end
# Execute command within root path
#
# @api public
de... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/lib/tty/templater.rb | lib/tty/templater.rb | # frozen_string_literal: true
require "tty-file"
require_relative "path_helpers"
module TTY
class Templater
include PathHelpers
attr_reader :templates
def initialize(source_path, target_path)
@source_path = templates_root_path.join(source_path)
@target_path = target_path
@templates ... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/lib/tty/licenses.rb | lib/tty/licenses.rb | # frozen_string_literal: true
module TTY
module Licenses
CUSTOM = "custom"
LICENSES = {
"agplv3" => { name: "AGPL-3.0",
desc: "GNU Affero General Public License v3.0" },
"apache" => { name: "Apache-2.0", desc: "Apache License 2.0" },
"bsd2" => { name: "BSD-2-Clause",
... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
piotrmurach/tty | https://github.com/piotrmurach/tty/blob/93ab5fe253272f5f7a8d7609cdd3da3c04250b61/lib/tty/cli.rb | lib/tty/cli.rb | # frozen_string_literal: true
require "thor"
require_relative "licenses"
module TTY
# Main CLI runner
# @api public
class CLI < Thor
extend TTY::Licenses
# Error raised by this runner
Error = Class.new(StandardError)
no_commands do
def self.logo(banner)
<<-EOS
┏━━━┓
┏━┳╋┳┳━... | ruby | MIT | 93ab5fe253272f5f7a8d7609cdd3da3c04250b61 | 2026-01-04T15:54:37.800381Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.