Fix rubygem-expression_parser test failure caused by ruby upgrade to 3.2.2

Signed-off-by: cherry530 <707078654@qq.com>
(cherry picked from commit 4795b9ebdc5448681cb28e7398496636fd89eec7)
This commit is contained in:
cherry530 2023-08-14 08:56:55 +08:00 committed by openeuler-sync-bot
parent 30fa2e2d02
commit 223721ad22
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,48 @@
diff --git a/examples/info.rb b/examples/info.rb
index 2a97bfd..b676d25 100644
--- a/examples/info.rb
+++ b/examples/info.rb
@@ -1,5 +1,5 @@
require File.join(File.dirname(__FILE__),'../init.rb')
-if ARGV[0] && File.exists?(ARGV[0])
+if ARGV[0] && File.exist?(ARGV[0])
data = File.read(ARGV[0])
else
data = "[[ this ]] is a [[ link ]] and another [http://www.google.com Google]. This is a <ref>reference</ref>, but this is a [[Category:Test]]. This is in another [[de:Sprache]]"
diff --git a/examples/print.rb b/examples/print.rb
index acf74f5..5f69571 100644
--- a/examples/print.rb
+++ b/examples/print.rb
@@ -1,5 +1,5 @@
require File.join(File.dirname(__FILE__),'../init.rb')
-if ARGV[0] && File.exists?(ARGV[0])
+if ARGV[0] && File.exist?(ARGV[0])
data = File.read(ARGV[0])
else
data = "[[ this ]] is a [[ link ]] and another [http://www.google.com Google] but they should be disabled"
diff --git a/lib/wikicloth/extensions/math.rb b/lib/wikicloth/extensions/math.rb
index 7543e29..7448b25 100644
--- a/lib/wikicloth/extensions/math.rb
+++ b/lib/wikicloth/extensions/math.rb
@@ -9,7 +9,7 @@ module WikiCloth
blahtex_png_path = @options[:blahtex_png_path] || '/tmp'
blahtex_options = @options[:blahtex_options] || '--texvc-compatible-commands --mathml-version-1-fonts --disallow-plane-1 --spacing strict'
- if File.exists?(blahtex_path) && @options[:math_formatter] != :google
+ if File.exist?(blahtex_path) && @options[:math_formatter] != :google
begin
# pass tex markup to blahtex
response = `echo '#{buffer.element_content}' | #{blahtex_path} #{blahtex_options} --png --mathml --png-directory #{blahtex_png_path}`
diff --git a/lib/wikicloth/extensions/source.rb b/lib/wikicloth/extensions/source.rb
index 5d05585..b092de7 100644
--- a/lib/wikicloth/extensions/source.rb
+++ b/lib/wikicloth/extensions/source.rb
@@ -19,7 +19,7 @@ module WikiCloth
content = $1 if content =~ /^\s*\n(.*)$/m
error = nil
- if File.exists?(highlight_path)
+ if File.exist?(highlight_path)
begin
raise I18n.t("lang attribute is required") unless buffer.element_attributes.has_key?('lang')
raise I18n.t("unknown lang", :lang => buffer.element_attributes['lang'].downcase) unless LuaExtension::VALID_LANGUAGES.include?(buffer.element_attributes['lang'].downcase)

View File

@ -1,7 +1,7 @@
%global gem_name wikicloth
Name: rubygem-%{gem_name}
Version: 0.8.0
Release: 2
Release: 3
Summary: Mediawiki parser
License: MIT
URL: https://github.com/nricciar/wikicloth
@ -9,6 +9,7 @@ Source0: https://rubygems.org/gems/wikicloth-%{version}.gem
Patch0: rubygem-wikicloth-0.8.0-minitest.patch
Patch1: rubygem-wikicloth-0.8.3-add-a-condition-to-avoid-FrozenError.patch
Patch2: Fix-build-error.patch
Patch3: Fix-rubygem-expression_parser-test-failure.patch
Requires: ruby(release) ruby(rubygems) rubygem(builder) rubygem(expression_parser)
BuildRequires: ruby(release) rubygems-devel rubygem(activesupport) rubygem(builder)
BuildRequires: rubygem(expression_parser) rubygem(rexml)
@ -31,6 +32,7 @@ gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
for f in .gitignore .travis.yml Gemfile Rakefile run_tests.rb tasks/wikicloth_tasks.rake; do
rm $f
sed -i "s|\"$f\".freeze,||g" %{gem_name}.gemspec
@ -69,6 +71,9 @@ popd
%{gem_instdir}/sample_documents
%changelog
* Mon Aug 14 2023 xu_ping <707078654@qq.com.com> - 0.8.0-3
- Fix rubygem-expression_parser test failure caused by ruby upgrade to 3.2.2
* Wed Feb 9 2022 yanan li <liyanan32@huawei.com> - 0.8.0-2
- Fix build error