From df787ddfb994df56ed2852ce4e03c5c6595bf5c8 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Wed, 5 Jun 2024 14:57:13 +0200 Subject: [PATCH] Update gemspec with versioned metadata --- ddtrace.gemspec | 3 ++- spec/ddtrace/release_gem_spec.rb | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ddtrace.gemspec b/ddtrace.gemspec index cae7573da53..c52caa3ea27 100644 --- a/ddtrace.gemspec +++ b/ddtrace.gemspec @@ -25,7 +25,8 @@ Gem::Specification.new do |spec| if spec.respond_to?(:metadata) spec.metadata['allowed_push_host'] = 'https://rubygems.org' - spec.metadata['changelog_uri'] = 'https://github.com/DataDog/dd-trace-rb/blob/master/CHANGELOG.md' + spec.metadata['changelog_uri'] = "https://github.com/DataDog/dd-trace-rb/blob/v#{spec.version}/CHANGELOG.md" + spec.metadata['source_code_uri'] = "https://github.com/DataDog/dd-trace-rb/tree/v#{spec.version}" else raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' end diff --git a/spec/ddtrace/release_gem_spec.rb b/spec/ddtrace/release_gem_spec.rb index aad1d90ccb7..24e39941e6f 100644 --- a/spec/ddtrace/release_gem_spec.rb +++ b/spec/ddtrace/release_gem_spec.rb @@ -108,5 +108,17 @@ expect(gemspec.licenses).to contain_exactly('BSD-3-Clause', 'Apache-2.0') end end + + describe '#metadata' do + it do + { + 'allowed_push_host' => 'https://rubygems.org', + 'changelog_uri' => "https://github.com/DataDog/dd-trace-rb/blob/v#{gemspec.version}/CHANGELOG.md", + 'source_code_uri' => "https://github.com/DataDog/dd-trace-rb/tree/v#{gemspec.version}" + }.each do |key, value| + expect(gemspec.metadata[key]).to eq(value) + end + end + end end end