diff --git a/.gitignore b/.gitignore index e69de29..9902873 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,5 @@ +/*.rpm +/*.tar.gz +/.build*.log +/asciidoctor-*/ +/results_*/ diff --git a/rubygem-asciidoctor-2.0.11-add-support-for-erubi-template-engine.patch b/rubygem-asciidoctor-2.0.11-add-support-for-erubi-template-engine.patch new file mode 100644 index 0000000..b2f0234 --- /dev/null +++ b/rubygem-asciidoctor-2.0.11-add-support-for-erubi-template-engine.patch @@ -0,0 +1,108 @@ +From 11bffe004018c584b3169658bccd0d4cc31cbdcc Mon Sep 17 00:00:00 2001 +From: Dan Allen +Date: Wed, 19 Aug 2020 18:04:10 -0600 +Subject: [PATCH] resolves #3737 add support for erubi template engine; use it + in place of erubis in test suite + +--- + asciidoctor.gemspec | 4 ++-- + lib/asciidoctor/cli/options.rb | 4 ++-- + lib/asciidoctor/converter/template.rb | 3 +++ + test/converter_test.rb | 11 +++++------ + test/invoker_test.rb | 4 ++-- + 5 files changed, 14 insertions(+), 12 deletions(-) + +diff --git a/asciidoctor.gemspec b/asciidoctor.gemspec +index d0c51b37e..4af042fd4 100644 +--- a/asciidoctor.gemspec ++++ b/asciidoctor.gemspec +@@ -40,8 +40,8 @@ Gem::Specification.new do |s| + # concurrent-ruby, haml, slim, and tilt are needed for testing custom templates + s.add_development_dependency 'concurrent-ruby', '~> 1.1.0' + s.add_development_dependency 'cucumber', '~> 3.1.0' +- # erubis is needed for testing alternate eRuby impls +- s.add_development_dependency 'erubis', '~> 2.7.0' ++ # erubi is needed for testing alternate eRuby impls ++ s.add_development_dependency 'erubi', '~> 1.9.0' + s.add_development_dependency 'haml', '~> 5.0.0' + s.add_development_dependency 'minitest', '~> 5.11.0' + s.add_development_dependency 'nokogiri', '~> 1.10.0' +diff --git a/lib/asciidoctor/cli/options.rb b/lib/asciidoctor/cli/options.rb +index db2b4b3d8..41e055f4c 100644 +--- a/lib/asciidoctor/cli/options.rb ++++ b/lib/asciidoctor/cli/options.rb +@@ -76,8 +76,8 @@ def parse!(args) + opts.on('-n', '--section-numbers', 'auto-number section titles in the HTML backend; disabled by default') do + self[:attributes]['sectnums'] = '' + end +- opts.on('--eruby ERUBY', ['erb', 'erubis'], +- 'specify eRuby implementation to use when rendering custom ERB templates: [erb, erubis] (default: erb)') do |eruby| ++ opts.on('--eruby ERUBY', ['erb', 'erubi', 'erubis'], ++ 'specify eRuby implementation to use when rendering custom ERB templates: [erb, erubi, erubis] (default: erb)') do |eruby| + self[:eruby] = eruby + end + opts.on('-a', '--attribute name[=value]', 'a document attribute to set in the form of name, name!, or name=value pair', +diff --git a/lib/asciidoctor/converter/template.rb b/lib/asciidoctor/converter/template.rb +index f215c5e5b..9f6265b55 100644 +--- a/lib/asciidoctor/converter/template.rb ++++ b/lib/asciidoctor/converter/template.rb +@@ -257,6 +257,9 @@ def load_eruby name + if !name || name == 'erb' + require 'erb' unless defined? ::ERB.version + [::Tilt::ERBTemplate, {}] ++ elsif name == 'erubi' ++ Helpers.require_library 'erubi' unless defined? ::Erubis::Engine ++ [::Tilt::ErubiTemplate, {}] + elsif name == 'erubis' + Helpers.require_library 'erubis' unless defined? ::Erubis::FastEruby + [::Tilt::ErubisTemplate, { engine_class: ::Erubis::FastEruby }] +diff --git a/test/converter_test.rb b/test/converter_test.rb +index 1d23c79e8..cf227db8d 100644 +--- a/test/converter_test.rb ++++ b/test/converter_test.rb +@@ -241,7 +241,7 @@ + assert_kind_of Asciidoctor::Converter::TemplateConverter, selected + template = selected.templates[node_name] + assert_kind_of Tilt::ERBTemplate, template +- refute_kind_of Tilt::ErubisTemplate, template ++ refute_kind_of Tilt::ErubiTemplate, template + assert_kind_of ::ERB, template.instance_variable_get('@engine') + assert_equal %(block_#{node_name}.html.erb), File.basename(selected.templates[node_name].file) + end +@@ -258,16 +258,15 @@ + assert_equal expected_output, doc.convert + end + +- test 'should load ERB templates using ErubisTemplate if eruby is set to erubis' do +- doc = Asciidoctor::Document.new [], template_dir: (fixture_path 'custom-backends/erb'), template_cache: false, eruby: 'erubis' ++ test 'should load ERB templates using ErubiTemplate if eruby is set to erubi' do ++ doc = Asciidoctor::Document.new [], template_dir: (fixture_path 'custom-backends/erb'), template_cache: false, eruby: 'erubi' + assert_kind_of Asciidoctor::Converter::CompositeConverter, doc.converter + %w(paragraph).each do |node_name| + selected = doc.converter.find_converter node_name + assert_kind_of Asciidoctor::Converter::TemplateConverter, selected + template = selected.templates[node_name] +- assert_kind_of Tilt::ERBTemplate, template +- assert_kind_of Tilt::ErubisTemplate, template +- assert_kind_of ::Erubis::FastEruby, template.instance_variable_get('@engine') ++ assert_kind_of Tilt::ErubiTemplate, template ++ assert_kind_of ::Erubi::Engine, template.instance_variable_get('@engine') + assert_equal %(block_#{node_name}.html.erb), File.basename(selected.templates[node_name].file) + end + end +diff --git a/test/invoker_test.rb b/test/invoker_test.rb +index 079781e7f..c1c8d1baf 100644 +--- a/test/invoker_test.rb ++++ b/test/invoker_test.rb +@@ -673,9 +673,9 @@ + end + + test 'should set eRuby impl if specified' do +- invoker = invoke_cli_to_buffer %w(--eruby erubis -o /dev/null) ++ invoker = invoke_cli_to_buffer %w(--eruby erubi -o /dev/null) + doc = invoker.document +- assert_equal 'erubis', doc.instance_variable_get('@options')[:eruby] ++ assert_equal 'erubi', doc.instance_variable_get('@options')[:eruby] + end + + test 'should force default external encoding to UTF-8' do diff --git a/rubygem-asciidoctor.rpmlintrc b/rubygem-asciidoctor.rpmlintrc new file mode 100644 index 0000000..49fecec --- /dev/null +++ b/rubygem-asciidoctor.rpmlintrc @@ -0,0 +1,7 @@ +from Config import * + +# the dictionary is a bit limited +addFilter("rubygem-asciidoctor\..*: W: spelling-error %description -l en_US toolchain") + +# the asciidoctor-safe command is removed upstream for the next major release +addFilter("rubygem-asciidoctor\..*: W: no-manual-page-for-binary asciidoctor-safe") diff --git a/rubygem-asciidoctor.spec b/rubygem-asciidoctor.spec new file mode 100644 index 0000000..d93a6b8 --- /dev/null +++ b/rubygem-asciidoctor.spec @@ -0,0 +1,235 @@ +%global gem_name asciidoctor +%global mandir %{_mandir}/man1 + +%define pre %nil +%global gittag v%{version}%{pre} + +Summary: A fast, open source AsciiDoc implementation in Ruby +Name: rubygem-%{gem_name} +Version: 2.0.10 +Release: 4%{?dist} +License: MIT +URL: https://asciidoctor.org +Source0: https://github.com/asciidoctor/asciidoctor/archive/%{gittag}/%{gem_name}-%{version}%{pre}.tar.gz +# Add support for erubi template engine; use it in place of erubis in test suite. +# https://github.com/asciidoctor/asciidoctor/pull/3738 +Patch0: rubygem-asciidoctor-2.0.11-add-support-for-erubi-template-engine.patch +%if 0%{?el7} +Requires: ruby(release) +BuildRequires: ruby(release) +%endif +%if 0%{?el6} +Requires: ruby(rubygems) +Requires: ruby(abi) = 1.8 +BuildRequires: ruby(abi) = 1.8 +%endif +BuildRequires: rubygems-devel +BuildRequires: ruby(rubygems) +%if 0%{?el6} || 0%{?el7} +# Dependencies aren't available on EPEL +%else +BuildRequires: rubygem(coderay) +BuildRequires: rubygem(concurrent-ruby) +BuildRequires: rubygem(erubi) +BuildRequires: rubygem(haml) +BuildRequires: rubygem(minitest) +BuildRequires: rubygem(nokogiri) +BuildRequires: rubygem(rouge) +BuildRequires: rubygem(slim) +BuildRequires: rubygem(tilt) +%endif +BuildArch: noarch +Provides: asciidoctor = %{version} +%if 0%{?el6} || 0%{?el7} +Provides: rubygem(%{gem_name}) = %{version} +%endif + +%if %{?pre:1} +%global gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}%{pre} +%global gem_cache %{gem_dir}/cache/%{gem_name}-%{version}%{pre}.gem +%global gem_spec %{gem_dir}/specifications/%{gem_name}-%{version}%{pre}.gemspec +%global gem_docdir %{gem_dir}/doc/%{gem_name}-%{version}%{pre} +%endif + +%description +A fast, open source text processor and publishing toolchain, written in Ruby, +for transforming AsciiDoc markup into HTML 5, DocBook 4.5, DocBook 5.0 and +custom output formats. The transformation from AsciiDoc to custom output +formats is performed by running the nodes in the parsed document tree through a +collection of templates written in a template language supported by Tilt. + +%package doc +Summary: Documentation for %{name} +Requires: %{name} = %{version}-%{release} +BuildArch: noarch + +%description doc +Documentation for %{name} + +%prep +%autosetup -n %{gem_name}-%{version}%{pre} -p1 + +# Include tests in the gem, they're disabled by default +sed -i -e 's/#\(s\.test_files\)/\1/' %{gem_name}.gemspec + +# Fix shebang (avoid Requires: /usr/bin/env) +sed -i -e 's|#!/usr/bin/env ruby|#!/usr/bin/ruby|' bin/%{gem_name} + +%build +gem build %{gem_name}.gemspec +%gem_install -n %{gem_name}-%{version}%{pre}.gem + +%check +pushd .%{gem_instdir} + +%if 0%{?el6} || 0%{?el7} +# Asciidoctor tests require Minitest 5, so we can't run them on EPEL +%else +LANG=C.UTF-8 ruby -I"lib:test" -e 'Dir.glob "./test/**/*_test.rb", &method(:require)' +%endif +popd + +%install +mkdir -p %{buildroot}%{gem_dir} +cp -a .%{gem_dir}/* \ + %{buildroot}%{gem_dir}/ + +mkdir -p %{buildroot}%{_bindir} +cp -a .%{_bindir}/* \ + %{buildroot}%{_bindir}/ + +mkdir -p %{buildroot}%{mandir} +cp -a .%{gem_instdir}/man/*.1 \ + %{buildroot}%{mandir}/ + +%files +%{!?_licensedir:%global license %%doc} +%dir %{gem_instdir} +%exclude %{gem_cache} +%exclude %{gem_instdir}/asciidoctor.gemspec +%exclude %{gem_instdir}/man +%exclude %{gem_instdir}/test +%exclude %{gem_instdir}/features +%license %{gem_instdir}/LICENSE +%doc %{gem_instdir}/CHANGELOG.adoc +%doc %{gem_instdir}/README.* +%lang(de) %doc %{gem_instdir}/README-de.* +%lang(fr) %doc %{gem_instdir}/README-fr.* +%lang(ja) %doc %{gem_instdir}/README-jp.* +%lang(zh_CN) %doc %{gem_instdir}/README-zh_CN.* +%{gem_instdir}/data +%{_bindir}/* +%{gem_instdir}/bin +%{gem_libdir} +%{mandir}/* +%{gem_spec} + +%files doc +%doc %{gem_docdir} + +%changelog +* Wed Aug 19 2020 Vít Ondruch - 2.0.10-4 +- Replace build time Erubis dependency by Erubi. + +* Wed Jul 29 2020 Fedora Release Engineering - 2.0.10-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Thu Jan 30 2020 Fedora Release Engineering - 2.0.10-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Sun Sep 22 2019 Todd Zullinger - 2.0.10-1 +- Update to Asciidoctor 2.0.10 + +* Fri Jul 26 2019 Fedora Release Engineering - 1.5.8-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Tue Mar 19 2019 Todd Zullinger - 1.5.8-1 +- Update to Asciidoctor 1.5.8 (resolves CVE-2018-18385) + +* Sat Feb 02 2019 Fedora Release Engineering - 1.5.6.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Sun Nov 18 2018 Zbigniew Jędrzejewski-Szmek - 1.5.6.1-5 +- Use C.UTF-8 locale + See https://fedoraproject.org/wiki/Changes/Remove_glibc-langpacks-all_from_buildroot + +* Sat Jul 14 2018 Fedora Release Engineering - 1.5.6.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed May 23 2018 Vít Ondruch - 1.5.6.1-3 +- Enable entire test suite. + +* Fri Feb 09 2018 Fedora Release Engineering - 1.5.6.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Aug 24 2017 Fabio Alessandro Locati - 1.5.6.1-1 +- Update to Asciidoctor 1.5.6.1 + +* Thu Jul 27 2017 Fedora Release Engineering - 1.5.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Mon Jun 05 2017 Vít Ondruch - 1.5.5-2 +- Fix FTBFS. + +* Sat Feb 11 2017 Fedora Release Engineering - 1.5.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Fri Oct 14 2016 Fabio Alessandro Locati - 1.5.5-1 +- Update to Asciidoctor 1.5.5 + +* Thu Feb 04 2016 Fedora Release Engineering - 1.5.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Tue Jan 05 2016 Ken Dreyer - 1.5.4-1 +- Update to Asciidoctor 1.5.4 (rhbz#1295758) +- Use %%license macro +- Drop unnecessary "-p" flag to cp during %%install ("-a" already preserves + timestamps) + +* Mon Nov 02 2015 Ken Dreyer - 1.5.3-1 +- Update to Asciidoctor 1.5.3 (rhbz#1276851) +- Drop Fedora 19 and 20 macros (these distros are EOL) + +* Thu Jun 18 2015 Fedora Release Engineering - 1.5.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Fri Dec 05 2014 Ken Dreyer - 1.5.2-1 +- Update to Asciidoctor 1.5.2 + +* Fri Sep 19 2014 Ken Dreyer - 1.5.1-1 +- Update to Asciidoctor 1.5.1 + +* Tue Sep 09 2014 Ken Dreyer - 1.5.0-1 +- Update to Asciidoctor 1.5.0 final + +* Fri Jun 06 2014 Ken Dreyer - 1.5.0-0.4.preview.7 +- Add %%{version} number to Provides: asciidoctor + +* Fri Jun 06 2014 Ken Dreyer - 1.5.0-0.3.preview.7 +- Provide: asciidoctor + https://github.com/asciidoctor/rubygem-asciidoctor-rpm/issues/5 + +* Tue May 20 2014 Ken Dreyer - 1.5.0-0.2.preview.7 +- Update to Asciidoctor 0.1.5.preview.7 +- Drop unused patch + +* Thu May 15 2014 Ken Dreyer - 1.5.0-0.1.preview.6 +- Update to Asciidoctor 0.1.5.preview.6 +- Use HTTPS URLs +- Support Minitest 5 +- Adjustments for https://fedoraproject.org/wiki/Changes/Ruby_2.1 +- Mark CHANGELOG, LICENSE, READMEs as %%doc +- Remove Rakefile in %%prep +- Remove Requires: /usr/bin/env + +* Sun Sep 22 2013 Dan Allen - 0.1.4-1 +- Update to Asciidoctor 0.1.4 + +* Sun Aug 04 2013 Fedora Release Engineering - 0.1.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Sat Jun 08 2013 Dan Allen - 0.1.3-1 +- Update to Asciidoctor 0.1.3 + +* Fri Mar 01 2013 Dan Allen - 0.1.1-1 +- Initial package diff --git a/sources b/sources new file mode 100644 index 0000000..a3731a7 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (asciidoctor-2.0.10.tar.gz) = 9ef908081569188d9903c7a7619fe0b50197f6f0cc922c4070e116bcd3f988a55da87443e84b6e260aabcc653a804fcaf29b96a722ab36f7ebb27ec11eb7ddbe diff --git a/test-install b/test-install new file mode 100755 index 0000000..9dc3ff2 --- /dev/null +++ b/test-install @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby + +# A sanity check to ensure that gem is functional after installing the package. + +require 'asciidoctor' + +source = < + +http://asciidoctor.org[Asciidoctor] is an _open source_ implementation of +http://asciidoc.org[AsciiDoc] in [.red]*Ruby*. + +== Sample section + +Sample section content +EOS + +puts Asciidoctor.render(source, :backend => :html5, :header_footer => true, :safe => :safe, :attributes => 'idprefix= idseparator=-')