Hello community,

here is the log from the commit of package rubygem-simplecov for 
openSUSE:Factory checked in at 2020-05-11 13:39:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-simplecov (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-simplecov.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-simplecov"

Mon May 11 13:39:45 2020 rev:22 rq:802375 version:0.18.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-simplecov/rubygem-simplecov.changes      
2020-03-07 21:40:06.564347943 +0100
+++ 
/work/SRC/openSUSE:Factory/.rubygem-simplecov.new.2738/rubygem-simplecov.changes
    2020-05-11 13:39:49.288924853 +0200
@@ -1,0 +2,40 @@
+Thu May  7 21:31:35 UTC 2020 - Stephan Kulow <co...@suse.com>
+
+- updated to version 0.18.5
+ see installed CHANGELOG.md
+
+  0.18.5 (2020-02-25)
+  ===================
+  
+  Can you guess? Another bugfix release!
+  
+  ## Bugfixes
+  * minitest won't crash if SimpleCov isn't loaded - aka don't execute 
SimpleCov code in the minitest plugin if SimpleCov isn't loaded. Thanks to 
[@edariedl](https://github.com/edariedl) for the report of the peculiar problem 
in [#877](https://github.com/colszowka/simplecov/issues/877).
+  
+  0.18.4 (2020-02-24)
+  ===================
+  
+  Another small bugfix release 🙈 Fixes SimpleCov running with rspec-rails, 
which was broken due to our fixed minitest integration.
+  
+  ## Bugfixes
+  * SimpleCov will run again correctly when used with rspec-rails. The 
excellent bug report [#873](https://github.com/colszowka/simplecov/issues/873) 
by [@odlp](https://github.com/odlp) perfectly details what went wrong. Thanks 
to [@adam12](https://github.com/adam12) for the fix 
[#874](https://github.com/colszowka/simplecov/pull/874).
+  
+  
+  0.18.3 (2020-02-23)
+  ===========
+  
+  Small bugfix release. It's especially recommended to upgrade simplecov-html 
as well because of bugs in the 0.12.0 release.
+  
+  ## Bugfixes
+  * Fix a regression related to file encodings as special characters were 
missing. Furthermore we now respect the magic `# encoding: ...` comment and 
read files in the right encoding. Thanks ([@Tietew](https://github.com/Tietew)) 
- see [#866](https://github.com/colszowka/simplecov/pull/866)
+  * Use `Minitest.after_run` hook to trigger post-run hooks if `Minitest` is 
present. See [#756](https://github.com/colszowka/simplecov/pull/756) and 
[#855](https://github.com/colszowka/simplecov/pull/855) thanks 
([@adam12](https://github.com/adam12))
+  
+  0.18.2 (2020-02-12)
+  ===================
+  
+  Small release just to allow you to use the new simplecov-html.
+  
+  ## Enhancements
+  * Relax simplecov-html requirement so that you're able to use 
[0.12.0](https://github.com/colszowka/simplecov-html/blob/master/CHANGELOG.md#0120-2020-02-12)
+
+-------------------------------------------------------------------

Old:
----
  simplecov-0.18.1.gem

New:
----
  simplecov-0.18.5.gem

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

Other differences:
------------------
++++++ rubygem-simplecov.spec ++++++
--- /var/tmp/diff_new_pack.WAaxaL/_old  2020-05-11 13:39:50.332927042 +0200
+++ /var/tmp/diff_new_pack.WAaxaL/_new  2020-05-11 13:39:50.332927042 +0200
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-simplecov
-Version:        0.18.1
+Version:        0.18.5
 Release:        0
 %define mod_name simplecov
 %define mod_full_name %{mod_name}-%{version}

++++++ simplecov-0.18.1.gem -> simplecov-0.18.5.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2020-01-31 10:41:43.000000000 +0100
+++ new/CHANGELOG.md    2020-02-25 22:41:26.000000000 +0100
@@ -1,3 +1,37 @@
+0.18.5 (2020-02-25)
+===================
+
+Can you guess? Another bugfix release!
+
+## Bugfixes
+* minitest won't crash if SimpleCov isn't loaded - aka don't execute SimpleCov 
code in the minitest plugin if SimpleCov isn't loaded. Thanks to 
[@edariedl](https://github.com/edariedl) for the report of the peculiar problem 
in [#877](https://github.com/colszowka/simplecov/issues/877).
+
+0.18.4 (2020-02-24)
+===================
+
+Another small bugfix release 🙈 Fixes SimpleCov running with rspec-rails, which 
was broken due to our fixed minitest integration.
+
+## Bugfixes
+* SimpleCov will run again correctly when used with rspec-rails. The excellent 
bug report [#873](https://github.com/colszowka/simplecov/issues/873) by 
[@odlp](https://github.com/odlp) perfectly details what went wrong. Thanks to 
[@adam12](https://github.com/adam12) for the fix 
[#874](https://github.com/colszowka/simplecov/pull/874).
+
+
+0.18.3 (2020-02-23)
+===========
+
+Small bugfix release. It's especially recommended to upgrade simplecov-html as 
well because of bugs in the 0.12.0 release.
+
+## Bugfixes
+* Fix a regression related to file encodings as special characters were 
missing. Furthermore we now respect the magic `# encoding: ...` comment and 
read files in the right encoding. Thanks ([@Tietew](https://github.com/Tietew)) 
- see [#866](https://github.com/colszowka/simplecov/pull/866)
+* Use `Minitest.after_run` hook to trigger post-run hooks if `Minitest` is 
present. See [#756](https://github.com/colszowka/simplecov/pull/756) and 
[#855](https://github.com/colszowka/simplecov/pull/855) thanks 
([@adam12](https://github.com/adam12))
+
+0.18.2 (2020-02-12)
+===================
+
+Small release just to allow you to use the new simplecov-html.
+
+## Enhancements
+* Relax simplecov-html requirement so that you're able to use 
[0.12.0](https://github.com/colszowka/simplecov-html/blob/master/CHANGELOG.md#0120-2020-02-12)
+
 0.18.1 (2020-01-31)
 ===================
 
@@ -25,6 +59,7 @@
 
 ## Noteworthy
 * `FileList` stopped inheriting from Array, it includes Enumerable so if you 
didn't use Array specific methods on it in formatters you should be fine
+* We needed to change an internal file format, which we use for merging across 
processes, to accommodate branch coverage. Sadly CodeClimate chose to use this 
file to report test coverage. Until a resolution is found the code climate test 
reporter won't work with SimpleCov for 0.18+, see [this issue on the test 
reporter](https://github.com/codeclimate/test-reporter/issues/413).
 
 0.18.0.beta3 (2020-01-20)
 ========================
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/minitest/simplecov_plugin.rb 
new/lib/minitest/simplecov_plugin.rb
--- old/lib/minitest/simplecov_plugin.rb        1970-01-01 01:00:00.000000000 
+0100
+++ new/lib/minitest/simplecov_plugin.rb        2020-02-25 22:41:26.000000000 
+0100
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+# How minitest plugins. See https://github.com/colszowka/simplecov/pull/756 
for why we need this.
+# https://github.com/seattlerb/minitest#writing-extensions
+module Minitest
+  def self.plugin_simplecov_init(_options)
+    if defined?(SimpleCov)
+      SimpleCov.external_at_exit = true
+
+      Minitest.after_run do
+        SimpleCov.at_exit_behavior
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/simplecov/combine/branches_combiner.rb 
new/lib/simplecov/combine/branches_combiner.rb
--- old/lib/simplecov/combine/branches_combiner.rb      2020-01-31 
10:41:43.000000000 +0100
+++ new/lib/simplecov/combine/branches_combiner.rb      2020-02-25 
22:41:26.000000000 +0100
@@ -10,9 +10,9 @@
     module_function
 
       #
-      # Return merged branches or the existed branche if other is missing.
+      # Return merged branches or the existed brach if other is missing.
       #
-      # Branches inside files are always same if they exists, the difference 
only in coverage count.
+      # Branches inside files are always same if they exist, the difference 
only in coverage count.
       # Branch coverage report for any conditional case is built from hash, 
it's key is a condition and
       # it's body is a hash << keys from condition and value is coverage rate 
>>.
       # ex: branches =>{ [:if, 3, 8, 6, 8, 36] => {[:then, 4, 8, 6, 8, 12] => 
1, [:else, 5, 8, 6, 8, 36]=>2}, other conditions...}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/simplecov/combine.rb new/lib/simplecov/combine.rb
--- old/lib/simplecov/combine.rb        2020-01-31 10:41:43.000000000 +0100
+++ new/lib/simplecov/combine.rb        2020-02-25 22:41:26.000000000 +0100
@@ -9,8 +9,8 @@
     #
     # Combine two coverage based on the given combiner_module.
     #
-    # Combiners should always be called throught his interface,
-    # as it takes care of short circuting of one of the coverages is nil.
+    # Combiners should always be called through this interface,
+    # as it takes care of short-circuiting of one of the coverages is nil.
     #
     # @return [Hash]
     def combine(combiner_module, coverage_a, coverage_b)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/simplecov/coverage_statistics.rb 
new/lib/simplecov/coverage_statistics.rb
--- old/lib/simplecov/coverage_statistics.rb    2020-01-31 10:41:43.000000000 
+0100
+++ new/lib/simplecov/coverage_statistics.rb    2020-02-25 22:41:26.000000000 
+0100
@@ -19,7 +19,7 @@
           [
             covered + file_coverage_statistics.covered,
             missed + file_coverage_statistics.missed,
-            # gotta remultiply with loc because files have different strenght 
and loc
+            # gotta remultiply with loc because files have different strength 
and loc
             # giving them a different "weight" in total
             total_strength + (file_coverage_statistics.strength * 
file_coverage_statistics.total)
           ]
@@ -35,14 +35,14 @@
       @covered  = covered
       @missed   = missed
       @total    = covered + missed
-      @percent  = compute_percent(covered, total)
-      @strength = compute_strength(total_strength, @total)
+      @percent  = compute_percent(covered, missed, total)
+      @strength = compute_strength(total_strength, total)
     end
 
   private
 
-    def compute_percent(covered, total)
-      return 100.0 if total.zero?
+    def compute_percent(covered, missed, total)
+      return 100.0 if missed.zero?
 
       covered * 100.0 / total
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/simplecov/defaults.rb 
new/lib/simplecov/defaults.rb
--- old/lib/simplecov/defaults.rb       2020-01-31 10:41:43.000000000 +0100
+++ new/lib/simplecov/defaults.rb       2020-02-25 22:41:26.000000000 +0100
@@ -22,13 +22,9 @@
 SimpleCov::CommandGuesser.original_run_command = "#{$PROGRAM_NAME} 
#{ARGV.join(' ')}"
 
 at_exit do
-  # If we are in a different process than called start, don't interfere.
-  next if SimpleCov.pid != Process.pid
+  next if SimpleCov.external_at_exit?
 
-  # If SimpleCov is no longer running then don't run exit tasks
-  next unless SimpleCov.running
-
-  SimpleCov.run_exit_tasks!
+  SimpleCov.at_exit_behavior
 end
 
 # Autoload config from ~/.simplecov if present
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/simplecov/source_file.rb 
new/lib/simplecov/source_file.rb
--- old/lib/simplecov/source_file.rb    2020-01-31 10:41:43.000000000 +0100
+++ new/lib/simplecov/source_file.rb    2020-02-25 22:41:26.000000000 +0100
@@ -25,7 +25,7 @@
     def src
       # We intentionally read source code lazily to
       # suppress reading unused source code.
-      @src ||= File.open(filename, "rb", &:readlines)
+      @src ||= load_source
     end
     alias source src
 
@@ -175,6 +175,51 @@
       end
     end
 
+    def load_source
+      lines = []
+      # The default encoding is UTF-8
+      File.open(filename, "rb:UTF-8") do |file|
+        current_line = file.gets
+
+        if shebang?(current_line)
+          lines << current_line
+          current_line = file.gets
+        end
+
+        read_lines(file, lines, current_line)
+      end
+    end
+
+    SHEBANG_REGEX = /\A#!/.freeze
+    def shebang?(line)
+      SHEBANG_REGEX.match?(line)
+    end
+
+    def read_lines(file, lines, current_line)
+      return lines unless current_line
+
+      set_encoding_based_on_magic_comment(file, current_line)
+      lines.concat([current_line], ensure_remove_undefs(file.readlines))
+    end
+
+    RUBY_FILE_ENCODING_MAGIC_COMMENT_REGEX = 
/\A#\s*(?:-\*-)?\s*(?:en)?coding:\s*(\S+)\s*(?:-\*-)?\s*\z/.freeze
+    def set_encoding_based_on_magic_comment(file, line)
+      # Check for encoding magic comment
+      # Encoding magic comment must be placed at first line except for shebang
+      if (match = RUBY_FILE_ENCODING_MAGIC_COMMENT_REGEX.match(line))
+        file.set_encoding(match[1], "UTF-8")
+      end
+    end
+
+    def ensure_remove_undefs(file_lines)
+      # invalid/undef replace are technically not really necessary but nice to
+      # have and work around a JRuby incompatibility. Also moved here from
+      # simplecov-html to have encoding shenaningans in one place. See #866
+      # also setting these option on `file.set_encoding` doesn't seem to work
+      # properly so it has to be done here.
+      file_lines.each { |line| line.encode!("UTF-8", invalid: :replace, undef: 
:replace) }
+    end
+
     def build_lines
       coverage_exceeding_source_warn if coverage_data["lines"].size > src.size
       lines = src.map.with_index(1) do |src, i|
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/simplecov/version.rb new/lib/simplecov/version.rb
--- old/lib/simplecov/version.rb        2020-01-31 10:41:43.000000000 +0100
+++ new/lib/simplecov/version.rb        2020-02-25 22:41:26.000000000 +0100
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
 
 module SimpleCov
-  VERSION = "0.18.1"
+  VERSION = "0.18.5"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/simplecov.rb new/lib/simplecov.rb
--- old/lib/simplecov.rb        2020-01-31 10:41:43.000000000 +0100
+++ new/lib/simplecov.rb        2020-02-25 22:41:26.000000000 +0100
@@ -27,6 +27,11 @@
     attr_accessor :pid
     attr_reader :exit_exception
 
+    # Basically, should we take care of at_exit behavior or something else?
+    # Used by the minitest plugin. See lib/minitest/simplecov_plugin.rb
+    attr_accessor :external_at_exit
+    alias external_at_exit? external_at_exit
+
     #
     # Sets up SimpleCov to run against your project.
     # You can optionally specify a profile to use as well as configuration 
with a block:
@@ -189,6 +194,14 @@
       end
     end
 
+    def at_exit_behavior
+      # If we are in a different process than called start, don't interfere.
+      return if SimpleCov.pid != Process.pid
+
+      # If SimpleCov is no longer running then don't run exit tasks
+      SimpleCov.run_exit_tasks! if SimpleCov.running
+    end
+
     # @api private
     #
     # Called from at_exit block
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2020-01-31 10:41:43.000000000 +0100
+++ new/metadata        2020-02-25 22:41:26.000000000 +0100
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: simplecov
 version: !ruby/object:Gem::Version
-  version: 0.18.1
+  version: 0.18.5
 platform: ruby
 authors:
 - Christoph Olszowka
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2020-01-31 00:00:00.000000000 Z
+date: 2020-02-25 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: docile
@@ -30,14 +30,14 @@
     requirements:
     - - "~>"
       - !ruby/object:Gem::Version
-        version: 0.11.0
+        version: '0.11'
   type: :runtime
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
     requirements:
     - - "~>"
       - !ruby/object:Gem::Version
-        version: 0.11.0
+        version: '0.11'
 description: Code coverage for Ruby with a powerful configuration library and 
automatic
   merging of coverage across test suites
 email:
@@ -55,6 +55,7 @@
 - doc/alternate-formatters.md
 - doc/commercial-services.md
 - doc/editor-integration.md
+- lib/minitest/simplecov_plugin.rb
 - lib/simplecov.rb
 - lib/simplecov/combine.rb
 - lib/simplecov/combine/branches_combiner.rb
@@ -96,9 +97,9 @@
 metadata:
   bug_tracker_uri: https://github.com/colszowka/simplecov/issues
   changelog_uri: 
https://github.com/colszowka/simplecov/blob/master/CHANGELOG.md
-  documentation_uri: https://www.rubydoc.info/gems/simplecov/0.18.1
+  documentation_uri: https://www.rubydoc.info/gems/simplecov/0.18.5
   mailing_list_uri: https://groups.google.com/forum/#!forum/simplecov
-  source_code_uri: https://github.com/colszowka/simplecov/tree/v0.18.1
+  source_code_uri: https://github.com/colszowka/simplecov/tree/v0.18.5
 post_install_message: 
 rdoc_options: []
 require_paths:


Reply via email to