File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
3- # Get the GEMFILE_VERSION without *require* "my_gem/version", for code coverage accuracy
4- # See: https://github.com/simplecov-ruby/simplecov/issues/557#issuecomment-2630782358
5- # Kernel.load because load is overloaded in RubyGems during gemspec evaluation
6- Kernel . load ( "lib/version_gem/version.rb" )
7- gem_version = VersionGem ::Version ::VERSION
8- VersionGem ::Version . send ( :remove_const , :VERSION )
9-
103Gem ::Specification . new do |spec |
114 # Linux distros may package ruby gems differently,
125 # and securely certify them independently via alternate package management systems.
@@ -26,6 +19,9 @@ Gem::Specification.new do |spec|
2619
2720 spec . name = "version_gem"
2821 spec . version = gem_version
22+ # Loading version into an anonymous module allows version.rb to get code coverage from SimpleCov!
23+ # See: https://github.com/simplecov-ruby/simplecov/issues/557#issuecomment-2630782358
24+ spec . version = Module . new . tap { |mod | Kernel . load ( "lib/version_gem/version.rb" , mod ) } ::VersionGem ::Version ::VERSION
2925 spec . authors = [ "Peter Boling" ]
30263127
You can’t perform that action at this time.
0 commit comments