I have multiple GEMs on RubyGems and some of them show the Source Code link and some do not.
I am under the impression that all you need to do to set the source code link is set the source_code_uri
meta data in the .gemspec
Is there another setting that needs to be configured?
# This one Works
spec.metadata['source_code_uri'] = 'https://github.com/klueless-io/handlebars-helpers'
# This one does NOT work
spec.metadata['source_code_uri'] = 'https://github.com/klueless-io/cmdlet'
CodePudding user response:
When looking into the cmdlet.gemspec
which is the gem that is missing information on Rubygems, then there are these lines:
spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://github.com/klueless-io/cmdlet'
spec.metadata['changelog_uri'] = 'https://github.com/klueless-io/cmdlet/blob/main/CHANGELOG.md'
and then below in the same file:
spec.metadata = {
'rubygems_mfa_required' => 'true'
}
That means the way how you set rubygems_mfa_required
resets the whole spec.metadata
hash.
Just change the rubygems_mfa_required
assignment to the following and it will work after the next gem push to Rubygems:
spec.metadata['rubygems_mfa_required'] = 'true'