Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package rubygem-erubi for openSUSE:Factory 
checked in at 2022-08-07 18:33:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-erubi (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-erubi.new.1521 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-erubi"

Sun Aug  7 18:33:49 2022 rev:7 rq:993478 version:1.11.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-erubi/rubygem-erubi.changes      
2020-12-11 20:16:20.344650280 +0100
+++ /work/SRC/openSUSE:Factory/.rubygem-erubi.new.1521/rubygem-erubi.changes    
2022-08-07 18:33:54.345148660 +0200
@@ -1,0 +2,15 @@
+Thu Aug  4 13:08:31 UTC 2022 - Stephan Kulow <[email protected]>
+
+updated to version 1.11.0
+ see installed CHANGELOG
+
+  === 1.11.0 (2022-08-02)
+  
+  * Support :freeze_template_literals option for configuring whether to add 
.freeze to template literal strings (casperisfine) (#33)
+  
+  * Support :chain_appends option for chaining appends to the buffer variable 
(casperisfine, jeremyevans) (#32)
+  
+  * Avoid unnecessary defined? usage on Ruby 3+ when using the :ensure option 
(jeremyevans)
+  
+
+-------------------------------------------------------------------

Old:
----
  erubi-1.10.0.gem

New:
----
  erubi-1.11.0.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-erubi.spec ++++++
--- /var/tmp/diff_new_pack.NKEtBW/_old  2022-08-07 18:33:55.221151206 +0200
+++ /var/tmp/diff_new_pack.NKEtBW/_new  2022-08-07 18:33:55.225151218 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-erubi
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-erubi
-Version:        1.10.0
+Version:        1.11.0
 Release:        0
 %define mod_name erubi
 %define mod_full_name %{mod_name}-%{version}

++++++ erubi-1.10.0.gem -> erubi-1.11.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG new/CHANGELOG
--- old/CHANGELOG       2020-11-13 22:39:58.000000000 +0100
+++ new/CHANGELOG       2022-08-02 17:40:35.000000000 +0200
@@ -1,3 +1,11 @@
+=== 1.11.0 (2022-08-02)
+
+* Support :freeze_template_literals option for configuring whether to add 
.freeze to template literal strings (casperisfine) (#33)
+
+* Support :chain_appends option for chaining appends to the buffer variable 
(casperisfine, jeremyevans) (#32)
+
+* Avoid unnecessary defined? usage on Ruby 3+ when using the :ensure option 
(jeremyevans)
+
 === 1.10.0 (2020-11-13)
 
 * Improve template parsing, mostly by reducing allocations (jeremyevans)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MIT-LICENSE new/MIT-LICENSE
--- old/MIT-LICENSE     2020-11-13 22:39:58.000000000 +0100
+++ new/MIT-LICENSE     2022-08-02 17:40:35.000000000 +0200
@@ -1,5 +1,5 @@
 copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
-copyright(c) 2016-2020 Jeremy Evans
+copyright(c) 2016-2021 Jeremy Evans
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Rakefile new/Rakefile
--- old/Rakefile        2020-11-13 22:39:58.000000000 +0100
+++ new/Rakefile        2022-08-02 17:40:35.000000000 +0200
@@ -42,7 +42,7 @@
 
 spec = proc do |env|
   env.each{|k,v| ENV[k] = v}
-  sh "#{FileUtils::RUBY} test/test.rb"
+  sh "#{FileUtils::RUBY} #{'-w' if RUBY_VERSION >= '3'} test/test.rb"
   env.each{|k,v| ENV.delete(k)}
 end
 
@@ -57,11 +57,6 @@
 task "spec_cov" do
   spec.call('COVERAGE'=>'1')
 end
-  
-desc "Run specs with -w, some warnings filtered"
-task "spec_w" do
-  sh "#{FileUtils::RUBY} test/test_w.rb"
-end
 
 ### Other
 
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/erubi/capture_end.rb new/lib/erubi/capture_end.rb
--- old/lib/erubi/capture_end.rb        2020-11-13 22:39:58.000000000 +0100
+++ new/lib/erubi/capture_end.rb        2022-08-02 17:40:35.000000000 +0200
@@ -36,13 +36,19 @@
         rspace = nil if tailch && !tailch.empty?
         add_text(lspace) if lspace
         escape_capture = !((indicator == '|=') ^ @escape_capture)
-        src << "begin; (#{@bufstack} ||= []) << #{@bufvar}; #{@bufvar} = 
#{@bufval}; #{@bufstack}.last << #{@escapefunc if escape_capture}((" << code
+        terminate_expression
+        @src << "begin; (#{@bufstack} ||= []) << #{@bufvar}; #{@bufvar} = 
#{@bufval}; #{@bufstack}.last << #{@escapefunc if escape_capture}((" << code
+        @buffer_on_stack = false
         add_text(rspace) if rspace
       when '|'
         rspace = nil if tailch && !tailch.empty?
         add_text(lspace) if lspace
-        result = @yield_returns_buffer ? " #{@bufvar}; " : ""
-        src << result << code << ")).to_s; ensure; #{@bufvar} = 
#{@bufstack}.pop; end;"
+        if @yield_returns_buffer
+          terminate_expression
+          @src << " #{@bufvar}; "
+        end
+        @src << code << ")).to_s; ensure; #{@bufvar} = #{@bufstack}.pop; end;"
+        @buffer_on_stack = false
         add_text(rspace) if rspace
       else
         super
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/erubi.rb new/lib/erubi.rb
--- old/lib/erubi.rb    2020-11-13 22:39:58.000000000 +0100
+++ new/lib/erubi.rb    2022-08-02 17:40:35.000000000 +0200
@@ -1,8 +1,7 @@
 # frozen_string_literal: true
 
 module Erubi
-  VERSION = '1.10.0'
-  RANGE_ALL = 0..-1
+  VERSION = '1.11.0'
 
   # :nocov:
   if RUBY_VERSION >= '1.9'
@@ -13,8 +12,8 @@
     RANGE_LAST = -1..-1
   end
 
-  TEXT_END = RUBY_VERSION >= '2.1' ? "'.freeze;" : "';"
   MATCH_METHOD = RUBY_VERSION >= '2.4' ? :match? : :match
+  SKIP_DEFINED_FOR_INSTANCE_VARIABLE = RUBY_VERSION > '3'
   # :nocov:
 
   begin
@@ -45,6 +44,9 @@
   end
 
   class Engine
+    # The default regular expression used for scanning.
+    DEFAULT_REGEXP = /<%(={1,2}|-|\#|%)?(.*?)([-=])?%>([ \t]*\r?\n)?/m
+    
     # The frozen ruby source code generated from the template, which can be 
evaled.
     attr_reader :src
 
@@ -57,12 +59,22 @@
     # Initialize a new Erubi::Engine.  Options:
     # +:bufval+ :: The value to use for the buffer variable, as a string 
(default <tt>'::String.new'</tt>).
     # +:bufvar+ :: The variable name to use for the buffer variable, as a 
string.
+    # +:chain_appends+ :: Whether to chain <tt><<</t> calls to the buffer 
variable. Offers better
+    #                     performance, but can cause issues when the buffer 
variable is reassigned during
+    #                     template rendering (default +false+).
     # +:ensure+ :: Wrap the template in a begin/ensure block restoring the 
previous value of bufvar.
     # +:escapefunc+ :: The function to use for escaping, as a string (default: 
<tt>'::Erubi.h'</tt>).
     # +:escape+ :: Whether to make <tt><%=</tt> escape by default, and 
<tt><%==</tt> not escape by default.
     # +:escape_html+ :: Same as +:escape+, with lower priority.
     # +:filename+ :: The filename for the template.
-    # +:freeze+ :: Whether to enable frozen string literals in the resulting 
source code.
+    # +:freeze+ :: Whether to enable add a <tt>frozen_string_literal: 
true</tt> magic comment at the top of
+    #              the resulting source code.  Note this may cause problems if 
you are wrapping the resulting
+    #              source code in other code, because the magic comment only 
has an effect at the beginning of
+    #              the file, and having the magic comment later in the file 
can trigger warnings.
+    # +:freeze_template_literals+ :: Whether to suffix all literal strings for 
template code with <tt>.freeze</tt>
+    #                                (default: +true+ on Ruby 2.1+, +false+ on 
Ruby 2.0 and older).
+    #                                Can be set to +false+ on Ruby 2.3+ when 
frozen string literals are enabled
+    #                                in order to improve performance.
     # +:literal_prefix+ :: The prefix to output when using escaped tag 
delimiters (default <tt>'<%'</tt>).
     # +:literal_postfix+ :: The postfix to output when using escaped tag 
delimiters (default <tt>'%>'</tt>).
     # +:outvar+ :: Same as +:bufvar+, with lower priority.
@@ -77,20 +89,34 @@
       @filename  = properties[:filename]
       @bufvar = bufvar = properties[:bufvar] || properties[:outvar] || "_buf"
       bufval = properties[:bufval] || '::String.new'
-      regexp = properties[:regexp] || /<%(={1,2}|-|\#|%)?(.*?)([-=])?%>([ 
\t]*\r?\n)?/m
+      regexp = properties[:regexp] || DEFAULT_REGEXP
       literal_prefix = properties[:literal_prefix] || '<%'
       literal_postfix = properties[:literal_postfix] || '%>'
       preamble   = properties[:preamble] || "#{bufvar} = #{bufval};"
       postamble  = properties[:postamble] || "#{bufvar}.to_s\n"
+      @chain_appends = properties[:chain_appends]
+      @text_end = if properties.fetch(:freeze_template_literals, RUBY_VERSION 
>= '2.1')
+        "'.freeze"
+      else
+        "'"
+      end
 
+      @buffer_on_stack = false
       @src = src = properties[:src] || String.new
       src << "# frozen_string_literal: true\n" if properties[:freeze]
-      src << "begin; __original_outvar = #{bufvar} if defined?(#{bufvar}); " 
if properties[:ensure]
+      if properties[:ensure]
+        src << "begin; __original_outvar = #{bufvar}"
+        if SKIP_DEFINED_FOR_INSTANCE_VARIABLE && /\A@[^@]/ =~ bufvar
+          src << "; "
+        else
+          src << " if defined?(#{bufvar}); "
+        end
+      end
 
       unless @escapefunc = properties[:escapefunc]
         if escape
           @escapefunc = '__erubi.h'
-          src << "__erubi = ::Erubi;"
+          src << "__erubi = ::Erubi; "
         else
           @escapefunc = '::Erubi.h'
         end
@@ -184,13 +210,16 @@
       else
         text.gsub!(/['\\]/, '\\\\\&')
       end
-      @src << " " << @bufvar << " << '" << text << TEXT_END
+
+      with_buffer{@src << " << '" << text << @text_end}
     end
 
     # Add ruby code to the template
     def add_code(code)
+      terminate_expression
       @src << code
       @src << ';' unless code[RANGE_LAST] == "\n"
+      @buffer_on_stack = false
     end
 
     # Add the given ruby expression result to the template,
@@ -205,23 +234,52 @@
 
     # Add the result of Ruby expression to the template
     def add_expression_result(code)
-      @src << ' ' << @bufvar << ' << (' << code << ').to_s;'
+      with_buffer{@src << ' << (' << code << ').to_s'}
     end
 
     # Add the escaped result of Ruby expression to the template
     def add_expression_result_escaped(code)
-      @src << ' ' << @bufvar << ' << ' << @escapefunc << '((' << code << '));'
+      with_buffer{@src << ' << ' << @escapefunc << '((' << code << '))'}
     end
 
     # Add the given postamble to the src.  Can be overridden in subclasses
     # to make additional changes to src that depend on the current state.
     def add_postamble(postamble)
-      src << postamble
+      terminate_expression
+      @src << postamble
     end
 
     # Raise an exception, as the base engine class does not support handling 
other indicators.
     def handle(indicator, code, tailch, rspace, lspace)
       raise ArgumentError, "Invalid indicator: #{indicator}"
     end
+
+    # Make sure the buffer variable is the target of the next append
+    # before yielding to the block. Mark that the buffer is the target
+    # of the next append after the block executes.
+    #
+    # This method should only be called if the block will result in
+    # code where << will append to the bufvar.
+    def with_buffer
+      if @chain_appends
+        unless @buffer_on_stack
+          @src << '; ' << @bufvar
+        end
+        yield
+        @buffer_on_stack = true
+      else
+        @src << ' ' << @bufvar
+        yield
+        @src << ';'
+      end
+    end
+
+    # Make sure that any current expression has been terminated.
+    # The default is to terminate all expressions, but when
+    # the chain_appends option is used, expressions may not be
+    # terminated.
+    def terminate_expression
+      @src << '; ' if @chain_appends
+    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2020-11-13 22:39:58.000000000 +0100
+++ new/metadata        2022-08-02 17:40:35.000000000 +0200
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: erubi
 version: !ruby/object:Gem::Version
-  version: 1.10.0
+  version: 1.11.0
 platform: ruby
 authors:
 - Jeremy Evans
@@ -9,7 +9,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2020-11-13 00:00:00.000000000 Z
+date: 2022-08-02 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: minitest
@@ -83,7 +83,7 @@
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
-rubygems_version: 3.1.4
+rubygems_version: 3.3.7
 signing_key: 
 specification_version: 4
 summary: Small ERB Implementation

Reply via email to