Skip to content

Commit a985ea1

Browse files
committed
⚡️ Don't check for cert if SKIP_GEM_SIGNING is set
1 parent 03c05eb commit a985ea1

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

oauth2.gemspec

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,21 @@ gl_homepage = "https://gitlab.com/oauth-xx/oauth2"
1515
gh_mirror = "https://github.com/oauth-xx/oauth2"
1616

1717
Gem::Specification.new do |spec|
18-
# Linux distros may package ruby gems differently,
19-
# and securely certify them independently via alternate package management systems.
18+
# Linux distros often package gems and securely certify them independent
19+
# of the official RubyGem certification process. Allowed via ENV["SKIP_GEM_SIGNING"]
2020
# Ref: https://gitlab.com/oauth-xx/version_gem/-/issues/3
2121
# Hence, only enable signing if `SKIP_GEM_SIGNING` is not set in ENV.
2222
# See CONTRIBUTING.md
23-
user_cert = "certs/#{ENV.fetch("GEM_CERT_USER", ENV["USER"])}.pem"
24-
cert_file_path = File.join(__dir__, user_cert)
25-
cert_chain = cert_file_path.split(",")
26-
cert_chain.select! { |fp| File.exist?(fp) }
27-
if cert_file_path && cert_chain.any?
28-
spec.cert_chain = cert_chain
29-
if $PROGRAM_NAME.end_with?("gem") && ARGV[0] == "build" && !ENV.include?("SKIP_GEM_SIGNING")
30-
spec.signing_key = File.join(Gem.user_home, ".ssh", "gem-private_key.pem")
23+
unless ENV.include?("SKIP_GEM_SIGNING")
24+
user_cert = "certs/#{ENV.fetch("GEM_CERT_USER", ENV["USER"])}.pem"
25+
cert_file_path = File.join(__dir__, user_cert)
26+
cert_chain = cert_file_path.split(",")
27+
cert_chain.select! { |fp| File.exist?(fp) }
28+
if cert_file_path && cert_chain.any?
29+
spec.cert_chain = cert_chain
30+
if $PROGRAM_NAME.end_with?("gem") && ARGV[0] == "build"
31+
spec.signing_key = File.join(Gem.user_home, ".ssh", "gem-private_key.pem")
32+
end
3133
end
3234
end
3335

0 commit comments

Comments
 (0)