Replacei deprecated File.exists with File.exist due to ruby upgrade to 3.2.2

This commit is contained in:
chen-jan 2023-08-02 11:14:33 +08:00
parent 07db6a29a0
commit f944d1ded2
2 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,66 @@
From 47eae0ac7be216b2f09a8cf68ba9863751c805d3 Mon Sep 17 00:00:00 2001
From: chen-jan <chen_aka_jan@163.com>
Date: Wed, 2 Aug 2023 11:04:02 +0800
Subject: [PATCH] Replace deprecated File.exists? with File.exist?
---
spec/lib/mini_magick/image_spec.rb | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/spec/lib/mini_magick/image_spec.rb b/spec/lib/mini_magick/image_spec.rb
index 74203b1..449956d 100644
--- a/spec/lib/mini_magick/image_spec.rb
+++ b/spec/lib/mini_magick/image_spec.rb
@@ -119,7 +119,7 @@ require "webmock/rspec"
it "creates an image" do
image = create
- expect(File.exists?(image.path)).to eq true
+ expect(File.exist?(image.path)).to eq true
end
it "validates the image if validation is set" do
@@ -245,12 +245,12 @@ require "webmock/rspec"
cache_path = image.path.sub(/mpc$/, "cache")
image.format("png")
- expect(File.exists?(cache_path)).to eq false
+ expect(File.exist?(cache_path)).to eq false
end
it "doesn't delete itself when formatted to the same format" do
subject.format(subject.type.downcase)
- expect(File.exists?(subject.path)).to eq true
+ expect(File.exist?(subject.path)).to eq true
end
it "reformats multi-image formats to multiple images" do
@@ -693,14 +693,14 @@ require "webmock/rspec"
image = described_class.open(image_path)
image.destroy!
- expect(File.exists?(image.path)).to eq false
+ expect(File.exist?(image.path)).to eq false
end
it "doesn't delete when there is no tempfile" do
image = described_class.new(image_path)
image.destroy!
- expect(File.exists?(image.path)).to eq true
+ expect(File.exist?(image.path)).to eq true
end
it "deletes .cache files generated by handling .mpc files" do
@@ -708,7 +708,7 @@ require "webmock/rspec"
image.format("mpc")
image.destroy!
- expect(File.exists?(image.path.sub(/mpc$/, "cache"))).to eq false
+ expect(File.exist?(image.path.sub(/mpc$/, "cache"))).to eq false
end
end
--
2.41.0

View File

@ -1,7 +1,7 @@
%global gem_name mini_magick
Name: rubygem-%{gem_name}
Version: 4.8.0
Release: 4
Release: 5
Summary: Manipulate images with minimal use of memory via ImageMagick
License: MIT
URL: https://github.com/minimagick/minimagick
@ -11,6 +11,7 @@ Patch2: CVE-2019-13574-1.patch
Patch3: CVE-2019-13574-2.patch
Patch4: fix-URI-InvalidURIError-no-such-file-directory.patch
Patch5: fix-no-implicit-conversion-of-hash-into-integer.patch
Patch6: Replace-deprecated-File.exists-with-File.exist.patch
Requires: ImageMagick
BuildRequires: ruby(release) rubygems-devel ruby rubygem(rspec) rubygem(webmock) ImageMagick rubygem(rexml)
BuildArch: noarch
@ -48,6 +49,7 @@ cd minimagick-%{version}
cat %{PATCH3} | patch -p1
cat %{PATCH4} | patch -p1
cat %{PATCH5} | patch -p1
cat %{PATCH6} | patch -p1
sed -i 's/"red"/"Red"/g' spec/lib/mini_magick/image_spec.rb
sed -i '/"date:create"/d' spec/lib/mini_magick/image_spec.rb
sed -i '/Clipping path/d' spec/lib/mini_magick/image_spec.rb
@ -76,6 +78,9 @@ popd
%{gem_instdir}/Rakefile
%changelog
* Wed Aug 02 2023 chenchen <chen_aka_jan@163.com> - 4.8.0-5
- Replacei deprecated File.exists with File.exist due to ruby upgrade to 3.2.2
* Tue Mar 29 2022 liyanan <liyanan32@huawei.com> - 1.0.2-4
- Fix no implicit conversion of Hash into Integer