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