File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
3+ gem_version =
4+ if RUBY_VERSION >= "3.1"
5+ # Loading version into an anonymous module allows version.rb to get code coverage from SimpleCov!
6+ # See: https://github.com/simplecov-ruby/simplecov/issues/557#issuecomment-2630782358
7+ Module . new . tap { |mod | Kernel . load ( "lib/version_gem/version.rb" , mod ) } ::VersionGem ::Version ::VERSION
8+ else
9+ # TODO: Remove this hack once support for Ruby 3.0 and below is removed
10+ Kernel . load ( "lib/version_gem/version.rb" )
11+ g_ver = VersionGem ::Version ::VERSION
12+ VersionGem ::Version . send ( :remove_const , :VERSION )
13+ g_ver
14+ end
15+
316Gem ::Specification . new do |spec |
417 # Linux distros may package ruby gems differently,
518 # and securely certify them independently via alternate package management systems.
@@ -18,9 +31,7 @@ Gem::Specification.new do |spec|
1831 end
1932
2033 spec . name = "version_gem"
21- # Loading version into an anonymous module allows version.rb to get code coverage from SimpleCov!
22- # See: https://github.com/simplecov-ruby/simplecov/issues/557#issuecomment-2630782358
23- spec . version = Module . new . tap { |mod | Kernel . load ( "lib/version_gem/version.rb" , mod ) } ::VersionGem ::Version ::VERSION
34+ spec . version = gem_version
2435 spec . authors = [ "Peter Boling" ]
25362637
You canβt perform that action at this time.
0 commit comments