diff --git a/Fix-warning-when-using-yield-in-templates-on-ruby-2.7.patch b/Fix-warning-when-using-yield-in-templates-on-ruby-2.7.patch deleted file mode 100644 index 379f02e87a0c60d850a2ae86d3968f619593f13d..0000000000000000000000000000000000000000 --- a/Fix-warning-when-using-yield-in-templates-on-ruby-2.7.patch +++ /dev/null @@ -1,75 +0,0 @@ -From dbb4df94e5bc6e533fc2ed09b2fd70df39c049c3 Mon Sep 17 00:00:00 2001 -From: Jeremy Evans -Date: Fri, 31 May 2019 09:58:55 -0700 -Subject: [PATCH] Fix warning when using yield in templates on ruby 2.7 - -Take the class of the scope, and pass it through the -compilation methods. Call class_eval on the scope's -class so that constant lookup works, and switch the -singleton class opening to instance_exec. - -This radically simplifies the compiled template method -code, and I would guess it speeds it up significantly -as well. However, this approach can cause a memory -leak if you are creating anonymous classes at runtime -and then passing instances of those classes as the scope -of the render. ---- - lib/tilt/template.rb | 19 +++++++------------ - 1 file changed, 7 insertions(+), 12 deletions(-) - -diff --git a/lib/tilt/template.rb b/lib/tilt/template.rb -index 604ed47..13d08ff 100644 ---- a/lib/tilt/template.rb -+++ b/lib/tilt/template.rb -@@ -166,7 +166,7 @@ def prepare - def evaluate(scope, locals, &block) - locals_keys = locals.keys - locals_keys.sort!{|x, y| x.to_s <=> y.to_s} -- method = compiled_method(locals_keys) -+ method = compiled_method(locals_keys, scope.class) - method.bind(scope).call(locals, &block) - end - -@@ -231,9 +231,9 @@ def read_template_file - end - - # The compiled method for the locals keys provided. -- def compiled_method(locals_keys) -+ def compiled_method(locals_keys, scope_class=nil) - LOCK.synchronize do -- @compiled_method[locals_keys] ||= compile_template_method(locals_keys) -+ @compiled_method[[scope_class, locals_keys]] ||= compile_template_method(locals_keys, scope_class) - end - end - -@@ -247,7 +247,7 @@ def local_extraction(local_keys) - end.join("\n") - end - -- def compile_template_method(local_keys) -+ def compile_template_method(local_keys, scope_class=nil) - source, offset = precompiled(local_keys) - local_code = local_extraction(local_keys) - -@@ -261,17 +261,12 @@ def compile_template_method(local_keys) - method_source << <<-RUBY - TOPOBJECT.class_eval do - def #{method_name}(locals) -- Thread.current[:tilt_vars] = [self, locals] -- class << self -- this, locals = Thread.current[:tilt_vars] -- locals = locals -- this.instance_eval do -- #{local_code} -+ #{local_code} - RUBY - offset += method_source.count("\n") - method_source << source -- method_source << "\nend;end;end;end" -- Object.class_eval(method_source, eval_file, line - offset) -+ method_source << "\nend;end;" -+ (scope_class || Object).class_eval(method_source, eval_file, line - offset) - unbind_compiled_method(method_name) - end - diff --git a/rubygem-tilt-2.0.11-Chomp-newline-in-sass-tests.patch b/rubygem-tilt-2.0.11-Chomp-newline-in-sass-tests.patch new file mode 100644 index 0000000000000000000000000000000000000000..d131ce71cd67ba5ff711ba80a11fc0d16b85871b --- /dev/null +++ b/rubygem-tilt-2.0.11-Chomp-newline-in-sass-tests.patch @@ -0,0 +1,47 @@ +From 20b6424425037adf2029bba2e86f0d1b3c007251 Mon Sep 17 00:00:00 2001 +From: Jeremy Evans +Date: Thu, 4 Aug 2022 11:01:45 -0700 +Subject: [PATCH] Chomp newline in sass tests + +In my environment these fail due to render returning a string ending +with a newline. Since the newline doesn't cause any problems in +CSS, I don't think we should force remove it in the template engine. +It seems acceptable to allow output both with and without a newline. +--- + test/tilt_sasstemplate_test.rb | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/test/tilt_sasstemplate_test.rb b/test/tilt_sasstemplate_test.rb +index 280b5b5..17ab3c3 100644 +--- a/test/tilt_sasstemplate_test.rb ++++ b/test/tilt_sasstemplate_test.rb +@@ -11,12 +11,12 @@ class SassTemplateTest < Minitest::Test + + test "compiles and evaluates the template on #render" do + template = Tilt::SassTemplate.new({ style: :compressed }) { |t| "#main\n background-color: #0000f1" } +- assert_equal "#main{background-color:#0000f1}", template.render ++ assert_equal "#main{background-color:#0000f1}", template.render.chomp + end + + test "can be rendered more than once" do + template = Tilt::SassTemplate.new({ style: :compressed }) { |t| "#main\n background-color: #0000f1" } +- 3.times { assert_equal "#main{background-color:#0000f1}", template.render } ++ 3.times { assert_equal "#main{background-color:#0000f1}", template.render.chomp } + end + end + +@@ -27,12 +27,12 @@ class ScssTemplateTest < Minitest::Test + + test "compiles and evaluates the template on #render" do + template = Tilt::ScssTemplate.new({ style: :compressed }) { |t| "#main {\n background-color: #0000f1;\n}" } +- assert_equal "#main{background-color:#0000f1}", template.render ++ assert_equal "#main{background-color:#0000f1}", template.render.chomp + end + + test "can be rendered more than once" do + template = Tilt::ScssTemplate.new({ style: :compressed }) { |t| "#main {\n background-color: #0000f1;\n}" } +- 3.times { assert_equal "#main{background-color:#0000f1}", template.render } ++ 3.times { assert_equal "#main{background-color:#0000f1}", template.render.chomp } + end + end + diff --git a/rubygem-tilt-2.0.11-Remove-use-of-Bundler-setup.patch b/rubygem-tilt-2.0.11-Remove-use-of-Bundler-setup.patch new file mode 100644 index 0000000000000000000000000000000000000000..250cab0f1025b0216ec0bb47ead725cd755a7a1c --- /dev/null +++ b/rubygem-tilt-2.0.11-Remove-use-of-Bundler-setup.patch @@ -0,0 +1,32 @@ +From 66e702813b4fef3951dff941b4778b595929e092 Mon Sep 17 00:00:00 2001 +From: Jeremy Evans +Date: Thu, 4 Aug 2022 10:33:16 -0700 +Subject: [PATCH] Remove use of Bundler.setup + +If use of bundler is desired, bundle exec should be used. This +is already done in CI. + +With the current setup, I cannot even run rake -T to see available +tasks without installing gems. When running tests for one engine, +I should not need to install tests for other engines I'm not using. + +All template engine tests already have checks for whether the +engine is installed, and if the engine is not available, it prints +a useful message and skips the tests for that engine. +--- + test/test_helper.rb | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/test/test_helper.rb b/test/test_helper.rb +index 43c685c..05078e2 100644 +--- a/test/test_helper.rb ++++ b/test/test_helper.rb +@@ -1,8 +1,5 @@ + $LOAD_PATH << File.expand_path('../../lib', __FILE__) + +-require 'bundler' +-Bundler.setup +- + require 'minitest/autorun' + require 'minitest/mock' + diff --git a/rubygem-tilt.spec b/rubygem-tilt.spec index 3ce649322e5188b287a048eb4760cf5722444f8a..2f54f00154a6b089cb5de227c4da38adbe77d2a3 100644 --- a/rubygem-tilt.spec +++ b/rubygem-tilt.spec @@ -1,14 +1,18 @@ %global gem_name tilt %{?_with_bootstrap: %global bootstrap 1} Name: rubygem-%{gem_name} -Version: 2.0.8 -Release: 5 +Version: 2.0.11 +Release: 1 Summary: Generic interface to multiple Ruby template engines License: MIT URL: http://github.com/rtomayko/tilt Source0: https://rubygems.org/gems/tilt-%{version}.gem -Patch0: tilt-2.0.10-Fix-Ruby-3.0-compatibility.patch -Patch1: Fix-warning-when-using-yield-in-templates-on-ruby-2.7.patch +Source1: %{gem_name}-%{version}-man.tar.gz +Source2: %{gem_name}-%{version}-test.tar.gz +Patch0: rubygem-tilt-2.0.11-Remove-use-of-Bundler-setup.patch +Patch1: rubygem-tilt-2.0.11-Chomp-newline-in-sass-tests.patch + + BuildRequires: ruby(release) rubygems-devel ruby nodejs-devel rubygem(creole) BuildRequires: rubygem(minitest) rubygem(nokogiri) rubygem(erubi) rubygem(builder) BuildRequires: rubygem(maruku) rubygem(RedCloth) rubygem(redcarpet) rubygem(coffee-script) @@ -32,15 +36,16 @@ Obsoletes: %{name}-doc < %{version}-%{release} Documentation for %{name}. %prep -%setup -q -c -T -%gem_install -n %{SOURCE0} -cd .%{gem_instdir} +%setup -q -n %{gem_name}-%{version} -b 1 -b 2 + +pushd %{_builddir} %patch0 -p1 %patch1 -p1 -cd - -sed -i -e 's|/usr/bin/env ruby|/usr/bin/ruby|' .%{gem_instdir}/bin/tilt +popd + %build +sed -i -e 's|/usr/bin/env ruby|/usr/bin/ruby|' .%{gem_instdir}/bin/tilt %install mkdir -p %{buildroot}%{gem_dir} @@ -49,49 +54,42 @@ cp -a .%{gem_dir}/* \ mkdir -p %{buildroot}%{_bindir} cp -a .%{_bindir}/* \ %{buildroot}%{_bindir}/ -pushd %{buildroot}%{gem_instdir} + +sed -i -e 's|/usr/bin/env ruby|/usr/bin/ruby|' %{buildroot}%{gem_instdir}/bin/tilt + +pushd %{buildroot} ronn --manual="Tilt Manual" --organization="Tilt %{version}" -r man/*.ronn mkdir -p %{buildroot}%{_mandir}/man1 mv man/*.1 %{buildroot}%{_mandir}/man1 popd find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x + +%if %{without bootstrap} %check -%if ! 0%{?bootstrap} pushd .%{gem_instdir} -sed -i '/[Bb]undler/ s/^/#/' test/test_helper.rb -#DocBook 4.5 has been removed since AsciiDoctor 2.0.0. -#htps://github.com/asciidoctor/asciidoctor/issues/3005 -sed -i '/docbook 4.5/a\ skip' test/tilt_asciidoctor_test.rb +ln -s %{_builddir}/test test + LANG=C.UTF-8 ruby -Ilib:test -e 'Dir.glob "./test/**/*_test.rb", &method(:require)' popd %endif %files %dir %{gem_instdir} -%{_bindir}/%{gem_name} +%{_bindir}/tilt %license %{gem_instdir}/COPYING -%exclude %{gem_instdir}/%{gem_name}.gemspec -%exclude %{gem_instdir}/.* -%exclude %{gem_instdir}/Gemfile %{gem_instdir}/bin %{gem_libdir} -%doc %{gem_instdir}/README.md -%exclude %{gem_instdir}/man %exclude %{gem_cache} %{gem_spec} %doc %{_mandir}/man1/* -%files help -%doc %{gem_docdir} -%doc %{gem_instdir}/CHANGELOG.md -%doc %{gem_instdir}/HACKING -%{gem_instdir}/Rakefile -%doc %{gem_instdir}/docs -%{gem_instdir}/test %changelog -* Tue Jan 10 liyanan - 2.0.8-5 +* Fri Aug 11 2023 bixiaoyan - 2.0.11-1 +- Update version to 2.0.11-1 + +* Tue Jan 10 2023 liyanan - 2.0.8-5 - Use Erubi instead of Erubis * Wed Feb 9 2022 liyanan - 2.0.8-4 diff --git a/tilt-2.0.10-Fix-Ruby-3.0-compatibility.patch b/tilt-2.0.10-Fix-Ruby-3.0-compatibility.patch deleted file mode 100644 index 3f8a9c53e91cad688a405e4df5418ceaf94fc042..0000000000000000000000000000000000000000 --- a/tilt-2.0.10-Fix-Ruby-3.0-compatibility.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 7c7d7d2101ca4b5c6c887f65a7be9b81982f3fa6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?V=C3=ADt=20Ondruch?= -Date: Mon, 18 Jan 2021 12:49:31 +0100 -Subject: [PATCH] Fix Ruby 3.0 compatibility. - -This fixes issues such as: - -~~~ - 1) Error: -CSVTemplateTest#test_compiles_and_evaluates_the_template_on_render: -TypeError: no implicit conversion of Hash into String - /usr/share/ruby/csv.rb:1273:in `initialize' - /usr/share/ruby/csv.rb:1273:in `new' - /usr/share/ruby/csv.rb:1273:in `generate' - (__TEMPLATE__):in `__tilt_920' - /builddir/build/BUILD/tilt-2.0.10/usr/share/gems/gems/tilt-2.0.10/lib/tilt/template.rb:170:in `call' - /builddir/build/BUILD/tilt-2.0.10/usr/share/gems/gems/tilt-2.0.10/lib/tilt/template.rb:170:in `evaluate' - /builddir/build/BUILD/tilt-2.0.10/usr/share/gems/gems/tilt-2.0.10/lib/tilt/template.rb:109:in `render' - /builddir/build/BUILD/tilt-2.0.10/usr/share/gems/gems/tilt-2.0.10/test/tilt_csv_test.rb:15:in `block in ' -~~~ ---- - lib/tilt/csv.rb | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/tilt/csv.rb b/lib/tilt/csv.rb -index fd0e602..7dfa220 100644 ---- a/lib/tilt/csv.rb -+++ b/lib/tilt/csv.rb -@@ -50,7 +50,7 @@ module Tilt - - def precompiled_template(locals) - <<-RUBY -- #{@outvar} = #{self.class.engine}.generate(#{options}) do |csv| -+ #{@outvar} = #{self.class.engine}.generate(**#{options}) do |csv| - #{data} - end - RUBY --- -2.29.2 - diff --git a/tilt-2.0.11-man.tar.gz b/tilt-2.0.11-man.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..943972bee0298243576cd35ebf9cc3765bd1e69c Binary files /dev/null and b/tilt-2.0.11-man.tar.gz differ diff --git a/tilt-2.0.11-test.tar.gz b/tilt-2.0.11-test.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..17e8fdcfe84a86013ff2a6639735685dab554bb7 Binary files /dev/null and b/tilt-2.0.11-test.tar.gz differ diff --git a/tilt-2.0.11.gem b/tilt-2.0.11.gem new file mode 100644 index 0000000000000000000000000000000000000000..fe1fe51515536944f809c6dea490423c4553bc37 Binary files /dev/null and b/tilt-2.0.11.gem differ diff --git a/tilt-2.0.8.gem b/tilt-2.0.8.gem deleted file mode 100644 index 3f0db7c34951f581ac1657654614500da8e3d0bd..0000000000000000000000000000000000000000 Binary files a/tilt-2.0.8.gem and /dev/null differ