Skip to content

Commit

Permalink
Update gemspec to include signing key path
Browse files Browse the repository at this point in the history
By default, signing key is expected to be at
root of project with name gem-private_key.pem.

Include only if command is gem and argument is gemspec and signing key exists.

Signed-off-by: Vijayan Balasubramanian <[email protected]>
  • Loading branch information
VijayanB committed Dec 6, 2021
1 parent 9517882 commit 397e541
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Gemfile.lock
profile/**/data/*.json
.byebug_history
dist/
gem-private_key.pem
9 changes: 8 additions & 1 deletion opensearch-api/opensearch-api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'opensearch/api/version'

signing_key_path = File.expand_path("../gem-private_key.pem")

Gem::Specification.new do |s|
s.name = 'opensearch-api'
s.version = OpenSearch::API::VERSION
Expand All @@ -45,7 +47,12 @@ Gem::Specification.new do |s|
s.files = `git ls-files`.split($/)
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
s.test_files = s.files.grep(%r{^(test|spec|features)/})
s.cert_chain = ['../certs/opensearch-rubygems.pem']

if $PROGRAM_NAME.end_with?("gem") && ARGV == ["build", __FILE__] && File.exist?(signing_key_path)
s.signing_key = signing_key_path
s.cert_chain = ['../certs/opensearch-rubygems.pem']
end

s.require_paths = ['lib']

s.extra_rdoc_files = [ 'README.md', 'LICENSE' ]
Expand Down
9 changes: 8 additions & 1 deletion opensearch-dsl/opensearch-dsl.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'opensearch/dsl/version'

signing_key_path = File.expand_path("../gem-private_key.pem")

Gem::Specification.new do |s|
s.name = 'opensearch-dsl'
s.version = OpenSearch::DSL::VERSION
Expand All @@ -46,7 +48,12 @@ Gem::Specification.new do |s|
s.files = `git ls-files`.split($/)
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
s.test_files = s.files.grep(%r{^(test|spec|features)/})
s.cert_chain = ['../certs/opensearch-rubygems.pem']

if $PROGRAM_NAME.end_with?("gem") && ARGV == ["build", __FILE__] && File.exist?(signing_key_path)
s.signing_key = signing_key_path
s.cert_chain = ['../certs/opensearch-rubygems.pem']
end

s.require_paths = ['lib']

s.extra_rdoc_files = [ 'README.md', 'LICENSE' ]
Expand Down
9 changes: 8 additions & 1 deletion opensearch-transport/opensearch-transport.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'opensearch/transport/version'

signing_key_path = File.expand_path("../gem-private_key.pem")

Gem::Specification.new do |s|
s.name = 'opensearch-transport'
s.version = OpenSearch::Transport::VERSION
Expand All @@ -45,7 +47,12 @@ Gem::Specification.new do |s|
s.files = `git ls-files`.split($/)
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
s.test_files = s.files.grep(%r{^(test|spec|features)/})
s.cert_chain = ['../certs/opensearch-rubygems.pem']

if $PROGRAM_NAME.end_with?("gem") && ARGV == ["build", __FILE__] && File.exist?(signing_key_path)
s.signing_key = signing_key_path
s.cert_chain = ['../certs/opensearch-rubygems.pem']
end

s.require_paths = ['lib']

s.extra_rdoc_files = [ 'README.md', 'LICENSE' ]
Expand Down
9 changes: 8 additions & 1 deletion opensearch/opensearch.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'opensearch/version'

signing_key_path = File.expand_path("../gem-private_key.pem")

Gem::Specification.new do |s|
s.name = 'opensearch-ruby'
s.version = OpenSearch::VERSION
Expand All @@ -45,7 +47,12 @@ Gem::Specification.new do |s|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
s.executables << 'opensearch_ruby_console'
s.test_files = s.files.grep(%r{^(test|spec|features)/})
s.cert_chain = ['../certs/opensearch-rubygems.pem']

if $PROGRAM_NAME.end_with?("gem") && ARGV == ["build", __FILE__] && File.exist?(signing_key_path)
s.signing_key = signing_key_path
s.cert_chain = ['../certs/opensearch-rubygems.pem']
end

s.require_paths = ['lib']
s.bindir = 'bin'

Expand Down
Empty file modified release/build.sh
100644 → 100755
Empty file.

0 comments on commit 397e541

Please sign in to comment.