@@ -18,16 +18,16 @@ Gem::Specification.new do |spec|
18
18
# Linux distros may package ruby gems differently,
19
19
# and securely certify them independently via alternate package management systems.
20
20
# Ref: https://gitlab.com/oauth-xx/version_gem/-/issues/3
21
- # Hence, only enable signing if the cert_file is present .
21
+ # Hence, only enable signing if `SKIP_GEM_SIGNING` is not set in ENV .
22
22
# See CONTRIBUTING.md
23
- default_user_cert = "certs/#{ ENV . fetch ( "GEM_CERT_USER" , ENV [ "USER" ] ) } .pem"
24
- default_user_cert_path = File . join ( __dir__ , default_user_cert )
25
- cert_file_path = ENV . fetch ( "GEM_CERT_PATH" , default_user_cert_path )
23
+ user_cert = "certs/#{ ENV . fetch ( "GEM_CERT_USER" , ENV [ "USER" ] ) } .pem"
24
+ cert_file_path = File . join ( __dir__ , user_cert )
26
25
cert_chain = cert_file_path . split ( "," )
27
- if cert_file_path && cert_chain . map { |fp | File . exist? ( fp ) }
26
+ cert_chain . select! { |fp | File . exist? ( fp ) }
27
+ if cert_file_path && cert_chain . any?
28
28
spec . cert_chain = cert_chain
29
- if $PROGRAM_NAME. end_with? ( "gem" , "rake" ) && ARGV [ 0 ] == "build"
30
- spec . signing_key = File . expand_path ( "~/ .ssh/ gem-private_key.pem")
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")
31
31
end
32
32
end
33
33
0 commit comments