Skip to content

Commit 19e2899

Browse files
committed
🎨 Modernize gemspec
1 parent d743795 commit 19e2899

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

omniauth-identity.gemspec

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
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-825171399
5-
load "lib/omniauth/identity/version.rb"
6-
gem_version = OmniAuth::Identity::Version::VERSION
7-
OmniAuth::Identity::Version.send(:remove_const, :VERSION)
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/omniauth/identity/version.rb", mod) }::OmniAuth::Identity::Version::VERSION
8+
else
9+
# TODO: Remove this hack once support for Ruby 3.0 and below is removed
10+
Kernel.load("lib/omniauth/identity/version.rb")
11+
g_ver = OmniAuth::Identity::Version::VERSION
12+
OmniAuth::Identity::Version.send(:remove_const, :VERSION)
13+
g_ver
14+
end
815

916
Gem::Specification.new do |spec|
1017
spec.name = "omniauth-identity"
@@ -44,9 +51,13 @@ Gem::Specification.new do |spec|
4451
spec.metadata["funding_uri"] = "https://liberapay.com/pboling"
4552
spec.metadata["rubygems_mfa_required"] = "true"
4653

54+
# Specify which files should be added to the gem when it is released.
4755
spec.files = Dir[
4856
# Splats (alphabetical)
49-
"lib/**/*",
57+
"lib/**/*.rb",
58+
]
59+
# Automatically included with gem package, no need to list again in files.
60+
spec.extra_rdoc_files = Dir[
5061
# Files (alphabetical)
5162
"CHANGELOG.md",
5263
"CODE_OF_CONDUCT.md",
@@ -55,6 +66,15 @@ Gem::Specification.new do |spec|
5566
"README.md",
5667
"SECURITY.md",
5768
]
69+
spec.rdoc_options += [
70+
"--title",
71+
"#{spec.name} - #{spec.summary}",
72+
"--main",
73+
"README.md",
74+
"--line-numbers",
75+
"--inline-source",
76+
"--quiet",
77+
]
5878
spec.bindir = "exe"
5979
spec.require_paths = ["lib"]
6080

0 commit comments

Comments
 (0)