mirror of
https://github.com/Homebrew/brew.git
synced 2026-08-12 22:29:27 +04:00
sorbet: Assign strings, not Pathnames, where a String is expected
- Ruby converts these arguments with `to_path` at runtime, and `ENV[]=` accepts anything with a `to_str`, so passing a `Pathname` or a `PATH` has always worked. - Sorbet's stdlib RBIs type them as `String`, however. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 107f40af-db01-436c-bff4-38a8c3b5ed90
This commit is contained in:
@@ -816,7 +816,7 @@ RSpec.describe Cask::Installer, :cask do
|
||||
FileUtils.cp(TEST_FIXTURE_DIR/"cask/caffeine.zip", container_dir/"NestedApp.zip")
|
||||
(container_dir/"README").write("NestedApp.zip contains the application")
|
||||
download = mktmpdir/"api-nested-cask.tar.gz"
|
||||
system "tar", "--create", "--gzip", "--file", download, "--directory", container_dir, "."
|
||||
system "tar", "--create", "--gzip", "--file", download.to_s, "--directory", container_dir.to_s, "."
|
||||
sha256 = download.sha256
|
||||
cask = Cask::Cask.new("api-nested-cask", loaded_from_api: true, loaded_from_internal_api: true) do
|
||||
version "1.2.3"
|
||||
|
||||
@@ -1183,7 +1183,7 @@ RSpec.describe Homebrew::Cmd::Info do
|
||||
pin_path = Pathname(dir/"testball")
|
||||
pin_path.write("pin")
|
||||
pin_time = Time.at(1_720_189_900)
|
||||
File.utime(pin_time, pin_time, pin_path)
|
||||
File.utime(pin_time, pin_time, pin_path.to_s)
|
||||
allow(FormulaPin).to receive(:new).with(test_formula).and_return(instance_double(FormulaPin, path: pin_path))
|
||||
|
||||
expect(described_class.metadata_lines(test_formula)).to eq([
|
||||
@@ -1203,7 +1203,7 @@ RSpec.describe Homebrew::Cmd::Info do
|
||||
pin_path = Pathname(dir/"test-cask")
|
||||
pin_path.write("pin")
|
||||
pin_time = Time.at(1_720_189_900)
|
||||
File.utime(pin_time, pin_time, pin_path)
|
||||
File.utime(pin_time, pin_time, pin_path.to_s)
|
||||
allow(cask).to receive(:pin_path).and_return(pin_path)
|
||||
|
||||
expect(described_class.metadata_lines(cask)).to eq([
|
||||
|
||||
@@ -224,7 +224,7 @@ RSpec.configure do |config|
|
||||
config.before(:each, :needs_svn) do
|
||||
skip svn_client_skip_reason if svn_client_skip_reason
|
||||
if svn_client_path_dirs
|
||||
ENV["PATH"] = PATH.new(ENV.fetch("PATH")).append(svn_client_path_dirs)
|
||||
ENV["PATH"] = PATH.new(ENV.fetch("PATH")).append(svn_client_path_dirs).to_s
|
||||
next
|
||||
end
|
||||
|
||||
@@ -251,13 +251,13 @@ RSpec.configure do |config|
|
||||
end
|
||||
|
||||
svn_client_path_dirs = [svn.dirname]
|
||||
ENV["PATH"] = PATH.new(ENV.fetch("PATH")).append(svn_client_path_dirs)
|
||||
ENV["PATH"] = PATH.new(ENV.fetch("PATH")).append(svn_client_path_dirs).to_s
|
||||
end
|
||||
|
||||
config.before(:each, :needs_svnadmin) do
|
||||
skip svn_skip_reason if svn_skip_reason
|
||||
if svn_path_dirs
|
||||
ENV["PATH"] = PATH.new(ENV.fetch("PATH")).append(svn_path_dirs)
|
||||
ENV["PATH"] = PATH.new(ENV.fetch("PATH")).append(svn_path_dirs).to_s
|
||||
next
|
||||
end
|
||||
|
||||
@@ -268,11 +268,11 @@ RSpec.configure do |config|
|
||||
end
|
||||
|
||||
svn_path_dirs = [svnadmin.dirname]
|
||||
ENV["PATH"] = PATH.new(ENV.fetch("PATH")).append(svn_path_dirs)
|
||||
ENV["PATH"] = PATH.new(ENV.fetch("PATH")).append(svn_path_dirs).to_s
|
||||
end
|
||||
|
||||
config.before(:each, :needs_homebrew_curl) do
|
||||
ENV["HOMEBREW_CURL"] = HOMEBREW_BREWED_CURL_PATH
|
||||
ENV["HOMEBREW_CURL"] = HOMEBREW_BREWED_CURL_PATH.to_s
|
||||
skip "A `curl` with TLS 1.3 support is required." unless Utils::Curl.curl_supports_tls13?
|
||||
rescue FormulaUnavailableError
|
||||
skip "No `curl` formula is available."
|
||||
|
||||
@@ -40,7 +40,7 @@ RSpec.describe UnpackStrategy do
|
||||
|
||||
FileUtils.chmod "-w", dir/directories unless writable
|
||||
begin
|
||||
system "tar", "--create", "--file", path, "--directory", dir, "A/"
|
||||
system "tar", "--create", "--file", path.to_s, "--directory", dir.to_s, "A/"
|
||||
ensure
|
||||
FileUtils.chmod "+w", dir/directories unless writable
|
||||
end
|
||||
@@ -78,7 +78,7 @@ RSpec.describe UnpackStrategy do
|
||||
(mktmpdir/basename).tap do |path|
|
||||
mktmpdir do |dir|
|
||||
FileUtils.touch dir/"file.txt"
|
||||
system "tar", "--create", "--file", path, "--directory", dir, "file.txt"
|
||||
system "tar", "--create", "--file", path.to_s, "--directory", dir.to_s, "file.txt"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,14 +25,14 @@ RSpec.describe Utils do
|
||||
int main() { foo(); return 0; }
|
||||
C
|
||||
|
||||
system "cc", "-c", "-fpic", dir/"foo.c", "-o", dir/"foo.o"
|
||||
system "cc", "-c", "-fpic", dir/"bar.c", "-o", dir/"bar.o"
|
||||
system "cc", "-c", "-fpic", "#{dir}/foo.c", "-o", "#{dir}/foo.o"
|
||||
system "cc", "-c", "-fpic", "#{dir}/bar.c", "-o", "#{dir}/bar.o"
|
||||
dll_flag = OS.mac? ? "-dynamiclib" : "-shared"
|
||||
(HOMEBREW_PREFIX/"lib").mkdir
|
||||
system "cc", dll_flag, "-o", HOMEBREW_PREFIX/"lib/libbrewfoo#{suffix}", dir/"foo.o"
|
||||
system "cc", dll_flag, "-o", HOMEBREW_PREFIX/"lib/libbrewbar#{suffix}", dir/"bar.o"
|
||||
system "cc", dll_flag, "-o", "#{HOMEBREW_PREFIX}/lib/libbrewfoo#{suffix}", "#{dir}/foo.o"
|
||||
system "cc", dll_flag, "-o", "#{HOMEBREW_PREFIX}/lib/libbrewbar#{suffix}", "#{dir}/bar.o"
|
||||
rpath_flag = "-Wl,-rpath,#{HOMEBREW_PREFIX}/lib" if OS.linux?
|
||||
system "cc", "-o", dir/"brewtest", dir/"test.c", *rpath_flag, "-L#{HOMEBREW_PREFIX/"lib"}", "-lbrewfoo"
|
||||
system "cc", "-o", "#{dir}/brewtest", "#{dir}/test.c", *rpath_flag, "-L#{HOMEBREW_PREFIX}/lib", "-lbrewfoo"
|
||||
(HOMEBREW_PREFIX/"bin").install dir/"brewtest"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user