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 1
1
# frozen_string_literal: true
2
2
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
+
3
16
Gem ::Specification . new do |spec |
4
17
# Linux distros may package ruby gems differently,
5
18
# and securely certify them independently via alternate package management systems.
@@ -18,9 +31,7 @@ Gem::Specification.new do |spec|
18
31
end
19
32
20
33
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
24
35
spec . authors = [ "Peter Boling" ]
25
36
26
37
You canβt perform that action at this time.
0 commit comments