!4 [sync] PR-2: 升级rubygem-coderay到1.1.3版本解决编译失败

From: @openeuler-sync-bot 
Reviewed-by: @shinwell_hu 
Signed-off-by: @shinwell_hu
This commit is contained in:
openeuler-ci-bot 2022-03-24 12:27:59 +00:00 committed by Gitee
commit 4aa917b436
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
8 changed files with 72 additions and 24 deletions

Binary file not shown.

Binary file not shown.

BIN
coderay-1.1.3-tests.txz Normal file

Binary file not shown.

BIN
coderay-1.1.3.gem Normal file

Binary file not shown.

BIN
coderay-1.1.3.tar.gz Normal file

Binary file not shown.

View File

@ -1,14 +0,0 @@
diff --git a/lib/coderay/tokens.rb b/lib/coderay/tokens.rb
index e7bffce2..b5f78e71 100644
--- a/lib/coderay/tokens.rb
+++ b/lib/coderay/tokens.rb
@@ -39,6 +39,9 @@ module CodeRay
# You can serialize it to a JSON string and store it in a database, pass it
# around to encode it more than once, send it to other algorithms...
class Tokens < Array
+ # Remove Array#filter that is a new alias for Array#select on Ruby 2.6,
+ # for method_missing called with filter method.
+ undef_method :filter if instance_methods.include?(:filter)
# The Scanner instance that created the tokens.
attr_accessor :scanner

View File

@ -0,0 +1,38 @@
diff --git a/test/unit/debug.rb b/test/unit/debug.rb
index 88baf56..b694f21 100644
--- a/test/unit/debug.rb
+++ b/test/unit/debug.rb
@@ -24,7 +24,8 @@ class DebugEncoderTest < Test::Unit::TestCase
[" \n", :space],
["[]", :method],
[:end_line, :head],
- ].flatten
+ ]
+ TEST_INPUT.flatten!
TEST_OUTPUT = <<-'DEBUG'.chomp
integer(10)operator((\\\))string<content(test)>head[
diff --git a/test/unit/statistic.rb b/test/unit/statistic.rb
index 1326dca..776774d 100644
--- a/test/unit/statistic.rb
+++ b/test/unit/statistic.rb
@@ -24,7 +24,8 @@ class StatisticEncoderTest < Test::Unit::TestCase
[" \n", :space],
["[]", :method],
[:end_line, :test],
- ].flatten
+ ]
+ TEST_INPUT.flatten!
TEST_OUTPUT = <<-'DEBUG'
Code Statistics
@@ -56,4 +57,4 @@ Token Types (7):
assert_equal TEST_OUTPUT, TEST_INPUT.statistic
end
-end
\ No newline at end of file
+end
--
2.29.2

View File

@ -1,17 +1,21 @@
%global gem_name coderay
Name: rubygem-%{gem_name}
Version: 1.1.2
Version: 1.1.3
Release: 1
Summary: Fast syntax highlighting for selected languages
License: MIT
URL: http://coderay.rubychan.de
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
Source1: https://github.com/rubychan/coderay/archive/v1.1.2.tar.gz#/%{gem_name}-%{version}.tar.gz
# Remove extended Tokens#filter for Ruby 2.6 compatibility.
# https://github.com/rubychan/coderay/pull/233
Patch0000: rubygem-coderay-1.1.2-remove-Array-filter-for-ruby-2.6.patch
# git clone https://github.com/rubychan/coderay --no-checkout
# cd coderay && git archive -v -o coderay-1.1.3-tests.txz v1.1.3 test spec
Source1: %{gem_name}-%{version}-tests.txz
Source2: https://github.com/rubychan/coderay/archive/refs/tags/v1.1.3.tar.gz#/%{gem_name}-%{version}.tar.gz
# Fix test suite for ruby 3.0 change for methods on subclass of Array
# https://github.com/rubychan/coderay/pull/255
Patch0000: rubygem-coderay-1.1.3-fix-tests-Array-on-ruby-3.0.patch
BuildRequires: ruby(release) rubygems-devel ruby >= 1.8.6 rubygem(test-unit)
BuildRequires: rubygem(rspec)
BuildArch: noarch
%description
Fast and easy syntax highlighting for selected languages, written in Ruby.
@ -25,7 +29,11 @@ BuildArch: noarch
Documentation for %{name}.
%prep
%autosetup -n %{gem_name}-%{version} -p1
%setup -q -n %{gem_name}-%{version} -b 1
pushd ..
%patch0 -p1
popd
%build
gem build ../%{gem_name}-%{version}.gemspec
@ -42,12 +50,25 @@ find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x
%check
pushd .%{gem_instdir}
tar xzvf %{SOURCE1}
cp -r %{_builddir}/spec .
cp -r %{_builddir}/test .
# Comment out simplecov.
for file in \
spec/spec_helper.rb \
test/executable/suite.rb \
test/functional/for_redcloth.rb \
test/functional/suite.rb \
test/unit/suite.rb; do
sed -i "/^require 'simplecov'/ s/^/#/" "${file}"
done
# See https://github.com/rubychan/coderay/blob/master/rake_tasks/test.rake
LANG=C.UTF-8
ruby ./%{gem_name}-%{version}/test/functional/suite.rb
ruby ./%{gem_name}-%{version}/test/functional/for_redcloth.rb
ruby ./%{gem_name}-%{version}/test/unit/suite.rb
ruby ./test/functional/suite.rb
ruby ./test/functional/for_redcloth.rb
ruby ./test/unit/suite.rb
rspec spec
popd
%files
@ -64,5 +85,8 @@ popd
%doc %{gem_instdir}/README_INDEX.rdoc
%changelog
* Mon Feb 14 2022 yaoxin <yaoxin30@huawei.com> - 1.1.3-1
- Upgrade rubygem-coderay to 1.1.3 to resolve compilation failures.
* Sat Jul 25 2020 wangxiao <wangxiao65@huawei.com> - 1.1.2-1
- package init