!5 Fix build error for ruby3.2.2

From: @wk333 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
This commit is contained in:
openeuler-ci-bot 2023-08-03 01:39:47 +00:00 committed by Gitee
commit 57975acfee
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,29 @@
From 83370d33327aa9e4b147757cba1bc9c764f0473f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Thu, 22 Dec 2022 15:03:17 +0100
Subject: [PATCH] Use File.exist?
`File.exists?` was deprecated while ago and removed in Ruby 3.2.
https://bugs.ruby-lang.org/issues/17391
https://github.com/ruby/ruby/pull/5352
Origin: https://github.com/thoughtbot/shoulda-context/commit/83370d3
---
bin/convert_to_should_syntax | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/convert_to_should_syntax b/bin/convert_to_should_syntax
index d1264d0..ebdda98 100755
--- a/bin/convert_to_should_syntax
+++ b/bin/convert_to_should_syntax
@@ -31,7 +31,7 @@ usage("Temp directory '#{TMP}' is not valid. Set TMPDIR environment variable to
file = ARGV.shift
tmpfile = File.join(TMP, File.basename(file))
-usage("File '#{file}' doesn't exist") unless File.exists?(file)
+usage("File '#{file}' doesn't exist") unless File.exist?(file)
FileUtils.cp(file, tmpfile)
contents = File.read(tmpfile)

View File

@ -1,11 +1,12 @@
%global gem_name shoulda-context %global gem_name shoulda-context
Name: rubygem-%{gem_name} Name: rubygem-%{gem_name}
Version: 1.2.2 Version: 1.2.2
Release: 2 Release: 3
Summary: Context framework extracted from Shoulda Summary: Context framework extracted from Shoulda
License: MIT License: MIT
URL: https://github.com/thoughtbot/shoulda-context URL: https://github.com/thoughtbot/shoulda-context
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
Patch0: rubygem-shoulda-context-2.0.0-Use-File-exist.patch
BuildRequires: ruby(release) rubygems-devel ruby rubygem(bundler) rubygem(jquery-rails) BuildRequires: ruby(release) rubygems-devel ruby rubygem(bundler) rubygem(jquery-rails)
BuildRequires: rubygem(mocha) rubygem(rails) rubygem(sass-rails) rubygem(sqlite3) BuildRequires: rubygem(mocha) rubygem(rails) rubygem(sass-rails) rubygem(sqlite3)
BuildRequires: rubygem(test-unit) rubygem(did_you_mean) BuildRequires: rubygem(test-unit) rubygem(did_you_mean)
@ -27,6 +28,7 @@ Documentation for %{name}.
%prep %prep
gem unpack %{SOURCE0} gem unpack %{SOURCE0}
%setup -q -D -T -n %{gem_name}-%{version} %setup -q -D -T -n %{gem_name}-%{version}
%patch0 -p1
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
sed -i 's/\r$//' MIT-LICENSE sed -i 's/\r$//' MIT-LICENSE
sed -i 's|#!/usr/bin/env ruby|#!/usr/bin/ruby|' bin/convert_to_should_syntax sed -i 's|#!/usr/bin/env ruby|#!/usr/bin/ruby|' bin/convert_to_should_syntax
@ -90,6 +92,9 @@ popd
%{gem_instdir}/test %{gem_instdir}/test
%changelog %changelog
* Wed Aug 02 2023 wangkai <13474090681@163.com> - 1.2.2-3
- Fix build error for ruby3.2.2
* Sat Mar 5 2022 liyanan <liyanan32@huawei.com> - 1.2.2-2 * Sat Mar 5 2022 liyanan <liyanan32@huawei.com> - 1.2.2-2
- fix build error - fix build error