utils: prepare for deprecation of Utils.gzip

This commit is contained in:
Caleb Xu 2023-01-06 22:58:53 -05:00
parent c75adc8238
commit f6474c5048
No known key found for this signature in database
GPG Key ID: 47E6040D07B8407D
2 changed files with 4 additions and 13 deletions

View File

@ -183,15 +183,6 @@ describe "globally-scoped helper methods" do
expect(which_editor).to eq("vemate -w") expect(which_editor).to eq("vemate -w")
end 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 specify "#capture_stderr" do
err = capture_stderr do err = capture_stderr do
$stderr.print "test" $stderr.print "test"

View File

@ -11,6 +11,7 @@ require "utils/gems"
require "utils/git" require "utils/git"
require "utils/git_repository" require "utils/git_repository"
require "utils/github" require "utils/github"
require "utils/gzip"
require "utils/inreplace" require "utils/inreplace"
require "utils/link" require "utils/link"
require "utils/popen" require "utils/popen"
@ -397,11 +398,10 @@ module Kernel
end end
# GZips the given paths, and returns the gzipped paths. # GZips the given paths, and returns the gzipped paths.
# TODO: Add deprecation
# odeprecated "Utils.gzip" "Utils::Gzip.compress"
def gzip(*paths) def gzip(*paths)
paths.map do |path| Utils::Gzip.compress(*paths)
safe_system "gzip", path
Pathname.new("#{path}.gz")
end
end end
def ignore_interrupts(_opt = nil) def ignore_interrupts(_opt = nil)