update to new version

Resolves: rhbz#1842013
Resolves: rhbz#1923366
This commit is contained in:
Jun Aruga 2021-03-01 10:56:34 +01:00
parent 4d2030c321
commit ce54204cac
5 changed files with 76 additions and 26 deletions

2
.gitignore vendored
View File

@ -7,3 +7,5 @@ coderay-0.8.312.gem
/coderay-1.1.0.gem
/coderay-1.1.2-tests.tgz
/coderay-1.1.2.gem
/coderay-1.1.3-tests.txz
/coderay-1.1.3.gem

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,22 +1,24 @@
%global gem_name coderay
Name: rubygem-%{gem_name}
Version: 1.1.2
Release: 9%{?dist}
Version: 1.1.3
Release: 1%{?dist}
Summary: Fast syntax highlighting for selected languages
License: MIT
URL: http://coderay.rubychan.de
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# git clone https://github.com/rubychan/coderay.git && cd coderay
# git checkout v1.1.2 && tar czvf coderay-1.1.2-tests.tgz test/
Source1: %{gem_name}-%{version}-tests.tgz
# Remove extended Tokens#filter for Ruby 2.6 compatibility.
# https://github.com/rubychan/coderay/pull/233
Patch0: 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
# Fix test suite for ruby 3.0 change for methods on subclass of Array
# https://github.com/rubychan/coderay/pull/255
Patch0: rubygem-coderay-1.1.3-fix-tests-Array-on-ruby-3.0.patch
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby >= 1.8.6
BuildRequires: rubygem(test-unit)
BuildRequires: rubygem(rspec)
BuildRequires: rubygem(shoulda-context)
BuildArch: noarch
%description
@ -33,9 +35,11 @@ BuildArch: noarch
Documentation for %{name}.
%prep
%setup -q -n %{gem_name}-%{version}
%setup -q -n %{gem_name}-%{version} -b 1
pushd ..
%patch0 -p1
popd
%build
gem build ../%{gem_name}-%{version}.gemspec
@ -56,12 +60,27 @@ 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 ./test/functional/suite.rb
ruby ./test/functional/for_redcloth.rb
ruby ./test/unit/suite.rb
# This test depends on rubygem-shoulda-context.
ruby ./test/executable/suite.rb
rspec spec
popd
%files
@ -78,6 +97,11 @@ popd
%doc %{gem_instdir}/README_INDEX.rdoc
%changelog
* Mon Mar 01 2021 Jun Aruga <jaruga@redhat.com> - 1.1.3-1
- update to new version
Resolves: rhbz#1842013
Resolves: rhbz#1923366
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.2-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

View File

@ -1,2 +1,2 @@
SHA512 (coderay-1.1.2-tests.tgz) = 1b2a6285f246ef2622f8dd4116bcd5db0f907c9d473c47c773379ac1a113ae149a048497e76efdfced081e5eac8cd0196515367cc8798bd9f6ddd293c75efa94
SHA512 (coderay-1.1.2.gem) = bd25c0091a271048165af33f60ab846cb623a0da68e5540d98ea2b1c6bdf3348811d98519e537435c9a5515e751ce5975a02adccec9ef225f042a27c43009e63
SHA512 (coderay-1.1.3-tests.txz) = f0fbbbc674312f6e5e358af98c9b72d9ed8ca7df0dbdea696480a07aaf9bb019fc4fdeacc8546cb8baf299370df0f35bce7d61832f988161c1f058a371ac414b
SHA512 (coderay-1.1.3.gem) = 8da82467be341bdb358869c3ac63130e5e3ed314d0c9918ed26cf8a067eae149b4eb3358451c0a136b8e716304296a7dc4eb4cb385dd106f5cab5a4d1a2fe92f