File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,17 @@ gem_version = VersionGem::Version::VERSION
8
8
VersionGem ::Version . send ( :remove_const , :VERSION )
9
9
10
10
Gem ::Specification . new do |spec |
11
- spec . cert_chain = [ "certs/pboling.pem" ]
12
- spec . signing_key = File . expand_path ( "~/.ssh/gem-private_key.pem" ) if $PROGRAM_NAME. end_with? ( "gem" )
11
+ # Linux distros may package ruby gems differently,
12
+ # and securely certify them independently via alternate package management systems.
13
+ # Ref: https://gitlab.com/oauth-xx/version_gem/-/issues/3
14
+ # Hence, only enable signing if the cert_file is present.
15
+ cert_file = ENV . fetch ( "GEM_CERT_PATH" , "certs/#{ ENV . fetch ( "GEM_CERT_USER" , ENV [ "USER" ] ) } .pem" )
16
+ if cert_file && File . exist? ( cert_file )
17
+ spec . cert_chain = [ ENV . fetch ( "GEM_CERT_PATH" , "certs/#{ ENV . fetch ( "GEM_CERT_USER" , ENV [ "USER" ] ) } .pem" ) ]
18
+ if $PROGRAM_NAME. end_with? ( "gem" ) && ARGV == [ "build" , __FILE__ ]
19
+ spec . signing_key = File . expand_path ( "~/.ssh/gem-private_key.pem" )
20
+ end
21
+ end
13
22
14
23
spec . name = "version_gem"
15
24
spec . version = gem_version
You can’t perform that action at this time.
0 commit comments