Update to Ronn-NG 0.10.1
This commit is contained in:
parent
b8ee1ea249
commit
8181381a54
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1,3 @@
|
||||
/ronn-ng-0.9.1.gem
|
||||
/ronn-ng-0.10.1-test.tar.gz
|
||||
/ronn-ng-0.10.1.gem
|
||||
|
@ -1,174 +0,0 @@
|
||||
From 25158fabc2c83862de90f319b7dffc9e60904dac Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||
Date: Tue, 30 Aug 2022 09:07:15 +0200
|
||||
Subject: [PATCH 1/4] Permit `Time` class loading from YAML.
|
||||
|
||||
Since Psych 4.0, the `safe_load` is used as default loading mechanism.
|
||||
There are just a few permitted classes and `Time` is not one of them
|
||||
[[1]]. This results it test failure:
|
||||
|
||||
~~~
|
||||
Error: test_converting_to_yaml(DocumentTest::TestSimpleConventionallyNamedDocument): Psych::DisallowedClass: Tried to load unspecified class: Time
|
||||
~~~
|
||||
|
||||
Please also note that in YAML specs 1.2, the `timestamp` is not
|
||||
listed as supported tag anymore [[2]].
|
||||
|
||||
Given that:
|
||||
|
||||
1) ronn-ng does not provide any supported way of loading the serialized
|
||||
YAML.
|
||||
2) The `to_yaml` does not appear to be used internally/externally
|
||||
anywhere.
|
||||
3) If there were users of this functionality, it would have been already
|
||||
know, reported and fixed at this moment.
|
||||
|
||||
The best course of action is fixing the test case by listing the `Time`
|
||||
as valid class for parsing.
|
||||
|
||||
Fixes #80
|
||||
|
||||
[1]: https://docs.ruby-lang.org/en/master/Psych.html#method-c-safe_load
|
||||
[2]: https://github.com/yaml/yaml-spec/issues/268
|
||||
---
|
||||
test/test_ronn_document.rb | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/test/test_ronn_document.rb b/test/test_ronn_document.rb
|
||||
index 75788dc..a86793f 100644
|
||||
--- a/test/test_ronn_document.rb
|
||||
+++ b/test/test_ronn_document.rb
|
||||
@@ -146,7 +146,7 @@ def canonicalize(text)
|
||||
'toc' => [['NAME', 'NAME']],
|
||||
'organization' => nil,
|
||||
'manual' => nil
|
||||
- }, YAML.load(@doc.to_yaml))
|
||||
+ }, YAML.load(@doc.to_yaml, permitted_classes: [Time]))
|
||||
end
|
||||
|
||||
test 'converting to json' do
|
||||
|
||||
From c8aaa0235ed0dd41ea7ea83e5133ae494cbf072a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||
Date: Tue, 30 Aug 2022 09:59:07 +0200
|
||||
Subject: [PATCH 2/4] Check if `YAML.load` supports `permitted_classes` kwarg.
|
||||
|
||||
This is due to Ruby 3.1 + Psych 4.0 changed changed `YAML.load` to use
|
||||
`safe_load` by default.
|
||||
---
|
||||
test/test_ronn_document.rb | 11 ++++++++++-
|
||||
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/test/test_ronn_document.rb b/test/test_ronn_document.rb
|
||||
index a86793f..c9c08c7 100644
|
||||
--- a/test/test_ronn_document.rb
|
||||
+++ b/test/test_ronn_document.rb
|
||||
@@ -137,6 +137,15 @@ def canonicalize(text)
|
||||
|
||||
test 'converting to yaml' do
|
||||
require 'yaml'
|
||||
+ # Check if `permitted_classes` keyword argument is available. That means
|
||||
+ # `safe_load` is the default loading mechanism, i.e. Ruby 3.1 + Psych 4.0
|
||||
+ # are used.
|
||||
+ kwargs = !(YAML.method(:load).parameters & [[:key, :permitted_classes]]).empty?
|
||||
+ loaded_yaml = if kwargs
|
||||
+ YAML.load(@doc.to_yaml, permitted_classes: [Time])
|
||||
+ else
|
||||
+ YAML.load(@doc.to_yaml)
|
||||
+ end
|
||||
assert_equal({
|
||||
'section' => '1',
|
||||
'name' => 'hello',
|
||||
@@ -146,7 +155,7 @@ def canonicalize(text)
|
||||
'toc' => [['NAME', 'NAME']],
|
||||
'organization' => nil,
|
||||
'manual' => nil
|
||||
- }, YAML.load(@doc.to_yaml, permitted_classes: [Time]))
|
||||
+ }, loaded_yaml)
|
||||
end
|
||||
|
||||
test 'converting to json' do
|
||||
|
||||
From d7bbcd7ef4461bd28eb3e9fc1880f7a5d5d46d88 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||
Date: Tue, 30 Aug 2022 10:09:19 +0200
|
||||
Subject: [PATCH 3/4] Extract the YAML loading logic into function
|
||||
|
||||
This is to make the test case less poluted. Can be dropped once only
|
||||
Ruby 3.1+ is supported.
|
||||
---
|
||||
test/test_ronn_document.rb | 23 +++++++++++++----------
|
||||
1 file changed, 13 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/test/test_ronn_document.rb b/test/test_ronn_document.rb
|
||||
index c9c08c7..ae6f72a 100644
|
||||
--- a/test/test_ronn_document.rb
|
||||
+++ b/test/test_ronn_document.rb
|
||||
@@ -12,6 +12,18 @@ def canonicalize(text)
|
||||
.tr('"', "'")
|
||||
end
|
||||
|
||||
+ def yaml_load(yaml)
|
||||
+ # Check if `permitted_classes` keyword argument is available. That means
|
||||
+ # `safe_load` is the default loading mechanism, i.e. Ruby 3.1 + Psych 4.0
|
||||
+ # are used.
|
||||
+ kwargs = !(YAML.method(:load).parameters & [[:key, :permitted_classes]]).empty?
|
||||
+ if kwargs
|
||||
+ YAML.load(yaml, permitted_classes: [Time])
|
||||
+ else
|
||||
+ YAML.load(yaml)
|
||||
+ end
|
||||
+ end
|
||||
+
|
||||
test 'new with path' do
|
||||
doc = Ronn::Document.new(SIMPLE_FILE)
|
||||
assert_equal File.read(SIMPLE_FILE), doc.data
|
||||
@@ -137,15 +149,6 @@ def canonicalize(text)
|
||||
|
||||
test 'converting to yaml' do
|
||||
require 'yaml'
|
||||
- # Check if `permitted_classes` keyword argument is available. That means
|
||||
- # `safe_load` is the default loading mechanism, i.e. Ruby 3.1 + Psych 4.0
|
||||
- # are used.
|
||||
- kwargs = !(YAML.method(:load).parameters & [[:key, :permitted_classes]]).empty?
|
||||
- loaded_yaml = if kwargs
|
||||
- YAML.load(@doc.to_yaml, permitted_classes: [Time])
|
||||
- else
|
||||
- YAML.load(@doc.to_yaml)
|
||||
- end
|
||||
assert_equal({
|
||||
'section' => '1',
|
||||
'name' => 'hello',
|
||||
@@ -155,7 +158,7 @@ def canonicalize(text)
|
||||
'toc' => [['NAME', 'NAME']],
|
||||
'organization' => nil,
|
||||
'manual' => nil
|
||||
- }, loaded_yaml)
|
||||
+ }, yaml_load(@doc.to_yaml))
|
||||
end
|
||||
|
||||
test 'converting to json' do
|
||||
|
||||
From 7c49ae1926728987ca97e014931bb9148aa868b1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||
Date: Tue, 30 Aug 2022 10:25:46 +0200
|
||||
Subject: [PATCH 4/4] Use symbol array literal.
|
||||
|
||||
This should make Rubocop happy.
|
||||
---
|
||||
test/test_ronn_document.rb | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/test/test_ronn_document.rb b/test/test_ronn_document.rb
|
||||
index ae6f72a..aa97a88 100644
|
||||
--- a/test/test_ronn_document.rb
|
||||
+++ b/test/test_ronn_document.rb
|
||||
@@ -16,7 +16,7 @@ def yaml_load(yaml)
|
||||
# Check if `permitted_classes` keyword argument is available. That means
|
||||
# `safe_load` is the default loading mechanism, i.e. Ruby 3.1 + Psych 4.0
|
||||
# are used.
|
||||
- kwargs = !(YAML.method(:load).parameters & [[:key, :permitted_classes]]).empty?
|
||||
+ kwargs = !(YAML.method(:load).parameters & [%i[key permitted_classes]]).empty?
|
||||
if kwargs
|
||||
YAML.load(yaml, permitted_classes: [Time])
|
||||
else
|
@ -1,13 +0,0 @@
|
||||
Backport of https://github.com/apjanke/ronn-ng/commit/c4459d4fc7fed5f0c3512a3751e1d13072dd5d3a
|
||||
|
||||
diff --git a/test/angle_bracket_syntax.html b/test/angle_bracket_syntax.html
|
||||
index e10241b..8567d2e 100644
|
||||
--- a/test/angle_bracket_syntax.html
|
||||
+++ b/test/angle_bracket_syntax.html
|
||||
@@ -13,5 +13,5 @@ code block,
|
||||
|
||||
<p>or when <code><WORD></code> is enclosed in backticks.</p>
|
||||
|
||||
-<p>or when <var>WORD</var> has a <dot.> or <colon>.</colon></dot.></p>
|
||||
+<p>or when <var>WORD</var> has a <dot.> or <foo:colon>.</foo:colon></dot.></p>
|
||||
</div>
|
@ -2,23 +2,20 @@
|
||||
%global gem_name ronn-ng
|
||||
|
||||
Name: rubygem-%{gem_name}
|
||||
Version: 0.9.1
|
||||
Release: 8%{?dist}
|
||||
Version: 0.10.1
|
||||
Release: 1%{?dist}
|
||||
Summary: Builds man pages from Markdown
|
||||
License: MIT
|
||||
URL: https://github.com/apjanke/ronn-ng
|
||||
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
||||
# Fix Ruby 3.1 / Psych 4.0 test compatibility.
|
||||
# https://github.com/apjanke/ronn-ng/issues/80
|
||||
# https://github.com/apjanke/ronn-ng/pull/81
|
||||
Patch0: rubygem-ronn-ng-0.9.1-Permit-Time-class-loading-from-YAML.patch
|
||||
# Workaround for libxml2 2.10.3+ test compatibility
|
||||
# https://github.com/apjanke/ronn-ng/issues/102
|
||||
Patch1: rubygem-ronn-ng-0.9.1-libxml2-namespace.patch
|
||||
# git clone https://github.com/apjanke/ronn-ng.git && cd ronn-ng
|
||||
# git archive -v -o ronn-ng-0.10.1-test.tar.gz v0.10.1 test/
|
||||
Source1: %{gem_name}-%{version}-test.tar.gz
|
||||
BuildRequires: ruby(release)
|
||||
BuildRequires: rubygems-devel
|
||||
BuildRequires: ruby
|
||||
BuildRequires: rubygem(kramdown)
|
||||
BuildRequires: rubygem(kramdown-parser-gfm)
|
||||
BuildRequires: rubygem(mustache)
|
||||
BuildRequires: rubygem(nokogiri)
|
||||
BuildRequires: rubygem(test-unit)
|
||||
@ -29,7 +26,7 @@ Provides: rubygem-ronn = %{version}-%{release}
|
||||
Obsoletes: rubygem-ronn < 0.7.3-20
|
||||
|
||||
%description
|
||||
Ronn builds manuals in HTML and Unix man page format from Markdown.
|
||||
Ronn-NG builds manuals in HTML and Unix man page format from Markdown.
|
||||
|
||||
The source format includes all of Markdown but has a more rigid structure and
|
||||
syntax extensions for features commonly found in man pages (definition lists,
|
||||
@ -45,16 +42,7 @@ BuildArch: noarch
|
||||
Documentation for %{name}.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{gem_name}-%{version}
|
||||
|
||||
%patch0 -p1
|
||||
%patch -P1 -p1
|
||||
|
||||
# Upstream specifies mustache==0.7, but we have 1.1 and it seems to work fine...
|
||||
%gemspec_remove_dep -g mustache "~> 0.7"
|
||||
|
||||
# TODO: file upstream
|
||||
chmod -x lib/ronn.rb
|
||||
%setup -q -n %{gem_name}-%{version} -b 1
|
||||
|
||||
%build
|
||||
# Create the gem as gem install only works on a gem file
|
||||
@ -86,19 +74,20 @@ install -Dt %{buildroot}/usr/share/zsh/site-functions/ -m 0644 %{buildroot}%{gem
|
||||
|
||||
%check
|
||||
pushd .%{gem_instdir}
|
||||
ruby -Ilib:test -e 'Dir.glob "./test/test_*.rb", &method(:require)'
|
||||
cp -a %{_builddir}/test test
|
||||
|
||||
ruby -Itest -e 'Dir.glob "./test/test_*.rb", &method(:require)'
|
||||
popd
|
||||
|
||||
%files
|
||||
%dir %{gem_instdir}
|
||||
%{_bindir}/ronn
|
||||
%{gem_instdir}/CHANGES
|
||||
%{gem_instdir}/INSTALLING.md
|
||||
%license %{gem_instdir}/LICENSE.txt
|
||||
%{gem_instdir}/bin
|
||||
%exclude %{gem_instdir}/completion
|
||||
%{gem_instdir}/config.ru
|
||||
%{gem_libdir}
|
||||
%exclude %{gem_instdir}/completion
|
||||
%exclude %{gem_instdir}/man
|
||||
%exclude %{gem_cache}
|
||||
%{gem_spec}
|
||||
@ -111,13 +100,15 @@ popd
|
||||
%files doc
|
||||
%doc %{gem_docdir}
|
||||
%doc %{gem_instdir}/AUTHORS
|
||||
%{gem_instdir}/Gemfile
|
||||
%doc %{gem_instdir}/CHANGELOG.md
|
||||
%doc %{gem_instdir}/README.md
|
||||
%{gem_instdir}/Rakefile
|
||||
%{gem_instdir}/ronn-ng.gemspec
|
||||
%{gem_instdir}/test
|
||||
|
||||
%changelog
|
||||
* Mon Jan 08 2024 Vít Ondruch <vondruch@redhat.com> - 0.10.1-1
|
||||
- Update to Ronn-NG 0.10.1
|
||||
|
||||
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.1-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
|
3
sources
3
sources
@ -1 +1,2 @@
|
||||
SHA512 (ronn-ng-0.9.1.gem) = 5ad7dc426d9bc77bca86fbb06775a3b19f1b8d79f5a4331d117e9fa394e7a9c3b0440b70b993672d77a24f56f5da3ebd0e41a5183f4330707b7ddb83c9108bdf
|
||||
SHA512 (ronn-ng-0.10.1-test.tar.gz) = 6578ea7d0ae2bcd3a48ae7048365c3bed630896b04fba582c7a7be136c4e74371c8d01539d29edfe1921625474bceb2f7d6bef54e554b8afdd6f1f8a8da7ee59
|
||||
SHA512 (ronn-ng-0.10.1.gem) = cda3689bbd5e997fcc49fe0c7b1732f1af13bc27245e1e008f5305339964273128f7cb6a12422c5e46cfe718ac8853bafc2796cd4740e4b03911a748807092c6
|
||||
|
Loading…
Reference in New Issue
Block a user