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/test/cask/cask_loader/from_uri_loader_spec.rb | Library/Homebrew/test/cask/cask_loader/from_uri_loader_spec.rb | describe Cask::CaskLoader::FromURILoader do
alias_matcher :be_able_to_load, :be_can_load
describe "::can_load?" do
it "returns true when given an URI" do
expect(described_class).to be_able_to_load(URI("https://brew.sh/"))
end
it "returns true when given a String which can be parsed to a URI" do
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/utils/analytics_spec.rb | Library/Homebrew/test/utils/analytics_spec.rb | require "utils/analytics"
require "formula_installer"
describe Utils::Analytics do
describe "::os_prefix_ci" do
context "when os_prefix_ci is not set" do
before do
described_class.clear_os_prefix_ci
end
it "returns OS_VERSION and prefix when HOMEBREW_PREFIX is a custom prefix" do
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/utils/git_spec.rb | Library/Homebrew/test/utils/git_spec.rb | require "utils/git"
describe Git do
before do
git = HOMEBREW_SHIMS_PATH/"scm/git"
HOMEBREW_CACHE.cd do
system git, "init"
File.open(file, "w") { |f| f.write("blah") }
system git, "add", HOMEBREW_CACHE/file
system git, "commit", "-m", "'File added'"
@h1 = `git rev-parse HEAD`
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/utils/curl_spec.rb | Library/Homebrew/test/utils/curl_spec.rb | require "utils/curl"
describe "curl" do
describe "curl_args" do
it "returns -q as the first argument when HOMEBREW_CURLRC is not set" do
# -q must be the first argument according to "man curl"
expect(curl_args("foo").first).to eq("-q")
end
it "doesn't return -q as the first argument when HOM... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/utils/svn_spec.rb | Library/Homebrew/test/utils/svn_spec.rb | require "utils/svn"
describe Utils do
describe "#self.svn_available?" do
before do
described_class.clear_svn_version_cache
end
it "returns svn version if svn available" do
if File.executable? "/usr/bin/svn"
expect(described_class).to be_svn_available
else
expect(describ... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/utils/github_spec.rb | Library/Homebrew/test/utils/github_spec.rb | require "utils/github"
describe GitHub do
describe "::search_code", :needs_network do
it "queries GitHub code with the passed parameters" do
results = subject.search_code(repo: "Homebrew/brew", path: "/",
filename: "readme", language: "markdown")
expect(results.co... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/utils/fork_spec.rb | Library/Homebrew/test/utils/fork_spec.rb | require "utils/fork"
describe Utils do
describe "#safe_fork" do
it "raises a RuntimeError on an error that isn't ErrorDuringExecution" do
expect {
described_class.safe_fork do
raise "this is an exception in the child"
end
}.to raise_error(RuntimeError)
end
it "raise... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/utils/shell_spec.rb | Library/Homebrew/test/utils/shell_spec.rb | require "utils/shell"
describe Utils::Shell do
describe "::profile" do
it "returns ~/.bash_profile by default" do
ENV["SHELL"] = "/bin/another_shell"
expect(subject.profile).to eq("~/.bash_profile")
end
it "returns ~/.bash_profile for sh" do
ENV["SHELL"] = "/bin/sh"
expect(subjec... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/utils/tty_spec.rb | Library/Homebrew/test/utils/tty_spec.rb | describe Tty do
describe "::strip_ansi" do
it "removes ANSI escape codes from a string" do
expect(subject.strip_ansi("\033\[36;7mhello\033\[0m")).to eq("hello")
end
end
describe "::width" do
it "returns an Integer" do
expect(subject.width).to be_kind_of(Integer)
end
it "cannot be... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/utils/popen_spec.rb | Library/Homebrew/test/utils/popen_spec.rb | require "utils/popen"
describe Utils do
describe "::popen_read" do
it "reads the standard output of a given command" do
expect(subject.popen_read("sh", "-c", "echo success").chomp).to eq("success")
expect($CHILD_STATUS).to be_a_success
end
it "can be given a block to manually read from the p... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/utils/user_spec.rb | Library/Homebrew/test/utils/user_spec.rb | require "utils/user"
describe User do
subject { described_class.current }
it { is_expected.to eq ENV["USER"] }
describe "#gui?" do
before do
allow(SystemCommand).to receive(:run).with("who")
.and_return([who_output, "", instance_double(Process::Status, success?: true)])
end
context "... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/utils/bottles/bintray_spec.rb | Library/Homebrew/test/utils/bottles/bintray_spec.rb | require "utils/bottles"
describe Utils::Bottles::Bintray do
describe "::package" do
it "converts a Formula name to a package name" do
expect(described_class.package("openssl@1.1")).to eq("openssl:1.1")
expect(described_class.package("gtk+")).to eq("gtkx")
expect(described_class.package("llvm"))... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/utils/bottles/collector_spec.rb | Library/Homebrew/test/utils/bottles/collector_spec.rb | require "utils/bottles"
describe Utils::Bottles::Collector do
describe "#fetch_checksum_for" do
it "returns passed tags" do
subject[:lion] = "foo"
subject[:mountain_lion] = "bar"
expect(subject.fetch_checksum_for(:mountain_lion)).to eq(["bar", :mountain_lion])
end
it "returns nil if em... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/utils/bottles/bottles_spec.rb | Library/Homebrew/test/utils/bottles/bottles_spec.rb | require "utils/bottles"
describe Utils::Bottles do
describe "#tag", :needs_macos do
it "returns :leopard_64 on Leopard Intel 64-bit" do
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.5"))
allow(Hardware::CPU).to receive(:type).and_return(:intel)
expect(described_class.tag).... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/requirements/osxfuse_requirement_spec.rb | Library/Homebrew/test/requirements/osxfuse_requirement_spec.rb | require "requirements/osxfuse_requirement"
describe OsxfuseRequirement do
subject(:requirement) { described_class.new([]) }
describe "::binary_osxfuse_installed?", :needs_macos do
alias_matcher :have_binary_osxfuse_installed, :be_binary_osxfuse_installed
it "returns false if fuse.h does not exist" do
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/requirements/codesign_requirement_spec.rb | Library/Homebrew/test/requirements/codesign_requirement_spec.rb | require "requirements/codesign_requirement"
describe CodesignRequirement do
subject(:requirement) {
described_class.new([{ identity: identity, with: with, url: url }])
}
let(:identity) { "lldb_codesign" }
let(:with) { "LLDB" }
let(:url) {
"https://llvm.org/svn/llvm-project/lldb/trunk/docs/code-signi... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/requirements/linux_requirement_spec.rb | Library/Homebrew/test/requirements/linux_requirement_spec.rb | require "requirements/linux_requirement"
describe LinuxRequirement do
subject(:requirement) { described_class.new }
describe "#satisfied?" do
it "returns true on Linux" do
expect(requirement.satisfied?).to eq(OS.linux?)
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/test/requirements/java_requirement_spec.rb | Library/Homebrew/test/requirements/java_requirement_spec.rb | require "requirements/java_requirement"
describe JavaRequirement do
describe "initialize" do
it "parses '1.8' tag correctly" do
req = described_class.new(["1.8"])
expect(req.display_s).to eq("java = 1.8")
end
it "parses '9' tag correctly" do
req = described_class.new(["9"])
expec... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/requirements/macos_requirement_spec.rb | Library/Homebrew/test/requirements/macos_requirement_spec.rb | require "requirements/macos_requirement"
describe MacOSRequirement do
subject(:requirement) { described_class.new }
describe "#satisfied?" do
it "returns true on macOS" do
expect(requirement.satisfied?).to eq(OS.mac?)
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/test/rubocops/components_order_spec.rb | Library/Homebrew/test/rubocops/components_order_spec.rb | require "rubocops/components_order"
describe RuboCop::Cop::FormulaAudit::ComponentsOrder do
subject(:cop) { described_class.new }
context "When auditing formula components order" do
it "When url precedes homepage" do
expect_offense(<<~RUBY)
class Foo < Formula
url "https://brew.sh/foo-... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/patches_spec.rb | Library/Homebrew/test/rubocops/patches_spec.rb | require "rubocops/patches"
describe RuboCop::Cop::FormulaAudit::Patches do
subject(:cop) { described_class.new }
context "When auditing legacy patches" do
it "When there is no legacy patch" do
expect_no_offenses(<<~RUBY)
class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz'
end... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/urls_spec.rb | Library/Homebrew/test/rubocops/urls_spec.rb | require "rubocops/urls"
describe RuboCop::Cop::FormulaAudit::Urls do
subject(:cop) { described_class.new }
context "When auditing urls" do
it "with offenses" do
formulas = [{
"url" => "https://ftpmirror.gnu.org/lightning/lightning-2.1.0.tar.gz",
"msg" => 'Please use "https://ftp.gnu.org/... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/text_spec.rb | Library/Homebrew/test/rubocops/text_spec.rb | require "rubocops/text"
describe RuboCop::Cop::FormulaAudit::Text do
subject(:cop) { described_class.new }
context "When auditing formula text" do
it "with both openssl and libressl optional dependencies" do
expect_offense(<<~RUBY)
class Foo < Formula
url "https://brew.sh/foo-1.0.tgz"
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/caveats_spec.rb | Library/Homebrew/test/rubocops/caveats_spec.rb | require "rubocops/caveats"
describe RuboCop::Cop::FormulaAudit::Caveats do
subject(:cop) { described_class.new }
context "When auditing caveats" do
it "When there is setuid mentioned in caveats" do
expect_offense(<<~RUBY)
class Foo < Formula
homepage "https://brew.sh/foo"
url... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/class_spec.rb | Library/Homebrew/test/rubocops/class_spec.rb | require "rubocops/class"
describe RuboCop::Cop::FormulaAudit::ClassName do
subject(:cop) { described_class.new }
it "reports an offense when using ScriptFileFormula" do
expect_offense(<<~RUBY)
class Foo < ScriptFileFormula
^^^^^^^^^^^^^^^^^ ScriptFileFormula is deprecated, use Formula ... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/formula_desc_spec.rb | Library/Homebrew/test/rubocops/formula_desc_spec.rb | require "rubocops/formula_desc"
describe RuboCop::Cop::FormulaAudit::DescLength do
subject(:cop) { described_class.new }
context "When auditing formula desc" do
it "When there is no desc" do
expect_offense(<<~RUBY)
class Foo < Formula
^^^^^^^^^^^^^^^^^^^ Formula should have a desc (Descr... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/components_redundancy_spec.rb | Library/Homebrew/test/rubocops/components_redundancy_spec.rb | require "rubocops/components_redundancy"
describe RuboCop::Cop::FormulaAudit::ComponentsRedundancy do
subject(:cop) { described_class.new }
context "When auditing formula components common errors" do
it "When url outside stable block" do
expect_offense(<<~RUBY)
class Foo < Formula
url ... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/checksum_spec.rb | Library/Homebrew/test/rubocops/checksum_spec.rb | require "rubocops/checksum"
describe RuboCop::Cop::FormulaAudit::Checksum do
subject(:cop) { described_class.new }
context "When auditing spec checksums" do
it "When the checksum is empty" do
expect_offense(<<~RUBY)
class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz'
stable... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/lines_spec.rb | Library/Homebrew/test/rubocops/lines_spec.rb | require "rubocops/lines"
describe RuboCop::Cop::FormulaAudit::Lines do
subject(:cop) { described_class.new }
it "reports an offense when using depends_on :automake" do
expect_offense(<<~RUBY)
class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz'
depends_on :automake
^^^^^^^^^^^^^... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/dependency_order_spec.rb | Library/Homebrew/test/rubocops/dependency_order_spec.rb | require "rubocops/dependency_order"
describe RuboCop::Cop::FormulaAudit::DependencyOrder do
subject(:cop) { described_class.new }
context "depends_on" do
it "wrong conditional depends_on order" do
expect_offense(<<~RUBY)
class Foo < Formula
homepage "https://brew.sh"
url "htt... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/conflicts_spec.rb | Library/Homebrew/test/rubocops/conflicts_spec.rb | require "rubocops/conflicts"
describe RuboCop::Cop::FormulaAudit::Conflicts do
subject(:cop) { described_class.new }
context "When auditing formula for conflicts with" do
it "multiple conflicts_with" do
expect_offense(<<~RUBY, "/homebrew-core/Formula/foo@2.0.rb")
class FooAT20 < Formula
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/homepage_spec.rb | Library/Homebrew/test/rubocops/homepage_spec.rb | require "rubocops/homepage"
describe RuboCop::Cop::FormulaAudit::Homepage do
subject(:cop) { described_class.new }
context "When auditing homepage" do
it "When there is no homepage" do
source = <<~RUBY
class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz'
end
RUBY
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/options_spec.rb | Library/Homebrew/test/rubocops/options_spec.rb | require "rubocops/options"
describe RuboCop::Cop::FormulaAudit::Options do
subject(:cop) { described_class.new }
context "When auditing options" do
it "reports an offense when using the 32-bit option" do
expect_offense(<<~RUBY)
class Foo < Formula
url 'https://brew.sh/foo-1.0.tgz'
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/cask/no_dsl_version_spec.rb | Library/Homebrew/test/rubocops/cask/no_dsl_version_spec.rb | require "rubocops/rubocop-cask"
require "test/rubocops/cask/shared_examples/cask_cop"
describe RuboCop::Cop::Cask::NoDslVersion do
include CaskCop
subject(:cop) { described_class.new }
context "with header method `cask`" do
let(:header_method) { "cask" }
context "with no dsl version" do
let(:sou... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/cask/stanza_order_spec.rb | Library/Homebrew/test/rubocops/cask/stanza_order_spec.rb | require "rubocops/rubocop-cask"
require "test/rubocops/cask/shared_examples/cask_cop"
describe RuboCop::Cop::Cask::StanzaOrder do
include CaskCop
subject(:cop) { described_class.new }
context "when there is only one stanza" do
let(:source) do
<<-CASK.undent
cask 'foo' do
version :la... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/cask/homepage_matches_url_spec.rb | Library/Homebrew/test/rubocops/cask/homepage_matches_url_spec.rb | require "rubocops/rubocop-cask"
require "test/rubocops/cask/shared_examples/cask_cop"
describe RuboCop::Cop::Cask::HomepageMatchesUrl do
include CaskCop
subject(:cop) { described_class.new }
context "when the url matches the homepage and there is no comment" do
let(:source) do
<<-CASK.undent
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb | Library/Homebrew/test/rubocops/cask/stanza_grouping_spec.rb | require "rubocops/rubocop-cask"
require "test/rubocops/cask/shared_examples/cask_cop"
describe RuboCop::Cop::Cask::StanzaGrouping do
include CaskCop
subject(:cop) { described_class.new }
let(:missing_line_msg) do
"stanza groups should be separated by a single empty line"
end
let(:extra_line_msg) do
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/cask/homepage_url_trailing_slash_spec.rb | Library/Homebrew/test/rubocops/cask/homepage_url_trailing_slash_spec.rb | require "rubocops/rubocop-cask"
require "test/rubocops/cask/shared_examples/cask_cop"
describe RuboCop::Cop::Cask::HomepageUrlTrailingSlash do
include CaskCop
subject(:cop) { described_class.new }
context "when the homepage url ends with a slash" do
let(:source) do
<<-CASK.undent
cask 'foo' d... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/rubocops/cask/shared_examples/cask_cop.rb | Library/Homebrew/test/rubocops/cask/shared_examples/cask_cop.rb | module CaskCop
shared_examples "does not report any offenses" do
it "does not report any offenses" do
expect_no_offenses(source)
end
end
shared_examples "reports offenses" do
it "reports offenses" do
expect_reported_offenses(source, expected_offenses)
end
end
shared_examples "aut... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/os/mac_spec.rb | Library/Homebrew/test/os/mac_spec.rb | require "locale"
require "os/mac"
describe OS::Mac do
describe "::languages" do
specify "all languages can be parsed by Locale::parse" do
subject.languages.each do |language|
expect { Locale.parse(language) }.not_to raise_error
end
end
end
describe "::language" do
it "returns the... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/os/mac/version_spec.rb | Library/Homebrew/test/os/mac/version_spec.rb | require "version"
require "os/mac/version"
describe OS::Mac::Version do
subject { described_class.new("10.7") }
specify "comparison with Symbol" do
expect(subject).to be > :snow_leopard
expect(subject).to be == :lion
expect(subject).to be === :lion # rubocop:disable Style/CaseEquality
expect(subje... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/os/mac/hardware_spec.rb | Library/Homebrew/test/os/mac/hardware_spec.rb | require "hardware"
require "extend/os/mac/hardware/cpu"
describe Hardware::CPU do
describe "::can_run?" do
it "reports that Intel Macs can run Intel executables" do
allow(described_class).to receive(:type).and_return :intel
allow(described_class).to receive(:bits).and_return 64
expect(described... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/os/mac/dependency_collector_spec.rb | Library/Homebrew/test/os/mac/dependency_collector_spec.rb | require "dependency_collector"
describe DependencyCollector do
alias_matcher :need_tar_xz_dependency, :be_tar_needs_xz_dependency
after do
described_class.clear_cache
end
specify "#tar_needs_xz_dependency?" do
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.9"))
expect(describ... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/os/mac/keg_spec.rb | Library/Homebrew/test/os/mac/keg_spec.rb | require "keg"
describe Keg do
include FileUtils
subject { described_class.new(keg_path) }
describe "#mach_o_files" do
let(:keg_path) { HOMEBREW_CELLAR/"a/1.0" }
before { (keg_path/"lib").mkpath }
after { subject.unlink }
it "skips hardlinks" do
cp dylib_path("i386"), keg_path/"lib/i386... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/os/mac/diagnostic_spec.rb | Library/Homebrew/test/os/mac/diagnostic_spec.rb | require "diagnostic"
describe Homebrew::Diagnostic::Checks do
specify "#check_for_unsupported_macos" do
ENV.delete("HOMEBREW_DEVELOPER")
allow(OS::Mac).to receive(:prerelease?).and_return(true)
expect(subject.check_for_unsupported_macos)
.to match("We do not provide support for this pre-release ve... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/os/mac/java_requirement_spec.rb | Library/Homebrew/test/os/mac/java_requirement_spec.rb | require "requirements/java_requirement"
require "fileutils"
describe JavaRequirement do
subject { described_class.new(%w[1.8]) }
let(:java_home) { mktmpdir }
before do
FileUtils.mkdir java_home/"bin"
FileUtils.touch java_home/"bin/java"
allow(subject).to receive(:preferred_java).and_return(java_hom... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/os/mac/mach_spec.rb | Library/Homebrew/test/os/mac/mach_spec.rb | describe "Mach-O Pathname tests" do
specify "fat dylib" do
pn = dylib_path("fat")
expect(pn).to be_universal
expect(pn).not_to be_i386
expect(pn).not_to be_x86_64
expect(pn).not_to be_ppc7400
expect(pn).not_to be_ppc64
expect(pn).to be_dylib
expect(pn).not_to be_mach_o_executable
e... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/os/linux/dependency_collector_spec.rb | Library/Homebrew/test/os/linux/dependency_collector_spec.rb | require "dependency_collector"
describe DependencyCollector do
alias_matcher :be_a_build_requirement, :be_build
after do
described_class.clear_cache
end
describe "#add" do
resource = Resource.new
context "when xz, unzip, and bzip2 are not available" do
it "creates a resource dependency fro... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/os/linux/diagnostic_spec.rb | Library/Homebrew/test/os/linux/diagnostic_spec.rb | require "diagnostic"
describe Homebrew::Diagnostic::Checks do
specify "#check_glibc_minimum_version" do
allow(OS::Linux::Glibc).to receive(:below_minimum_version?).and_return(true)
expect(subject.check_glibc_minimum_version)
.to match(/Your system glibc .+ is too old/)
end
specify "#check_kernel_... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/lha_spec.rb | Library/Homebrew/test/unpack_strategy/lha_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Lha do
let(:path) { TEST_FIXTURE_DIR/"test.lha" }
include_examples "UnpackStrategy::detect"
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/uncompressed_spec.rb | Library/Homebrew/test/unpack_strategy/uncompressed_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Uncompressed do
let(:path) {
(mktmpdir/"test").tap do |path|
FileUtils.touch path
end
}
include_examples "UnpackStrategy::detect"
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/subversion_spec.rb | Library/Homebrew/test/unpack_strategy/subversion_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Subversion, :needs_svn do
let(:repo) { mktmpdir }
let(:working_copy) { mktmpdir }
let(:path) { working_copy }
before do
system "svnadmin", "create", repo
system "svn", "checkout", "file://#{repo}", working_copy
FileUtils.touch working_c... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/lzip_spec.rb | Library/Homebrew/test/unpack_strategy/lzip_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Lzip do
let(:path) { TEST_FIXTURE_DIR/"test.lz" }
include_examples "UnpackStrategy::detect"
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/cvs_spec.rb | Library/Homebrew/test/unpack_strategy/cvs_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Cvs do
let(:repo) {
mktmpdir.tap do |repo|
FileUtils.touch repo/"test"
(repo/"CVS").mkpath
end
}
let(:path) { repo }
include_examples "UnpackStrategy::detect"
include_examples "#extract", children: ["CVS", "test"]
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/directory_spec.rb | Library/Homebrew/test/unpack_strategy/directory_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Directory do
subject(:strategy) { described_class.new(path) }
let(:path) {
mktmpdir.tap do |path|
FileUtils.touch path/"file"
FileUtils.ln_s "file", path/"symlink"
end
}
let(:unpack_dir) { mktmpdir }
it "does not follow symlin... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/dmg_spec.rb | Library/Homebrew/test/unpack_strategy/dmg_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Dmg, :needs_macos do
describe "#mount" do
let(:path) { TEST_FIXTURE_DIR/"cask/container.dmg" }
include_examples "UnpackStrategy::detect"
include_examples "#extract", children: ["container"]
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/test/unpack_strategy/git_spec.rb | Library/Homebrew/test/unpack_strategy/git_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Git do
let(:repo) {
mktmpdir.tap do |repo|
system "git", "-C", repo, "init"
FileUtils.touch repo/"test"
system "git", "-C", repo, "add", "test"
system "git", "-C", repo, "commit", "-m", "Add `test` file."
end
}
let(:path... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/p7zip_spec.rb | Library/Homebrew/test/unpack_strategy/p7zip_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::P7Zip do
let(:path) { TEST_FIXTURE_DIR/"cask/container.7z" }
include_examples "UnpackStrategy::detect"
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/xz_spec.rb | Library/Homebrew/test/unpack_strategy/xz_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Xz do
let(:path) { TEST_FIXTURE_DIR/"cask/container.xz" }
include_examples "UnpackStrategy::detect"
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/shared_examples.rb | Library/Homebrew/test/unpack_strategy/shared_examples.rb | require "unpack_strategy"
shared_examples "UnpackStrategy::detect" do
it "is correctly detected" do
expect(UnpackStrategy.detect(path)).to be_a described_class
end
end
shared_examples "#extract" do |children: []|
specify "#extract" do
mktmpdir do |unpack_dir|
described_class.new(path).extract(to: ... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/rar_spec.rb | Library/Homebrew/test/unpack_strategy/rar_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Rar do
let(:path) { TEST_FIXTURE_DIR/"cask/container.rar" }
include_examples "UnpackStrategy::detect"
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/zip_spec.rb | Library/Homebrew/test/unpack_strategy/zip_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Zip do
let(:path) { TEST_FIXTURE_DIR/"cask/MyFancyApp.zip" }
include_examples "UnpackStrategy::detect"
context "when unzip is available", :needs_unzip do
include_examples "#extract", children: ["MyFancyApp"]
end
context "when ZIP archive is c... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/bzip2_spec.rb | Library/Homebrew/test/unpack_strategy/bzip2_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Bzip2 do
let(:path) { TEST_FIXTURE_DIR/"cask/container.bz2" }
include_examples "UnpackStrategy::detect"
include_examples "#extract", children: ["container"]
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/bazaar_spec.rb | Library/Homebrew/test/unpack_strategy/bazaar_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Bazaar do
let(:repo) {
mktmpdir.tap do |repo|
FileUtils.touch repo/"test"
(repo/".bzr").mkpath
end
}
let(:path) { repo }
include_examples "UnpackStrategy::detect"
include_examples "#extract", children: ["test"]
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/tar_spec.rb | Library/Homebrew/test/unpack_strategy/tar_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Tar do
let(:path) { TEST_FIXTURE_DIR/"cask/container.tar.gz" }
include_examples "UnpackStrategy::detect"
include_examples "#extract", children: ["container"]
context "when TAR archive is corrupted" do
let(:path) {
(mktmpdir/"test.tar").tap... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/gzip_spec.rb | Library/Homebrew/test/unpack_strategy/gzip_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Gzip do
let(:path) { TEST_FIXTURE_DIR/"cask/container.gz" }
include_examples "UnpackStrategy::detect"
include_examples "#extract", children: ["container"]
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/jar_spec.rb | Library/Homebrew/test/unpack_strategy/jar_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Jar, :needs_unzip do
let(:path) { TEST_FIXTURE_DIR/"test.jar" }
include_examples "UnpackStrategy::detect"
include_examples "#extract", children: ["test.jar"]
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/xar_spec.rb | Library/Homebrew/test/unpack_strategy/xar_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Xar, :needs_macos do
let(:path) { TEST_FIXTURE_DIR/"cask/container.xar" }
include_examples "UnpackStrategy::detect"
include_examples "#extract", children: ["container"]
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/unpack_strategy/mercurial_spec.rb | Library/Homebrew/test/unpack_strategy/mercurial_spec.rb | require_relative "shared_examples"
describe UnpackStrategy::Mercurial do
let(:repo) {
mktmpdir.tap do |repo|
(repo/".hg").mkpath
end
}
let(:path) { repo }
include_examples "UnpackStrategy::detect"
end
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/language/go_spec.rb | Library/Homebrew/test/language/go_spec.rb | require "language/go"
describe Language::Go do
specify "#stage_deps" do
ENV.delete("HOMEBREW_DEVELOPER")
expect(described_class).to receive(:opoo).once
mktmpdir do |path|
described_class.stage_deps [], path
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/test/language/java_spec.rb | Library/Homebrew/test/language/java_spec.rb | require "language/java"
describe Language::Java do
describe "::java_home" do
it "returns valid JAVA_HOME if version is specified", :needs_java do
java_home = described_class.java_home("1.8+")
expect(java_home/"bin/java").to be_an_executable
end
it "returns valid JAVA_HOME if version is not s... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/language/python_spec.rb | Library/Homebrew/test/language/python_spec.rb | require "language/python"
require "resource"
describe Language::Python, :needs_python do
describe "#major_minor_version" do
it "returns a Version for Python 2" do
expect(subject).to receive(:major_minor_version).and_return(Version)
subject.major_minor_version("python")
end
end
describe "#sit... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/test/language/node_spec.rb | Library/Homebrew/test/language/node_spec.rb | require "language/node"
describe Language::Node do
describe "#setup_npm_environment" do
it "calls prepend_path when node formula exists only during the first call" do
node = formula "node" do
url "node-test"
end
stub_formula_loader(node)
expect(ENV).to receive(: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/utils/curl.rb | Library/Homebrew/utils/curl.rb | require "open3"
def curl_executable
@curl ||= [
ENV["HOMEBREW_CURL"],
which("curl"),
"/usr/bin/curl",
].compact.map { |c| Pathname(c) }.find(&:executable?)
raise "no executable curl was found" unless @curl
@curl
end
def curl_args(*extra_args, show_output: false, user_agent: :default)
args = []
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/utils/bottles.rb | Library/Homebrew/utils/bottles.rb | require "tab"
require "extend/ARGV"
module Utils
class Bottles
class << self
def tag
@tag ||= "#{ENV["HOMEBREW_PROCESSOR"]}_#{ENV["HOMEBREW_SYSTEM"]}".downcase.to_sym
end
def built_as?(f)
return false unless f.installed?
tab = Tab.for_keg(f.installed_prefix)
ta... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/utils/tty.rb | Library/Homebrew/utils/tty.rb | module Tty
module_function
def strip_ansi(string)
string.gsub(/\033\[\d+(;\d+)*m/, "")
end
def width
@width ||= begin
_, width = `/bin/stty size 2>/dev/null`.split
width, = `/usr/bin/tput cols 2>/dev/null`.split if width.to_i.zero?
width ||= 80
width.to_i
end
end
def t... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/utils/github.rb | Library/Homebrew/utils/github.rb | require "uri"
require "tempfile"
module GitHub
module_function
API_URL = "https://api.github.com".freeze
CREATE_GIST_SCOPES = ["gist"].freeze
CREATE_ISSUE_FORK_OR_PR_SCOPES = ["public_repo"].freeze
ALL_SCOPES = (CREATE_GIST_SCOPES + CREATE_ISSUE_FORK_OR_PR_SCOPES).freeze
ALL_SCOPES_URL = Formatter.url(
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/utils/popen.rb | Library/Homebrew/utils/popen.rb | module Utils
def self.popen_read(*args, **options, &block)
popen(args, "rb", options, &block)
end
def self.safe_popen_read(*args, **options, &block)
output = popen_read(*args, **options, &block)
return output if $CHILD_STATUS.success?
raise ErrorDuringExecution.new(args, status: $CHILD_STATUS, o... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/utils/link.rb | Library/Homebrew/utils/link.rb | module Utils
module Link
module_function
def link_src_dst_dirs(src_dir, dst_dir, command, link_dir: false)
return unless src_dir.exist?
conflicts = []
src_paths = link_dir ? [src_dir] : src_dir.find
src_paths.each do |src|
next if src.directory? && !link_dir
dst = ds... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/utils/svn.rb | Library/Homebrew/utils/svn.rb | module Utils
def self.clear_svn_version_cache
remove_instance_variable(:@svn) if instance_variable_defined?(:@svn)
end
def self.svn_available?
return @svn if instance_variable_defined?(:@svn)
@svn = quiet_system HOMEBREW_SHIMS_PATH/"scm/svn", "--version"
end
def self.svn_remote_exists?(url)
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/utils/shell.rb | Library/Homebrew/utils/shell.rb | module Utils
module Shell
module_function
# take a path and heuristically convert it
# to a shell name, return nil if there's no match
def from_path(path)
# we only care about the basename
shell_name = File.basename(path)
# handle possible version suffix like `zsh-5.2`
shell_n... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/utils/formatter.rb | Library/Homebrew/utils/formatter.rb | require "utils/tty"
module Formatter
module_function
def arrow(string, color: nil)
prefix("==>", string, color)
end
def headline(string, color: nil)
arrow("#{Tty.bold}#{string}#{Tty.reset}", color: color)
end
def identifier(string)
"#{Tty.green}#{string}#{Tty.default}"
end
def option(st... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/utils/analytics.rb | Library/Homebrew/utils/analytics.rb | require "erb"
module Utils
module Analytics
class << self
def custom_prefix_label
"custom-prefix".freeze
end
def clear_os_prefix_ci
return unless instance_variable_defined?(:@os_prefix_ci)
remove_instance_variable(:@os_prefix_ci)
end
def os_prefix_ci
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/utils/fork.rb | Library/Homebrew/utils/fork.rb | require "fcntl"
require "socket"
module Utils
def self.rewrite_child_error(child_error)
error = if child_error.inner_class == ErrorDuringExecution
ErrorDuringExecution.new(child_error.inner["cmd"],
status: child_error.inner["status"],
output: ch... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/utils/inreplace.rb | Library/Homebrew/utils/inreplace.rb | module Utils
class InreplaceError < RuntimeError
def initialize(errors)
formatted_errors = errors.reduce("inreplace failed\n") do |s, (path, errs)|
s << "#{path}:\n" << errs.map { |e| " #{e}\n" }.join
end
super formatted_errors
end
end
module Inreplace
# Sometimes we have t... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/utils/git.rb | Library/Homebrew/utils/git.rb | require "open3"
module Git
module_function
def last_revision_commit_of_file(repo, file, before_commit: nil)
args = [before_commit.nil? ? "--skip=1" : before_commit.split("..").first]
out, = Open3.capture3(
HOMEBREW_SHIMS_PATH/"scm/git", "-C", repo,
"log", "--format=%h", "--abbrev=7", "--max-c... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/utils/user.rb | Library/Homebrew/utils/user.rb | require "delegate"
require "etc"
require "system_command"
class User < DelegateClass(String)
def gui?
out, _, status = system_command "who"
return false unless status.success?
out.lines
.map(&:split)
.any? { |user, type,| user == self && type == "console" }
end
def self.current
@c... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/requirements/macos_requirement.rb | Library/Homebrew/requirements/macos_requirement.rb | require "requirement"
class MacOSRequirement < Requirement
fatal true
def initialize(tags = [])
@version = MacOS::Version.from_symbol(tags.shift) unless tags.empty?
super(tags)
end
def minimum_version_specified?
OS.mac? && @version
end
satisfy(build_env: false) do
next MacOS.version >= @... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/requirements/xcode_requirement.rb | Library/Homebrew/requirements/xcode_requirement.rb | require "requirement"
class XcodeRequirement < Requirement
fatal true
satisfy(build_env: false) { xcode_installed_version }
def initialize(tags = [])
@version = tags.shift if tags.first.to_s.match?(/(\d\.)+\d/)
super(tags)
end
def xcode_installed_version
return false unless MacOS::Xcode.instal... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/requirements/x11_requirement.rb | Library/Homebrew/requirements/x11_requirement.rb | require "requirement"
class X11Requirement < Requirement
include Comparable
fatal true
cask "xquartz"
download "https://xquartz.macosforge.org"
env { ENV.x11 }
def min_version
"1.12.2"
end
def min_xdpyinfo_version
"1.3.0"
end
satisfy build_env: false do
if which_xorg = which("Xorg... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/requirements/java_requirement.rb | Library/Homebrew/requirements/java_requirement.rb | require "language/java"
class JavaRequirement < Requirement
attr_reader :java_home
fatal true
download "https://www.oracle.com/technetwork/java/javase/downloads/index.html"
# A strict Java 8 requirement (1.8) should prompt the user to install
# the legacy java8 cask because versions newer than Java 8 are n... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/requirements/codesign_requirement.rb | Library/Homebrew/requirements/codesign_requirement.rb | class CodesignRequirement < Requirement
fatal true
def initialize(tags)
options = tags.shift
unless options.is_a?(Hash)
raise ArgumentError("CodesignRequirement requires an options Hash!")
end
unless options.key?(:identity)
raise ArgumentError("CodesignRequirement requires an identity k... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/requirements/arch_requirement.rb | Library/Homebrew/requirements/arch_requirement.rb | require "requirement"
class ArchRequirement < Requirement
fatal true
def initialize(tags)
@arch = tags.shift
super(tags)
end
satisfy(build_env: false) do
case @arch
when :x86_64 then Hardware::CPU.is_64_bit?
when :intel, :ppc then Hardware::CPU.type == @arch
end
end
def message
... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/requirements/tuntap_requirement.rb | Library/Homebrew/requirements/tuntap_requirement.rb | require "requirement"
class TuntapRequirement < Requirement
fatal true
cask "tuntap"
satisfy(build_env: false) { self.class.binary_tuntap_installed? }
def self.binary_tuntap_installed?
%w[
/Library/Extensions/tun.kext
/Library/Extensions/tap.kext
/Library/LaunchDaemons/net.sf.tuntaposx.t... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/requirements/osxfuse_requirement.rb | Library/Homebrew/requirements/osxfuse_requirement.rb | require "requirement"
class OsxfuseRequirement < Requirement
cask "osxfuse"
fatal true
end
require "extend/os/requirements/osxfuse_requirement"
| ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/requirements/maximum_macos_requirement.rb | Library/Homebrew/requirements/maximum_macos_requirement.rb | require "requirement"
class MaximumMacOSRequirement < Requirement
fatal true
def initialize(tags)
@version = MacOS::Version.from_symbol(tags.shift)
super(tags)
end
satisfy(build_env: false) { MacOS.version <= @version }
def message
<<~EOS
This formula either does not compile or function ... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/requirements/linux_requirement.rb | Library/Homebrew/requirements/linux_requirement.rb | class LinuxRequirement < Requirement
fatal true
satisfy(build_env: false) { OS.linux? }
def message
"Linux is required."
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/rubocops/lines.rb | Library/Homebrew/rubocops/lines.rb | require "rubocops/extend/formula"
module RuboCop
module Cop
module FormulaAudit
# This cop checks for various miscellaneous Homebrew coding styles.
class Lines < FormulaCop
def audit_formula(_node, _class_node, _parent_class_node, _body_node)
[:automake, :ant, :autoconf, :emacs, :ex... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/rubocops/formula_desc.rb | Library/Homebrew/rubocops/formula_desc.rb | require "rubocops/extend/formula"
require "extend/string"
module RuboCop
module Cop
module FormulaAudit
# This cop audits `desc` in Formulae.
#
# - Checks for existence of `desc`
# - Checks if size of `desc` > 80
class DescLength < FormulaCop
def audit_formula(_node, _class_... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Linuxbrew/brew | https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/Library/Homebrew/rubocops/conflicts.rb | Library/Homebrew/rubocops/conflicts.rb | require "rubocops/extend/formula"
require "extend/string"
module RuboCop
module Cop
module FormulaAudit
# This cop audits versioned Formulae for `conflicts_with`.
class Conflicts < FormulaCop
MSG = "Versioned formulae should not use `conflicts_with`. " \
"Use `keg_only :versione... | ruby | BSD-2-Clause | 93389fde63974f096156344e281610acec44130c | 2026-01-04T15:53:38.399858Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.