From f6474c5048b223894c1a1b295a4d9f64711b1405 Mon Sep 17 00:00:00 2001 From: Caleb Xu Date: Fri, 6 Jan 2023 22:58:53 -0500 Subject: [PATCH] utils: prepare for deprecation of Utils.gzip --- Library/Homebrew/test/utils_spec.rb | 9 --------- Library/Homebrew/utils.rb | 8 ++++---- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/Library/Homebrew/test/utils_spec.rb b/Library/Homebrew/test/utils_spec.rb index e26ebbacb9..c0720e6ae7 100644 --- a/Library/Homebrew/test/utils_spec.rb +++ b/Library/Homebrew/test/utils_spec.rb @@ -183,15 +183,6 @@ describe "globally-scoped helper methods" do expect(which_editor).to eq("vemate -w") end - specify "#gzip" do - mktmpdir do |path| - somefile = path/"somefile" - FileUtils.touch somefile - expect(gzip(somefile)[0].to_s).to eq("#{somefile}.gz") - expect(Pathname.new("#{somefile}.gz")).to exist - end - end - specify "#capture_stderr" do err = capture_stderr do $stderr.print "test" diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 0fb623d7c5..24651e9579 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -11,6 +11,7 @@ require "utils/gems" require "utils/git" require "utils/git_repository" require "utils/github" +require "utils/gzip" require "utils/inreplace" require "utils/link" require "utils/popen" @@ -397,11 +398,10 @@ module Kernel end # GZips the given paths, and returns the gzipped paths. + # TODO: Add deprecation + # odeprecated "Utils.gzip" "Utils::Gzip.compress" def gzip(*paths) - paths.map do |path| - safe_system "gzip", path - Pathname.new("#{path}.gz") - end + Utils::Gzip.compress(*paths) end def ignore_interrupts(_opt = nil)