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 1
1
# frozen_string_literal: true
2
2
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
-
10
3
Gem ::Specification . new do |spec |
11
4
# Linux distros may package ruby gems differently,
12
5
# and securely certify them independently via alternate package management systems.
@@ -26,6 +19,9 @@ Gem::Specification.new do |spec|
26
19
27
20
spec . name = "version_gem"
28
21
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
29
25
spec . authors = [ "Peter Boling" ]
30
26
31
27
You can’t perform that action at this time.
0 commit comments