Skip to content

Commit 8c35d82

Browse files
committed
📦️ Allow packaging when cert file present
1 parent 1eedbc3 commit 8c35d82

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

version_gem.gemspec

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@ Gem::Specification.new do |spec|
1313
# Ref: https://gitlab.com/oauth-xx/version_gem/-/issues/3
1414
# Hence, only enable signing if the cert_file is present.
1515
cert_file = ENV.fetch("GEM_CERT_PATH", "certs/#{ENV.fetch("GEM_CERT_USER", ENV["USER"])}.pem")
16-
if cert_file && File.exist?(cert_file)
16+
if cert_file && File.exist?(File.join(__dir__, cert_file))
1717
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__]
18+
if $PROGRAM_NAME.end_with?("gem", "rake") && ARGV[0] == "build"
1919
spec.signing_key = File.expand_path("~/.ssh/gem-private_key.pem")
20+
else
21+
warn "Packaging via #{$PROGRAM_NAME} with #{ARGV.inspect}"
2022
end
23+
else
24+
warn "No Cert File Found. May package without signing."
2125
end
2226

2327
spec.name = "version_gem"

0 commit comments

Comments
 (0)